正在查看: Plus 12 v10.13.1.1 应用的 MessagesController.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Plus 12 v10.13.1.1 应用的 MessagesController.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package org.telegram.messenger;
import android.app.Activity;
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Paint;
import android.location.Location;
import android.net.Uri;
import android.os.Bundle;
import android.os.Looper;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Pair;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.util.SparseIntArray;
import androidx.collection.LongSparseArray;
import androidx.core.util.Consumer;
import j$.util.Collection;
import j$.util.concurrent.ConcurrentHashMap;
import j$.util.stream.Collectors;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import org.telegram.SQLite.SQLiteCursor;
import org.telegram.SQLite.SQLiteDatabase;
import org.telegram.SQLite.SQLiteException;
import org.telegram.SQLite.SQLitePreparedStatement;
import org.telegram.db.DatabaseManager;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.MessagesController$;
import org.telegram.messenger.MessagesStorage;
import org.telegram.messenger.SavedMessagesController;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.browser.Browser;
import org.telegram.messenger.support.LongSparseIntArray;
import org.telegram.messenger.support.LongSparseLongArray;
import org.telegram.plus.FirebaseHelper;
import org.telegram.plus.UserHelper;
import org.telegram.tgnet.AbstractSerializedData;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.NativeByteBuffer;
import org.telegram.tgnet.RequestDelegate;
import org.telegram.tgnet.SerializedData;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
import org.telegram.tgnet.TLRPC$Document;
import org.telegram.tgnet.TLRPC$Update;
import org.telegram.tgnet.TLRPC$User;
import org.telegram.tgnet.tl.TL_chatlists;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.PlusSettings;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Business.QuickRepliesController;
import org.telegram.ui.ChatActivity;
import org.telegram.ui.ChatRightsEditActivity;
import org.telegram.ui.Components.AlertsCreator;
import org.telegram.ui.Components.AnimatedEmojiDrawable;
import org.telegram.ui.Components.BulletinFactory;
import org.telegram.ui.Components.ImageUpdater;
import org.telegram.ui.Components.Premium.LimitReachedBottomSheet;
import org.telegram.ui.Components.Reactions.ReactionsLayoutInBubble;
import org.telegram.ui.DialogsActivity;
import org.telegram.ui.LaunchActivity;
import org.telegram.ui.PremiumPreviewFragment;
import org.telegram.ui.ProfileActivity;
import org.telegram.ui.SecretMediaViewer;
import org.telegram.ui.Stories.StoriesController;
import org.telegram.ui.TopicsFragment;
public class MessagesController extends BaseController implements NotificationCenter$NotificationCenterDelegate {
public static final int ARCHIVED_FOLDER_ID = 1;
public static final int DIALOGS_ADMIN = 27;
public static final int DIALOGS_BOTS = 25;
public static final int DIALOGS_CHANNELS = 24;
public static final int DIALOGS_FAVS = 26;
public static final int DIALOGS_FORWARD = 3;
public static final int DIALOGS_GROUPS = 21;
public static final int DIALOGS_GROUPS_ALL = 23;
public static final int DIALOGS_GROUPS_WITH_TOPICS = 30;
public static final int DIALOGS_MEGAGROUPS = 22;
public static final int DIALOGS_UNMUTED = 29;
public static final int DIALOGS_UNREAD = 28;
public static final int DIALOGS_USERS = 20;
public static int DIALOG_FILTER_FLAG_BOTS = 16;
public static int DIALOG_FILTER_FLAG_CHANNELS = 8;
public static int DIALOG_FILTER_FLAG_CHATLIST = 512;
public static int DIALOG_FILTER_FLAG_CHATLIST_ADMIN = 1024;
public static int DIALOG_FILTER_FLAG_CONTACTS = 1;
public static int DIALOG_FILTER_FLAG_EXCLUDE_ARCHIVED = 128;
public static int DIALOG_FILTER_FLAG_EXCLUDE_GROUPS = 8192;
public static int DIALOG_FILTER_FLAG_EXCLUDE_MEGAGROUPS = 16384;
public static int DIALOG_FILTER_FLAG_EXCLUDE_MUTED = 32;
public static int DIALOG_FILTER_FLAG_EXCLUDE_READ = 64;
public static int DIALOG_FILTER_FLAG_GROUPS = 4;
public static int DIALOG_FILTER_FLAG_NON_CONTACTS = 2;
public static int DIALOG_FILTER_FLAG_ONLY_ARCHIVED = 256;
public static final int HIDDEN_FOLDER_ID = 2;
public static final int LOAD_AROUND_DATE = 4;
public static final int LOAD_AROUND_MESSAGE = 3;
public static final int LOAD_BACKWARD = 0;
public static final int LOAD_FORWARD = 1;
public static final int LOAD_FROM_UNREAD = 2;
public static int PROMO_TYPE_OTHER = 2;
public static int PROMO_TYPE_PROXY = 0;
public static int PROMO_TYPE_PSA = 1;
public static final String TAG = "MessagesController";
public static int UPDATE_MASK_AVATAR = 2;
public static int UPDATE_MASK_CHAT = 8192;
public static int UPDATE_MASK_CHAT_AVATAR = 8;
public static int UPDATE_MASK_CHAT_MEMBERS = 32;
public static int UPDATE_MASK_CHAT_NAME = 16;
public static int UPDATE_MASK_CHECK = 65536;
public static int UPDATE_MASK_EMOJI_INTERACTIONS = 262144;
public static int UPDATE_MASK_EMOJI_STATUS = 524288;
public static int UPDATE_MASK_MESSAGE_TEXT = 32768;
public static int UPDATE_MASK_NAME = 1;
public static int UPDATE_MASK_NEW_MESSAGE = 2048;
public static int UPDATE_MASK_PHONE = 1024;
public static int UPDATE_MASK_REACTIONS_READ = 1048576;
public static int UPDATE_MASK_READ_DIALOG_MESSAGE = 256;
public static int UPDATE_MASK_REORDER = 131072;
public static int UPDATE_MASK_SELECT_DIALOG = 512;
public static int UPDATE_MASK_SEND_STATE = 4096;
public static int UPDATE_MASK_STATUS = 4;
public static int UPDATE_MASK_USER_PHONE = 128;
public static int UPDATE_MASK_USER_PRINT = 64;
private static int lastDialogType = 0;
private static volatile long lastPasswordCheckTime = 0;
private static volatile long lastThemeCheckTime = 0;
public static int stableIdPointer = 100;
private int DIALOGS_LOAD_TYPE_CACHE;
private int DIALOGS_LOAD_TYPE_CHANNEL;
private int DIALOGS_LOAD_TYPE_UNKNOWN;
public int aboutLengthLimitDefault;
public int aboutLengthLimitPremium;
private HashMap<Long, TLRPC.Chat> activeVoiceChatsMap;
public ArrayList<TLRPC.Dialog> allDialogs;
public boolean androidDisableRoundCamera2;
public float animatedEmojisZoom;
private final CacheFetcher<Integer, TLRPC.TL_help_appConfig> appConfigFetcher;
public Set<String> authDomains;
public int authorizationAutoconfirmPeriod;
public boolean autoarchiveAvailable;
public Set<String> autologinDomains;
public String autologinToken;
private TLRPC.messages_AvailableEffects availableEffects;
public int availableMapProviders;
public boolean backgroundConnection;
public LongSparseIntArray blockePeers;
public boolean blockedCountry;
public boolean blockedEndReached;
public int boostsChannelLevelMax;
public long boostsPerSentGift;
public int businessChatLinksLimit;
public SparseIntArray businessFeaturesTypesToPosition;
private boolean busyLoading;
private CacheByChatsController cacheByChatsController;
private HashMap<Long, ChannelRecommendations> cachedChannelRecommendations;
private TLRPC.TL_exportedContactToken cachedContactToken;
private LongSparseArray<Boolean> cachedIsUserPremiumBlocked;
public int callConnectTimeout;
public int callPacketTimeout;
public int callReceiveTimeout;
public int callRingTimeout;
public boolean canEditFactcheck;
public boolean canRevokePmInbox;
public int captionLengthLimitDefault;
public int captionLengthLimitPremium;
private LongSparseArray<LongSparseArray<TLRPC.ChannelParticipant>> channelAdmins;
public int channelBgIconLevelMin;
private ChannelBoostsController channelBoostsControler;
public int channelCustomWallpaperLevelMin;
public int channelEmojiStatusLevelMin;
public int channelProfileIconLevelMin;
public int channelRestrictSponsoredLevelMin;
public boolean channelRevenueWithdrawalEnabled;
private LongSparseArray<ArrayList<Integer>> channelViewsToSend;
public int channelWallpaperLevelMin;
public int channelsLimitDefault;
public int channelsLimitPremium;
private LongSparseIntArray channelsPts;
public int chatReadMarkExpirePeriod;
public int chatReadMarkSizeThreshold;
private SparseArray<ChatlistUpdatesStat> chatlistFoldersUpdates;
public int chatlistInvitesLimitDefault;
public int chatlistInvitesLimitPremium;
public int chatlistJoinedLimitDefault;
public int chatlistJoinedLimitPremium;
private int chatlistUpdatePeriod;
private ConcurrentHashMap<Long, TLRPC.Chat> chats;
public int checkResetLangpack;
private LongSparseArray<Boolean> checkingLastMessagesDialogs;
private boolean checkingPromoInfo;
private int checkingPromoInfoRequestId;
private boolean checkingTosUpdate;
private LongSparseArray<TLRPC.Dialog> clearingHistoryDialogs;
public boolean collectDeviceStats;
private ArrayList<Long> createdDialogIds;
private ArrayList<Long> createdDialogMainThreadIds;
private ArrayList<Long> createdScheduledDialogIds;
private Runnable currentDeleteTaskRunnable;
private LongSparseArray<ArrayList<Integer>> currentDeletingTaskMediaMids;
private LongSparseArray<ArrayList<Integer>> currentDeletingTaskMids;
private int currentDeletingTaskTime;
public int currentFolderId;
private int currentTime;
public String dcDomainName;
public LongSparseIntArray deletedHistory;
private LongSparseArray<TLRPC.Dialog> deletingDialogs;
private Comparator<TLRPC.Dialog> dialogComparator;
private final Comparator<TLRPC.Dialog> dialogComparatorUnmuted;
private final Comparator<TLRPC.Dialog> dialogComparatorUnread;
private final Comparator<TLRPC.Dialog> dialogComparatorUnreadUnmuted;
private final Comparator<TLRPC.Dialog> dialogComparatorUsersByStatus;
private final Comparator<TLRPC.Dialog> dialogDateComparator;
private final Comparator<TLRPC.Dialog> dialogDateComparator2;
public ArrayList<DialogFilter> dialogFilters;
public SparseArray<DialogFilter> dialogFiltersById;
public SparseArray<DialogFilter> dialogFiltersByType;
public int dialogFiltersChatsLimitDefault;
public int dialogFiltersChatsLimitPremium;
public int dialogFiltersLimitDefault;
public int dialogFiltersLimitPremium;
public boolean dialogFiltersLoaded;
public int dialogFiltersPinnedLimitDefault;
public int dialogFiltersPinnedLimitPremium;
public LongSparseArray<ArrayList<MessageObject>> dialogMessage;
public LongSparseArray<MessageObject> dialogMessageFromUnblocked;
public SparseArray<MessageObject> dialogMessagesByIds;
public LongSparseArray<MessageObject> dialogMessagesByRandomIds;
private LongSparseArray<DialogPhotos> dialogPhotos;
public SparseArray<ArrayList<TLRPC.Dialog>> dialogsAdminByFolder;
public ArrayList<TLRPC.Dialog> dialogsAdminChannels;
public ArrayList<TLRPC.Dialog> dialogsAdminGroups;
public ArrayList<TLRPC.Dialog> dialogsAdminSuperGroups;
public ArrayList<TLRPC.Dialog> dialogsBackup;
public SparseArray<ArrayList<TLRPC.Dialog>> dialogsBotsByFolder;
public SparseArray<ArrayList<TLRPC.Dialog>> dialogsByFolder;
public ArrayList<TLRPC.Dialog> dialogsCanAddUsers;
public SparseArray<ArrayList<TLRPC.Dialog>> dialogsChannelsByFolder;
public ArrayList<TLRPC.Dialog> dialogsChannelsOnly;
private SparseBooleanArray dialogsEndReached;
public SparseArray<ArrayList<TLRPC.Dialog>> dialogsFavsByFolder;
public ArrayList<TLRPC.Dialog> dialogsForBlock;
public ArrayList<TLRPC.Dialog> dialogsForward;
public SparseArray<ArrayList<TLRPC.Dialog>> dialogsGroupsAllByFolder;
public SparseArray<ArrayList<TLRPC.Dialog>> dialogsGroupsByFolder;
public ArrayList<TLRPC.Dialog> dialogsGroupsOnly;
public SparseArray<ArrayList<TLRPC.Dialog>> dialogsHiddenByFolder;
private boolean dialogsInTransaction;
public boolean dialogsLoaded;
private int dialogsLoadedTillDate;
public SparseArray<ArrayList<TLRPC.Dialog>> dialogsMegaGroupsByFolder;
public ArrayList<TLRPC.Dialog> dialogsMyChannels;
public ArrayList<TLRPC.Dialog> dialogsMyGroups;
public ArrayList<TLRPC.Dialog> dialogsOwnChannels;
public ArrayList<TLRPC.Dialog> dialogsOwnGroups;
public ArrayList<TLRPC.Dialog> dialogsOwnSuperGroups;
public ArrayList<TLRPC.Dialog> dialogsSecrets;
public ArrayList<TLRPC.Dialog> dialogsServerOnly;
public ArrayList<TLRPC.Dialog> dialogsTopicsGroups;
public SparseArray<ArrayList<TLRPC.Dialog>> dialogsUnreadByFolder;
public SparseArray<ArrayList<TLRPC.Dialog>> dialogsUsersByFolder;
public ArrayList<TLRPC.Dialog> dialogsUsersOnly;
public LongSparseArray<TLRPC.Dialog> dialogs_dict;
public ConcurrentHashMap<Long, Integer> dialogs_read_inbox_max;
public ConcurrentHashMap<Long, Integer> dialogs_read_outbox_max;
public HashSet<String> diceEmojies;
public HashMap<String, DiceFrameSuccess> diceSuccess;
public List<String> directPaymentsCurrency;
public Set<String> dismissedSuggestions;
private final CacheFetcher<Integer, TLRPC.messages_AvailableEffects> effectsFetcher;
public HashMap<Long, ArrayList<TLRPC.TL_sendMessageEmojiInteraction>> emojiInteractions;
private SharedPreferences emojiPreferences;
public HashMap<String, EmojiSound> emojiSounds;
private LongSparseArray<Integer> emojiStatusUntilValues;
public boolean enableJoined;
private ConcurrentHashMap<Integer, TLRPC.EncryptedChat> encryptedChats;
public Set<String> exportGroupUri;
public Set<String> exportPrivateUri;
public Set<String> exportUri;
private LongSparseArray<TLRPC.TL_chatInviteExported> exportedChats;
public int factcheckLengthLimit;
public ArrayList<FaqSearchResult> faqSearchArray;
public TLRPC.WebPage faqWebPage;
public ArrayList<Long> favsDialogs;
public boolean filtersEnabled;
public boolean filtersHasArchive;
public boolean firstGettingTask;
public boolean folderTags;
public int forumUpgradeParticipantsMin;
public ArrayList<DialogFilter> frozenDialogFilters;
private LongSparseArray<TLRPC.ChatFull> fullChats;
private LongSparseArray<TLRPC.UserFull> fullUsers;
private boolean getDifferenceFirstSync;
public boolean getfileExperimentalParams;
private boolean gettingAppChangelog;
private LongSparseArray<Boolean> gettingChatInviters;
public boolean gettingDifference;
private LongSparseArray<Boolean> gettingDifferenceChannels;
private boolean gettingNewDeleteTask;
private LongSparseArray<Boolean> gettingUnknownChannels;
private LongSparseArray<Boolean> gettingUnknownDialogs;
public String gifSearchBot;
public ArrayList<String> gifSearchEmojies;
public boolean giftAttachMenuIcon;
public boolean giftTextFieldIcon;
public long giveawayAddPeersMax;
public long giveawayBoostsPerPremium;
public long giveawayCountriesMax;
public boolean giveawayGiftsPurchaseAvailable;
public long giveawayPeriodMax;
public int groupCallVideoMaxParticipants;
private LongSparseArray<ChatObject.Call> groupCalls;
private LongSparseArray<ChatObject.Call> groupCallsByChatId;
public int groupCustomWallpaperLevelMin;
public int groupEmojiStatusLevelMin;
public int groupEmojiStickersLevelMin;
public int groupProfileBgIconLevelMin;
public int groupTranscribeLevelMin;
public int groupWallpaperLevelMin;
private boolean hasArchivedChats;
private boolean hasStories;
public ArrayList<Long> hiddenDialogs;
public int hiddenMembersGroupSizeMin;
public ArrayList<Long> hiddenUndoChats;
public boolean hideJoinedGroup;
public boolean hideLeftGroup;
public ArrayList<TLRPC.RecentMeUrl> hintDialogs;
public volatile boolean ignoreSetOnline;
public String imageSearchBot;
public boolean increasePinnedDialogsLimit;
private String installReferer;
public int introDescriptionLengthLimit;
public int introTitleLengthLimit;
private boolean isFilter;
private boolean isForwarding;
private boolean isLeftPromoChannel;
private boolean isResolvingPromo;
private ArrayList<Long> joiningToChannels;
public boolean keepAliveService;
public int largeQueueMaxActiveOperations;
private int lastCheckPromoId;
public int lastKnownSessionsCount;
private int lastPrintingStringCount;
private long lastPushRegisterSendTime;
private LongSparseArray<Long> lastQuickReplyServerQueryTime;
private LongSparseArray<Long> lastSavedServerQueryTime;
private LongSparseArray<Long> lastScheduledServerQueryTime;
private LongSparseArray<Long> lastServerQueryTime;
private long lastStatusUpdateTime;
private long lastViewsCheckTime;
public String linkPrefix;
private Runnable loadAppConfigRunnable;
public LongSparseLongArray loadedFullChats;
private HashSet<Long> loadedFullParticipants;
private LongSparseLongArray loadedFullUsers;
private boolean loadingAvailableEffects;
public boolean loadingBlockedPeers;
private LongSparseIntArray loadingChannelAdmins;
private SparseBooleanArray loadingDialogs;
private HashSet<Long> loadingFullChats;
private HashSet<Long> loadingFullParticipants;
private HashSet<Long> loadingFullUsers;
private HashSet<Long> loadingGroupCalls;
private HashSet<Long> loadingIsUserPremiumBlocked;
private int loadingNotificationSettings;
private boolean loadingNotificationSignUpSettings;
private boolean loadingPeerColors;
private LongSparseArray<Boolean> loadingPeerSettings;
private SparseIntArray loadingPinnedDialogs;
private boolean loadingProfilePeerColors;
private HashSet<Long> loadingReactionTags;
private boolean loadingRemoteFilters;
private boolean loadingSuggestedFilters;
private boolean loadingUnreadDialogs;
private boolean loggedDeviceStats;
private SharedPreferences mainPreferences;
public String mapKey;
public int mapProvider;
private SharedPreferences markPreferences;
public int maxBroadcastCount;
public int maxCaptionLength;
public int maxEditTime;
public int maxFaveStickersCount;
public int maxFolderPinnedDialogsCountDefault;
public int maxFolderPinnedDialogsCountPremium;
public int maxGroupCount;
public int maxMegagroupCount;
public int maxMessageLength;
public int maxPinnedDialogsCountDefault;
public int maxPinnedDialogsCountPremium;
public int maxRecentGifsCount;
public int maxRecentStickersCount;
private SparseIntArray migratedChats;
private boolean migratingDialogs;
public int minGroupConvertSize;
private LongSparseArray<ArrayList<Integer>> needShortPollChannels;
private LongSparseArray<ArrayList<Integer>> needShortPollOnlines;
private boolean needSorting;
public NewMessageCallback newMessageCallback;
public boolean newNoncontactPeersRequirePremiumWithoutOwnpremium;
private SparseIntArray nextDialogsCacheOffset;
private int nextPromoInfoCheckTime;
private int nextTosCheckTime;
private SharedPreferences notificationsPreferences;
private final Runnable notifyTranscriptionAudioCooldownUpdate;
private ConcurrentHashMap<String, TLObject> objectsByUsernames;
private boolean offlineSent;
private Utilities.Callback<Boolean> onLoadedRemoteFilters;
public ConcurrentHashMap<Long, Integer> onlinePrivacy;
private long only_id;
private long only_media_id;
private Runnable passwordCheckRunnable;
public PeerColors peerColors;
private final long peerDialogRequestTimeout;
private final LongSparseArray<Long> peerDialogsRequested;
public Set<String> pendingSuggestions;
private LongSparseIntArray pendingUnreadCounter;
public SparseArray<ImageUpdater> photoSuggestion;
public LongSparseArray<TLRPC.Dialog> pinnedDialogs_dict;
private SharedPreferences plusPreferences;
public long plusPromoChannelArchived;
public long plusPromoChannelDeleted;
private TLRPC.Chat plusPromoChat;
public int pmReadDateExpirePeriod;
private LongSparseArray<SparseArray<MessageObject>> pollsToCheck;
private int pollsToCheckSize;
public boolean preloadFeaturedStickers;
public String premiumBotUsername;
public SparseIntArray premiumFeaturesTypesToPosition;
public String premiumInvoiceSlug;
public boolean premiumLocked;
public String premiumManageSubscriptionUrl;
public LongSparseArray<LongSparseArray<CharSequence>> printingStrings;
public LongSparseArray<LongSparseArray<Integer>> printingStringsTypes;
public ConcurrentHashMap<Long, ConcurrentHashMap<Integer, ArrayList<PrintingUser>>> printingUsers;
public PeerColors profilePeerColors;
private TLRPC.Dialog promoDialog;
private long promoDialogId;
public int promoDialogType;
public String promoPsaMessage;
public String promoPsaType;
private String proxyDialogAddress;
public int publicLinksLimitDefault;
public int publicLinksLimitPremium;
public boolean qrLoginCamera;
public int quickRepliesLimit;
public int quickReplyMessagesLimit;
public int quoteLengthMax;
public int ratingDecay;
private LongSparseArray<TLRPC.TL_messages_savedReactionsTags> reactionTags;
public int reactionsInChatMax;
public int reactionsUniqMax;
public int reactionsUserMaxDefault;
public int reactionsUserMaxPremium;
private ArrayList<ReadTask> readTasks;
private LongSparseArray<ReadTask> readTasksMap;
private Runnable recentEmojiStatusUpdateRunnable;
private long recentEmojiStatusUpdateRunnableTime;
private long recentEmojiStatusUpdateRunnableTimeout;
public int recommendedChannelsLimitDefault;
public int recommendedChannelsLimitPremium;
public boolean registeringForPush;
private LongSparseArray<ArrayList<Integer>> reloadingMessages;
private HashMap<String, ArrayList<MessageObject>> reloadingSavedWebpages;
private LongSparseArray<ArrayList<MessageObject>> reloadingSavedWebpagesPending;
private HashMap<String, ArrayList<MessageObject>> reloadingScheduledWebpages;
private LongSparseArray<ArrayList<MessageObject>> reloadingScheduledWebpagesPending;
private HashMap<String, ArrayList<MessageObject>> reloadingWebpages;
private LongSparseArray<ArrayList<MessageObject>> reloadingWebpagesPending;
public boolean remoteConfigLoaded;
public int remoteFoldersCount;
public boolean removeHiddenDialogFolder;
private ArrayList<ReadTask> repliesReadTasks;
private Runnable requestIsUserPremiumBlockedRunnable;
private boolean requestingContactToken;
private TLRPC.messages_Dialogs resetDialogsAll;
private TLRPC.TL_messages_peerDialogs resetDialogsPinned;
private boolean resetingDialogs;
public int revokeTimeLimit;
public int revokeTimePmLimit;
public int ringtoneDurationMax;
public int ringtoneSizeMax;
public int roundAudioBitrate;
public int roundVideoBitrate;
public int roundVideoSize;
public boolean saveGifsWithStickers;
public int savedDialogsPinnedLimitDefault;
public int savedDialogsPinnedLimitPremium;
public int savedGifsLimitDefault;
public int savedGifsLimitPremium;
public SavedMessagesController savedMessagesController;
public boolean savedViewAsChats;
public int secretWebpagePreview;
public DialogFilter[] selectedDialogFilter;
public DialogFilter[] selectedDialogFilterMore;
private SparseArray<ArrayList<TLRPC.Dialog>>[] selectedDialogFilterMoreFolder;
private LongSparseArray<SendAsPeersInfo> sendAsPeers;
public LongSparseArray<LongSparseArray<Boolean>>[] sendingTypings;
private SparseBooleanArray serverDialogsEndReached;
private LongSparseIntArray shortPollChannels;
private LongSparseIntArray shortPollOnlines;
public boolean showAnnualPerMonth;
public boolean showFiltersTooltip;
public int smallQueueMaxActiveOperations;
public boolean smsjobsStickyNotificationEnabled;
private DialogFilter sortingDialogFilter;
private LongSparseArray<SponsoredMessagesInfo> sponsoredMessages;
public boolean starsLocked;
private int statusRequest;
private int statusSettingState;
public int stealthModeCooldown;
public int stealthModeFuture;
public int stealthModePast;
public int stickersFavedLimitDefault;
public int stickersFavedLimitPremium;
public long storiesChangelogUserId;
public StoriesController storiesController;
public String storiesEntities;
public boolean storiesExportNopublicLink;
public int storiesPinnedToTopCountMax;
public String storiesPosting;
public int storiesSentMonthlyLimitDefault;
public int storiesSentMonthlyLimitPremium;
public int storiesSentWeeklyLimitDefault;
public int storiesSentWeeklyLimitPremium;
public int storiesSuggestedReactionsLimitDefault;
public int storiesSuggestedReactionsLimitPremium;
public int storyCaptionLengthLimitDefault;
public int storyCaptionLengthLimitPremium;
public int storyExpiringLimitDefault;
public int storyExpiringLimitPremium;
public boolean storyQualityFull;
public String storyVenueSearchBot;
public boolean suggestContacts;
public boolean suggestStickersApiOnly;
public ArrayList<TLRPC.TL_dialogFilterSuggested> suggestedFilters;
public String suggestedLangCode;
public int telegramAntispamGroupSizeMin;
public long telegramAntispamUserId;
private long tempId;
private Runnable themeCheckRunnable;
public int thisDc;
private HashMap<String, ReadTask> threadsReadTasksMap;
private TopicsController topicsController;
public int topicsPinnedLimit;
public int totalBlockedCount;
public int transcribeAudioTrialCooldownUntil;
public int transcribeAudioTrialCurrentNumber;
public int transcribeAudioTrialDurationMax;
public int transcribeAudioTrialWeeklyNumber;
public int transcribeButtonPressed;
private TranslateController translateController;
public UnconfirmedAuthController unconfirmedAuthController;
public int unreadUnmutedDialogs;
public int updateCheckDelay;
private Comparator<TLRPC$Update> updatesComparator;
private final LongSparseArray<ArrayList<TLRPC.Updates>> updatesQueueChannels;
private ArrayList<TLRPC.Updates> updatesQueuePts;
private ArrayList<TLRPC.Updates> updatesQueueQts;
private ArrayList<TLRPC.Updates> updatesQueueSeq;
private LongSparseLongArray updatesStartWaitTimeChannels;
private long updatesStartWaitTimePts;
private long updatesStartWaitTimeQts;
private long updatesStartWaitTimeSeq;
public boolean updatingState;
public boolean uploadMarkupVideo;
public int uploadMaxFileParts;
public int uploadMaxFilePartsPremium;
public float uploadPremiumSpeedupDownload;
public int uploadPremiumSpeedupNotifyPeriod;
public float uploadPremiumSpeedupUpload;
private String uploadingAvatar;
private HashMap<String, Object> uploadingThemes;
public String uploadingWallpaper;
public Theme.OverrideWallpaperInfo uploadingWallpaperInfo;
private UserNameResolver userNameResolver;
private ConcurrentHashMap<Long, TLRPC$User> users;
public String venueSearchBot;
private ArrayList<Long> visibleDialogMainThreadIds;
private ArrayList<Long> visibleScheduledDialogMainThreadIds;
public int webFileDatacenterId;
public String youtubePipType;
public static int UPDATE_MASK_ALL = (((((((((2 | 4) | 1) | 8) | 16) | 32) | 64) | ConnectionsManager.RequestFlagNeedQuickAck) | 256) | ConnectionsManager.RequestFlagDoNotWaitFloodWait) | 1048576;
public static int DIALOG_FILTER_FLAG_ALL_CHATS = (((1 | 2) | 4) | 8) | 16;
private static volatile MessagesController[] Instance = new MessagesController[UserConfig.MAX_ACCOUNT_COUNT];
private static final Object[] lockObjects = new Object[UserConfig.MAX_ACCOUNT_COUNT];
private void addDialogFolderToTabs(TLRPC.Dialog dialogFolder) {
}
public static void lambda$blockPeer$86(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$completeReadTask$232(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$completeReadTask$234(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$deleteParticipantFromChat$295(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$deleteParticipantFromChat$298(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$deleteUserPhoto$114(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$hidePeerSettingsBar$72(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$hidePromoDialog$129(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$installTheme$116(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$installTheme$117(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$logDeviceStats$31(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$markMentionMessageAsRead$228(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$markMentionsAsRead$236(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$markMessageContentAsRead$226(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$markReactionsAsRead$400(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$processUpdates$366(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$removeSuggestion$38(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$reportSpam$73(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$reportSpam$74(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$reportSpam$75(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$saveTheme$115(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public static void lambda$unregistedPush$305(TLObject tLObject, TLRPC.TL_error tL_error) {
}
public void markSponsoredAsRead(long dialog_id, MessageObject object) {
}
public static TLRPC.Peer getPeerFromInputPeer(TLRPC.InputPeer peer) {
if (peer.chat_id != 0) {
TLRPC.TL_peerChat tL_peerChat = new TLRPC.TL_peerChat();
((TLRPC.Peer) tL_peerChat).chat_id = peer.chat_id;
return tL_peerChat;
}
if (peer.channel_id != 0) {
TLRPC.TL_peerChannel tL_peerChannel = new TLRPC.TL_peerChannel();
((TLRPC.Peer) tL_peerChannel).channel_id = peer.channel_id;
return tL_peerChannel;
}
TLRPC.TL_peerUser tL_peerUser = new TLRPC.TL_peerUser();
((TLRPC.Peer) tL_peerUser).user_id = peer.user_id;
return tL_peerUser;
}
public ChannelBoostsController getBoostsController() {
ChannelBoostsController channelBoostsController = this.channelBoostsControler;
if (channelBoostsController != null) {
return channelBoostsController;
}
synchronized (lockObjects[this.currentAccount]) {
ChannelBoostsController channelBoostsController2 = this.channelBoostsControler;
if (channelBoostsController2 != null) {
return channelBoostsController2;
}
ChannelBoostsController channelBoostsController3 = new ChannelBoostsController(this.currentAccount);
this.channelBoostsControler = channelBoostsController3;
return channelBoostsController3;
}
}
public void lambda$new$0() {
getUserConfig().checkSavedPassword();
}
public ArrayList<DialogFilter> getDialogFilters() {
ArrayList<DialogFilter> arrayList = this.frozenDialogFilters;
return arrayList != null ? arrayList : this.dialogFilters;
}
public boolean starsPurchaseAvailable() {
return !this.starsLocked;
}
public boolean premiumFeaturesBlocked() {
return this.premiumLocked && !getUserConfig().isPremium();
}
public boolean premiumPurchaseBlocked() {
return this.premiumLocked;
}
public void getNextReactionMention(long dialogId, long topicId, int count, Consumer<Integer> callback) {
getMessagesStorage().getStorageQueue().postRunnable(new MessagesController$.ExternalSyntheticLambda122(this, topicId, dialogId, callback, count));
}
public void lambda$getNextReactionMention$5(long r13, long r15, androidx.core.util.Consumer r17, int r18) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$getNextReactionMention$5(long, long, androidx.core.util.Consumer, int):void");
}
public static void lambda$getNextReactionMention$1(Consumer consumer, int i) {
consumer.accept(Integer.valueOf(i));
}
public static void lambda$getNextReactionMention$4(Consumer consumer, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda289(tLObject, tL_error, consumer));
}
public static void lambda$getNextReactionMention$3(TLObject tLObject, TLRPC.TL_error tL_error, Consumer consumer) {
ArrayList arrayList;
TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject;
int i = 0;
if (tL_error != null && messages_messages != null && (arrayList = messages_messages.messages) != null && !arrayList.isEmpty()) {
i = ((TLRPC.Message) messages_messages.messages.get(0)).id;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda25(consumer, i));
}
public static void lambda$getNextReactionMention$2(Consumer consumer, int i) {
consumer.accept(Integer.valueOf(i));
}
public void updatePremium(boolean premium) {
if (this.dialogFilters.isEmpty()) {
return;
}
if (!premium) {
if (!this.dialogFilters.get(0).isDefault()) {
int i = 1;
while (true) {
if (i >= this.dialogFilters.size()) {
break;
}
if (this.dialogFilters.get(i).isDefault()) {
this.dialogFilters.add(0, this.dialogFilters.remove(i));
break;
}
i++;
}
}
lockFiltersInternal();
} else {
for (int i2 = 0; i2 < this.dialogFilters.size(); i2++) {
this.dialogFilters.get(i2).locked = false;
}
}
getMessagesStorage().saveDialogFiltersOrder();
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated, new Object[0]);
getStoriesController().onPremiumChanged();
}
public void lockFiltersInternal() {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lockFiltersInternal():void");
}
public int getCaptionMaxLengthLimit() {
return getUserConfig().isPremium() ? this.captionLengthLimitPremium : this.captionLengthLimitDefault;
}
public int getAboutLimit() {
return getUserConfig().isPremium() ? this.aboutLengthLimitPremium : this.aboutLengthLimitDefault;
}
public int getMaxUserReactionsCount() {
return getUserConfig().isPremium() ? this.reactionsUserMaxPremium : this.reactionsUserMaxDefault;
}
public int getChatReactionsCount() {
if (getUserConfig().isPremium()) {
return this.reactionsInChatMax;
}
return 1;
}
public int getChatMaxUniqReactions(long dialogId) {
TLRPC.ChatFull chatFull = getInstance(this.currentAccount).getChatFull(-dialogId);
if (chatFull != null && (!(chatFull instanceof TLRPC.TL_chatFull) ? (chatFull.flags2 & 8192) != 0 : (chatFull.flags & 1048576) != 0)) {
return chatFull.reactions_limit;
}
return this.reactionsUniqMax;
}
public boolean isPremiumUser(TLRPC$User currentUser) {
return !premiumFeaturesBlocked() && currentUser.premium;
}
public boolean didPressTranscribeButtonEnough() {
return this.transcribeButtonPressed >= 2;
}
public void pressTranscribeButton() {
int i = this.transcribeButtonPressed;
if (i < 2) {
this.transcribeButtonPressed = i + 1;
SharedPreferences sharedPreferences = this.mainPreferences;
if (sharedPreferences != null) {
sharedPreferences.edit().putInt("transcribeButtonPressed", this.transcribeButtonPressed).apply();
}
}
}
public ArrayList<TLRPC.TL_messages_stickerSet> filterPremiumStickers(ArrayList<TLRPC.TL_messages_stickerSet> stickerSets) {
if (!premiumFeaturesBlocked()) {
return stickerSets;
}
int i = 0;
while (i < stickerSets.size()) {
TLRPC.TL_messages_stickerSet filterPremiumStickers = getInstance(this.currentAccount).filterPremiumStickers(stickerSets.get(i));
if (filterPremiumStickers == null) {
stickerSets.remove(i);
i--;
} else {
stickerSets.set(i, filterPremiumStickers);
}
i++;
}
return stickerSets;
}
public TLRPC.TL_messages_stickerSet filterPremiumStickers(TLRPC.TL_messages_stickerSet stickerSet) {
boolean z;
if (!premiumFeaturesBlocked() || stickerSet == null) {
return stickerSet;
}
int i = 0;
int i2 = 0;
while (true) {
try {
if (i2 >= ((TLRPC.messages_StickerSet) stickerSet).documents.size()) {
z = false;
break;
}
if (MessageObject.isPremiumSticker((TLRPC$Document) ((TLRPC.messages_StickerSet) stickerSet).documents.get(i2))) {
z = true;
break;
}
i2++;
} catch (Exception e) {
e = e;
}
}
if (!z) {
return stickerSet;
}
NativeByteBuffer nativeByteBuffer = new NativeByteBuffer(stickerSet.getObjectSize());
stickerSet.serializeToStream(nativeByteBuffer);
nativeByteBuffer.position(0);
TLRPC.TL_messages_stickerSet tL_messages_stickerSet = new TLRPC.TL_messages_stickerSet();
nativeByteBuffer.readInt32(true);
tL_messages_stickerSet.readParams(nativeByteBuffer, true);
nativeByteBuffer.reuse();
while (i < ((TLRPC.messages_StickerSet) tL_messages_stickerSet).documents.size()) {
try {
if (MessageObject.isPremiumSticker((TLRPC$Document) ((TLRPC.messages_StickerSet) tL_messages_stickerSet).documents.get(i))) {
((TLRPC.messages_StickerSet) tL_messages_stickerSet).documents.remove(i);
((TLRPC.messages_StickerSet) tL_messages_stickerSet).packs.remove(i);
i--;
if (((TLRPC.messages_StickerSet) tL_messages_stickerSet).documents.isEmpty()) {
return null;
}
}
i++;
} catch (Exception e2) {
e = e2;
stickerSet = tL_messages_stickerSet;
e.printStackTrace();
return stickerSet;
}
}
return tL_messages_stickerSet;
}
public TopicsController getTopicsController() {
return this.topicsController;
}
public TranslateController getTranslateController() {
return this.translateController;
}
public boolean isForum(long dialogId) {
TLRPC.Chat chat = getChat(Long.valueOf(-dialogId));
return chat != null && chat.forum;
}
public boolean isForum(MessageObject msg) {
return msg != null && isForum(msg.getDialogId());
}
public boolean isForum(TLRPC.Message msg) {
return msg != null && isForum(MessageObject.getDialogId(msg));
}
public void markAllTopicsAsRead(long did) {
getMessagesStorage().loadTopics(did, new MessagesController$.ExternalSyntheticLambda308(this, did));
}
public void lambda$markAllTopicsAsRead$9(long j, ArrayList arrayList) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda164(this, arrayList, j));
}
public void lambda$markAllTopicsAsRead$8(ArrayList arrayList, long j) {
if (arrayList != null) {
for (int i = 0; i < arrayList.size(); i++) {
TLRPC.TL_forumTopic tL_forumTopic = (TLRPC.TL_forumTopic) arrayList.get(i);
MessagesController messagesController = getMessagesController();
int i2 = tL_forumTopic.top_message;
TLRPC.Message message = tL_forumTopic.topMessage;
messagesController.markDialogAsRead(j, i2, 0, message != null ? message.date : 0, false, tL_forumTopic.id, 0, true, 0);
getMessagesStorage().updateRepliesMaxReadId(-j, tL_forumTopic.id, tL_forumTopic.top_message, 0, true);
}
}
getMessagesStorage().getStorageQueue().postRunnable(new MessagesController$.ExternalSyntheticLambda55(this));
}
public void lambda$markAllTopicsAsRead$7() {
getMessagesStorage().resetAllUnreadCounters(false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda63(this));
}
public void lambda$markAllTopicsAsRead$6() {
getMessagesController().sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[]{Boolean.TRUE});
}
public String getFullName(long dialogId) {
if (dialogId > 0) {
TLRPC$User user = getUser(Long.valueOf(dialogId));
if (user != null) {
return ContactsController.formatName(user.first_name, user.last_name);
}
return null;
}
TLRPC.Chat chat = getChat(Long.valueOf(-dialogId));
if (chat != null) {
return chat.title;
}
return null;
}
public UserNameResolver getUserNameResolver() {
if (this.userNameResolver == null) {
this.userNameResolver = new UserNameResolver(this.currentAccount);
}
return this.userNameResolver;
}
public void clearQueryTime() {
this.lastServerQueryTime.clear();
this.lastScheduledServerQueryTime.clear();
this.lastQuickReplyServerQueryTime.clear();
this.lastSavedServerQueryTime.clear();
}
static {
for (int i = 0; i < UserConfig.MAX_ACCOUNT_COUNT; i++) {
lockObjects[i] = new Object();
}
}
public int lambda$new$10(TLRPC.Dialog dialog, TLRPC.Dialog dialog2) {
DialogFilter dialogFilter = this.sortingDialogFilter;
int i = dialogFilter == null ? Integer.MIN_VALUE : dialogFilter.pinnedDialogs.get(dialog.id, Integer.MIN_VALUE);
DialogFilter dialogFilter2 = this.sortingDialogFilter;
int i2 = dialogFilter2 == null ? Integer.MIN_VALUE : dialogFilter2.pinnedDialogs.get(dialog2.id, Integer.MIN_VALUE);
boolean z = dialog instanceof TLRPC.TL_dialogFolder;
if (z && !(dialog2 instanceof TLRPC.TL_dialogFolder)) {
return -1;
}
if (!z && (dialog2 instanceof TLRPC.TL_dialogFolder)) {
return 1;
}
if (i == Integer.MIN_VALUE && i2 != Integer.MIN_VALUE) {
return 1;
}
if (i != Integer.MIN_VALUE && i2 == Integer.MIN_VALUE) {
return -1;
}
if (i != Integer.MIN_VALUE) {
if (i > i2) {
return 1;
}
return i < i2 ? -1 : 0;
}
MediaDataController mediaDataController = getMediaDataController();
long lastMessageOrDraftDate = DialogObject.getLastMessageOrDraftDate(dialog, mediaDataController.getDraft(dialog.id, 0L));
long lastMessageOrDraftDate2 = DialogObject.getLastMessageOrDraftDate(dialog2, mediaDataController.getDraft(dialog2.id, 0L));
if (lastMessageOrDraftDate < lastMessageOrDraftDate2) {
return 1;
}
return lastMessageOrDraftDate > lastMessageOrDraftDate2 ? -1 : 0;
}
public void sortDialogsList(ArrayList<TLRPC.Dialog> dialogs) {
if (dialogs == null) {
return;
}
Collections.sort(dialogs, this.dialogComparator);
}
public int lambda$new$11(TLRPC.Dialog dialog, TLRPC.Dialog dialog2) {
boolean z = dialog instanceof TLRPC.TL_dialogFolder;
if (z && !(dialog2 instanceof TLRPC.TL_dialogFolder)) {
return -1;
}
if (!z && (dialog2 instanceof TLRPC.TL_dialogFolder)) {
return 1;
}
boolean z2 = dialog.pinned;
if (!z2 && dialog2.pinned) {
return 1;
}
if (z2 && !dialog2.pinned) {
return -1;
}
if (z2) {
int i = dialog.pinnedNum;
int i2 = dialog2.pinnedNum;
if (i < i2) {
return 1;
}
return i > i2 ? -1 : 0;
}
MediaDataController mediaDataController = getMediaDataController();
long lastMessageOrDraftDate = DialogObject.getLastMessageOrDraftDate(dialog, mediaDataController.getDraft(dialog.id, 0L));
long lastMessageOrDraftDate2 = DialogObject.getLastMessageOrDraftDate(dialog2, mediaDataController.getDraft(dialog2.id, 0L));
if (lastMessageOrDraftDate < lastMessageOrDraftDate2) {
return 1;
}
return lastMessageOrDraftDate > lastMessageOrDraftDate2 ? -1 : 0;
}
public int lambda$new$12(TLRPC$Update tLRPC$Update, TLRPC$Update tLRPC$Update2) {
int updateType = getUpdateType(tLRPC$Update);
int updateType2 = getUpdateType(tLRPC$Update2);
if (updateType != updateType2) {
return AndroidUtilities.compare(updateType, updateType2);
}
if (updateType == 0) {
return AndroidUtilities.compare(getUpdatePts(tLRPC$Update), getUpdatePts(tLRPC$Update2));
}
if (updateType == 1) {
return AndroidUtilities.compare(getUpdateQts(tLRPC$Update), getUpdateQts(tLRPC$Update2));
}
if (updateType != 2) {
return 0;
}
long updateChannelId = getUpdateChannelId(tLRPC$Update);
long updateChannelId2 = getUpdateChannelId(tLRPC$Update2);
if (updateChannelId == updateChannelId2) {
return AndroidUtilities.compare(getUpdatePts(tLRPC$Update), getUpdatePts(tLRPC$Update2));
}
return AndroidUtilities.compare(updateChannelId, updateChannelId2);
}
public static MessagesController getInstance(int num) {
MessagesController messagesController = Instance[num];
if (messagesController == null) {
synchronized (lockObjects[num]) {
messagesController = Instance[num];
if (messagesController == null) {
MessagesController[] messagesControllerArr = Instance;
MessagesController messagesController2 = new MessagesController(num);
messagesControllerArr[num] = messagesController2;
messagesController = messagesController2;
}
}
}
return messagesController;
}
public SharedPreferences getMainSettings() {
return this.mainPreferences;
}
public static SharedPreferences getNotificationsSettings(int account) {
return getInstance(account).notificationsPreferences;
}
public static SharedPreferences getGlobalNotificationsSettings() {
return getInstance(0).notificationsPreferences;
}
public static SharedPreferences getMainSettings(int account) {
return getInstance(account).mainPreferences;
}
public static SharedPreferences getGlobalMainSettings() {
return getInstance(0).mainPreferences;
}
public static SharedPreferences getEmojiSettings(int account) {
return getInstance(account).emojiPreferences;
}
public static SharedPreferences getGlobalEmojiSettings() {
return getInstance(0).emojiPreferences;
}
public ArrayList<TLRPC.Dialog> getSortedDialogs(ArrayList<TLRPC.Dialog> list) {
if (!list.isEmpty()) {
Collections.sort(list, this.dialogComparator);
}
return list;
}
public static SharedPreferences getMarkSettings(int account) {
return getInstance(account).markPreferences;
}
public static SharedPreferences getPlusSettings() {
return getInstance(0).plusPreferences;
}
public static SharedPreferences getGlobalPlusSettings() {
return getPlusSettings();
}
public int lambda$new$13(TLRPC.Dialog dialog, TLRPC.Dialog dialog2) {
boolean z = dialog instanceof TLRPC.TL_dialogFolder;
if (z && !(dialog2 instanceof TLRPC.TL_dialogFolder)) {
return -1;
}
if (!z && (dialog2 instanceof TLRPC.TL_dialogFolder)) {
return 1;
}
if (PlusSettings.pinnedFirst) {
int i = this.sortingDialogFilter.pinnedDialogs.get(dialog.id, Integer.MIN_VALUE);
int i2 = this.sortingDialogFilter.pinnedDialogs.get(dialog2.id, Integer.MIN_VALUE);
if (i == Integer.MIN_VALUE && i2 != Integer.MIN_VALUE) {
return 1;
}
if (i != Integer.MIN_VALUE && i2 == Integer.MIN_VALUE) {
return -1;
}
if (i != Integer.MIN_VALUE && i2 != Integer.MIN_VALUE) {
if (i > i2) {
return 1;
}
return i < i2 ? -1 : 0;
}
}
MediaDataController mediaDataController = getMediaDataController();
long lastMessageOrDraftDate = DialogObject.getLastMessageOrDraftDate(dialog, mediaDataController.getDraft(dialog.id, 0L));
long lastMessageOrDraftDate2 = DialogObject.getLastMessageOrDraftDate(dialog2, mediaDataController.getDraft(dialog2.id, 0L));
if (lastMessageOrDraftDate < lastMessageOrDraftDate2) {
return 1;
}
return lastMessageOrDraftDate > lastMessageOrDraftDate2 ? -1 : 0;
}
public void loadChatInfo(final int chat_id, CountDownLatch countDownLatch, boolean force) {
getMessagesStorage().loadChatInfo(chat_id, false, countDownLatch, force, false);
}
public int lambda$new$14(TLRPC.Dialog dialog, TLRPC.Dialog dialog2) {
boolean z = dialog instanceof TLRPC.TL_dialogFolder;
if (z && !(dialog2 instanceof TLRPC.TL_dialogFolder)) {
return -1;
}
if (!z && (dialog2 instanceof TLRPC.TL_dialogFolder)) {
return 1;
}
if (PlusSettings.pinnedFirst) {
if (this.isFilter) {
int i = this.sortingDialogFilter.pinnedDialogs.get(dialog.id, Integer.MIN_VALUE);
int i2 = this.sortingDialogFilter.pinnedDialogs.get(dialog2.id, Integer.MIN_VALUE);
if (i == Integer.MIN_VALUE && i2 != Integer.MIN_VALUE) {
return 1;
}
if (i != Integer.MIN_VALUE && i2 == Integer.MIN_VALUE) {
return -1;
}
if (i != Integer.MIN_VALUE && i2 != Integer.MIN_VALUE) {
if (i > i2) {
return 1;
}
return i < i2 ? -1 : 0;
}
} else {
boolean z2 = dialog.pinned;
if (!z2 && dialog2.pinned) {
return 1;
}
if (z2 && !dialog2.pinned) {
return -1;
}
if (z2 && dialog2.pinned) {
int i3 = dialog.pinnedNum;
int i4 = dialog2.pinnedNum;
if (i3 < i4) {
return 1;
}
return i3 > i4 ? -1 : 0;
}
}
}
int i5 = dialog.unread_count;
int i6 = dialog2.unread_count;
if (i5 == i6) {
return 0;
}
return i5 < i6 ? 1 : -1;
}
public MessagesController(int num) {
super(num);
this.chats = new ConcurrentHashMap<>(100, 1.0f, 2);
this.encryptedChats = new ConcurrentHashMap<>(10, 1.0f, 2);
this.users = new ConcurrentHashMap<>(100, 1.0f, 3);
this.objectsByUsernames = new ConcurrentHashMap<>(100, 1.0f, 2);
this.activeVoiceChatsMap = new HashMap<>();
this.joiningToChannels = new ArrayList<>();
this.exportedChats = new LongSparseArray<>();
this.hintDialogs = new ArrayList<>();
this.dialogsByFolder = new SparseArray<>();
this.allDialogs = new ArrayList<>();
this.dialogsForward = new ArrayList<>();
this.dialogsServerOnly = new ArrayList<>();
this.dialogsCanAddUsers = new ArrayList<>();
this.dialogsMyChannels = new ArrayList<>();
this.dialogsMyGroups = new ArrayList<>();
this.dialogsChannelsOnly = new ArrayList<>();
this.dialogsUsersOnly = new ArrayList<>();
this.dialogsForBlock = new ArrayList<>();
this.dialogsGroupsOnly = new ArrayList<>();
this.selectedDialogFilter = new DialogFilter[2];
this.dialogsLoadedTillDate = ConnectionsManager.DEFAULT_DATACENTER_ID;
this.hiddenDialogs = new ArrayList<>();
this.favsDialogs = new ArrayList<>();
this.dialogsUsersByFolder = new SparseArray<>();
this.dialogsGroupsByFolder = new SparseArray<>();
this.dialogsGroupsAllByFolder = new SparseArray<>();
this.dialogsMegaGroupsByFolder = new SparseArray<>();
this.dialogsChannelsByFolder = new SparseArray<>();
this.dialogsBotsByFolder = new SparseArray<>();
this.dialogsFavsByFolder = new SparseArray<>();
this.dialogsAdminByFolder = new SparseArray<>();
this.dialogsUnreadByFolder = new SparseArray<>();
this.dialogsHiddenByFolder = new SparseArray<>();
this.dialogsSecrets = new ArrayList<>();
this.dialogsOwnGroups = new ArrayList<>();
this.dialogsOwnSuperGroups = new ArrayList<>();
this.dialogsOwnChannels = new ArrayList<>();
this.dialogsAdminGroups = new ArrayList<>();
this.dialogsAdminSuperGroups = new ArrayList<>();
this.dialogsAdminChannels = new ArrayList<>();
this.dialogsBackup = new ArrayList<>();
this.dialogsTopicsGroups = new ArrayList<>();
this.pinnedDialogs_dict = new LongSparseArray<>();
this.dialogs_read_inbox_max = new ConcurrentHashMap<>(100, 1.0f, 2);
this.dialogs_read_outbox_max = new ConcurrentHashMap<>(100, 1.0f, 2);
this.dialogs_dict = new LongSparseArray<>();
this.dialogMessage = new LongSparseArray<>();
this.dialogMessageFromUnblocked = new LongSparseArray<>();
this.dialogMessagesByRandomIds = new LongSparseArray<>();
this.deletedHistory = new LongSparseIntArray();
this.dialogMessagesByIds = new SparseArray<>();
this.printingUsers = new ConcurrentHashMap<>(20, 1.0f, 2);
this.printingStrings = new LongSparseArray<>();
this.printingStringsTypes = new LongSparseArray<>();
this.sendingTypings = new LongSparseArray[12];
this.onlinePrivacy = new ConcurrentHashMap<>(20, 1.0f, 2);
this.pendingUnreadCounter = new LongSparseIntArray();
this.chatlistFoldersUpdates = new SparseArray<>();
this.largeQueueMaxActiveOperations = 2;
this.smallQueueMaxActiveOperations = 5;
this.storiesChangelogUserId = 777000L;
this.giveawayAddPeersMax = 10L;
this.giveawayPeriodMax = 7L;
this.giveawayCountriesMax = 10L;
this.giveawayBoostsPerPremium = 4L;
this.boostsPerSentGift = 3L;
this.loadingPeerSettings = new LongSparseArray<>();
this.createdDialogIds = new ArrayList<>();
this.createdScheduledDialogIds = new ArrayList<>();
this.createdDialogMainThreadIds = new ArrayList<>();
this.visibleDialogMainThreadIds = new ArrayList<>();
this.visibleScheduledDialogMainThreadIds = new ArrayList<>();
this.shortPollChannels = new LongSparseIntArray();
this.needShortPollChannels = new LongSparseArray<>();
this.shortPollOnlines = new LongSparseIntArray();
this.needShortPollOnlines = new LongSparseArray<>();
this.deletingDialogs = new LongSparseArray<>();
this.clearingHistoryDialogs = new LongSparseArray<>();
this.loadingBlockedPeers = false;
this.blockePeers = new LongSparseIntArray();
this.totalBlockedCount = -1;
this.channelViewsToSend = new LongSparseArray<>();
this.pollsToCheck = new LongSparseArray<>();
this.premiumFeaturesTypesToPosition = new SparseIntArray();
this.businessFeaturesTypesToPosition = new SparseIntArray();
this.dialogFilters = new ArrayList<>();
this.frozenDialogFilters = null;
this.hiddenUndoChats = new ArrayList<>();
this.dialogFiltersById = new SparseArray<>();
this.dialogFiltersByType = new SparseArray<>();
this.suggestedFilters = new ArrayList<>();
this.updatesQueueChannels = new LongSparseArray<>();
this.updatesStartWaitTimeChannels = new LongSparseLongArray();
this.channelsPts = new LongSparseIntArray();
this.gettingDifferenceChannels = new LongSparseArray<>();
this.gettingChatInviters = new LongSparseArray<>();
this.gettingUnknownChannels = new LongSparseArray<>();
this.gettingUnknownDialogs = new LongSparseArray<>();
this.checkingLastMessagesDialogs = new LongSparseArray<>();
this.updatesQueueSeq = new ArrayList<>();
this.updatesQueuePts = new ArrayList<>();
this.updatesQueueQts = new ArrayList<>();
this.fullUsers = new LongSparseArray<>();
this.fullChats = new LongSparseArray<>();
this.groupCalls = new LongSparseArray<>();
this.groupCallsByChatId = new LongSparseArray<>();
this.loadingFullUsers = new HashSet<>();
this.loadedFullUsers = new LongSparseLongArray();
this.loadingFullChats = new HashSet<>();
this.loadingGroupCalls = new HashSet<>();
this.loadingFullParticipants = new HashSet<>();
this.loadedFullParticipants = new HashSet<>();
this.loadedFullChats = new LongSparseLongArray();
this.channelAdmins = new LongSparseArray<>();
this.loadingChannelAdmins = new LongSparseIntArray();
this.migratedChats = new SparseIntArray();
this.sponsoredMessages = new LongSparseArray<>();
this.sendAsPeers = new LongSparseArray<>();
this.reloadingWebpages = new HashMap<>();
this.reloadingWebpagesPending = new LongSparseArray<>();
this.reloadingScheduledWebpages = new HashMap<>();
this.reloadingScheduledWebpagesPending = new LongSparseArray<>();
this.reloadingSavedWebpages = new HashMap<>();
this.reloadingSavedWebpagesPending = new LongSparseArray<>();
this.lastScheduledServerQueryTime = new LongSparseArray<>();
this.lastQuickReplyServerQueryTime = new LongSparseArray<>();
this.lastSavedServerQueryTime = new LongSparseArray<>();
this.lastServerQueryTime = new LongSparseArray<>();
this.reloadingMessages = new LongSparseArray<>();
this.readTasks = new ArrayList<>();
this.readTasksMap = new LongSparseArray<>();
this.repliesReadTasks = new ArrayList<>();
this.threadsReadTasksMap = new HashMap<>();
this.nextDialogsCacheOffset = new SparseIntArray();
this.loadingDialogs = new SparseBooleanArray();
this.dialogsEndReached = new SparseBooleanArray();
this.serverDialogsEndReached = new SparseBooleanArray();
this.getDifferenceFirstSync = true;
this.loadingPinnedDialogs = new SparseIntArray();
this.faqSearchArray = new ArrayList<>();
this.suggestContacts = true;
this.themeCheckRunnable = MessagesController$.ExternalSyntheticLambda292.INSTANCE;
this.passwordCheckRunnable = new MessagesController$.ExternalSyntheticLambda36(this);
this.uploadingThemes = new HashMap<>();
this.appConfigFetcher = new 1(this);
this.maxBroadcastCount = 100;
this.minGroupConvertSize = 200;
this.gifSearchEmojies = new ArrayList<>();
this.diceSuccess = new HashMap<>();
this.emojiSounds = new HashMap<>();
this.emojiInteractions = new HashMap<>();
this.showAnnualPerMonth = false;
this.selectedDialogFilterMore = new DialogFilter[2];
this.filtersHasArchive = false;
this.plusPromoChannelDeleted = 0L;
this.plusPromoChannelArchived = 0L;
this.removeHiddenDialogFolder = false;
this.selectedDialogFilterMoreFolder = new SparseArray[2];
this.directPaymentsCurrency = new ArrayList();
this.emojiStatusUntilValues = new LongSparseArray<>();
this.photoSuggestion = new SparseArray<>();
this.dialogDateComparator = new MessagesController$.ExternalSyntheticLambda293(this);
this.dialogComparator = new MessagesController$.ExternalSyntheticLambda295(this);
this.updatesComparator = new MessagesController$.ExternalSyntheticLambda299(this);
this.dialogDateComparator2 = new MessagesController$.ExternalSyntheticLambda294(this);
this.isFilter = false;
this.dialogComparatorUnread = new MessagesController$.ExternalSyntheticLambda296(this);
this.dialogComparatorUnmuted = new 2(this);
this.dialogComparatorUnreadUnmuted = new 3(this);
this.dialogComparatorUsersByStatus = new 4(this);
this.loadAppConfigRunnable = new MessagesController$.ExternalSyntheticLambda31(this);
this.notifyTranscriptionAudioCooldownUpdate = new MessagesController$.ExternalSyntheticLambda39(this);
this.peerDialogsRequested = new LongSparseArray<>();
this.peerDialogRequestTimeout = 240000L;
this.dialogPhotos = new LongSparseArray<>();
this.DIALOGS_LOAD_TYPE_CACHE = 1;
this.DIALOGS_LOAD_TYPE_CHANNEL = 2;
this.DIALOGS_LOAD_TYPE_UNKNOWN = 3;
this.cachedIsUserPremiumBlocked = new LongSparseArray<>();
this.loadingIsUserPremiumBlocked = new HashSet<>();
this.requestIsUserPremiumBlockedRunnable = new MessagesController$.ExternalSyntheticLambda61(this);
this.effectsFetcher = new 11(this);
ImageLoader.getInstance();
getMessagesStorage();
getLocationController();
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda65(this));
addSupportUser();
if (this.currentAccount == 0) {
this.notificationsPreferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", 0);
this.mainPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
this.emojiPreferences = ApplicationLoader.applicationContext.getSharedPreferences("emoji", 0);
this.markPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mark", 0);
} else {
this.notificationsPreferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications" + this.currentAccount, 0);
this.mainPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig" + this.currentAccount, 0);
this.emojiPreferences = ApplicationLoader.applicationContext.getSharedPreferences("emoji" + this.currentAccount, 0);
this.markPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mark" + this.currentAccount, 0);
}
System.currentTimeMillis();
this.remoteConfigLoaded = this.mainPreferences.getBoolean("remoteConfigLoaded", false);
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("plusconfig", 0);
this.plusPreferences = sharedPreferences;
this.hideLeftGroup = sharedPreferences.getBoolean("hideLeftGroup", false);
this.hideJoinedGroup = this.plusPreferences.getBoolean("hideJoinedGroup", false);
this.increasePinnedDialogsLimit = this.plusPreferences.getBoolean("increasePinnedDialogsLimit", true);
this.secretWebpagePreview = this.mainPreferences.getInt("secretWebpage2", 2);
this.maxGroupCount = this.mainPreferences.getInt("maxGroupCount", 200);
this.maxMegagroupCount = this.mainPreferences.getInt("maxMegagroupCount", 10000);
this.maxRecentGifsCount = this.mainPreferences.getInt("maxRecentGifsCount", 200);
this.maxRecentStickersCount = this.mainPreferences.getInt("maxRecentStickersCount", 30);
this.maxFaveStickersCount = ConnectionsManager.DEFAULT_DATACENTER_ID;
this.maxEditTime = this.mainPreferences.getInt("maxEditTime", 3600);
this.ratingDecay = this.mainPreferences.getInt("ratingDecay", 2419200);
this.linkPrefix = this.mainPreferences.getString("linkPrefix", "t.me");
this.callReceiveTimeout = this.mainPreferences.getInt("callReceiveTimeout", 20000);
this.callRingTimeout = this.mainPreferences.getInt("callRingTimeout", 90000);
this.callConnectTimeout = this.mainPreferences.getInt("callConnectTimeout", 30000);
this.callPacketTimeout = this.mainPreferences.getInt("callPacketTimeout", 10000);
this.updateCheckDelay = this.mainPreferences.getInt("updateCheckDelay", 86400);
this.maxFolderPinnedDialogsCountDefault = this.mainPreferences.getInt("maxFolderPinnedDialogsCountDefault", 100);
this.maxFolderPinnedDialogsCountPremium = this.mainPreferences.getInt("maxFolderPinnedDialogsCountPremium", 100);
if (this.maxFolderPinnedDialogsCountDefault < 100 && this.increasePinnedDialogsLimit) {
this.maxFolderPinnedDialogsCountDefault = 100;
}
this.maxMessageLength = this.mainPreferences.getInt("maxMessageLength", 4096);
this.maxCaptionLength = this.mainPreferences.getInt("maxCaptionLength", ConnectionsManager.RequestFlagDoNotWaitFloodWait);
this.mapProvider = this.mainPreferences.getInt("mapProvider", 0);
this.availableMapProviders = this.mainPreferences.getInt("availableMapProviders", 3);
this.mapKey = this.mainPreferences.getString("pk", null);
this.installReferer = this.mainPreferences.getString("installReferer", null);
this.revokeTimeLimit = this.mainPreferences.getInt("revokeTimeLimit", ConnectionsManager.DEFAULT_DATACENTER_ID);
this.revokeTimePmLimit = this.mainPreferences.getInt("revokeTimePmLimit", ConnectionsManager.DEFAULT_DATACENTER_ID);
this.canRevokePmInbox = this.mainPreferences.getBoolean("canRevokePmInbox", this.canRevokePmInbox);
this.preloadFeaturedStickers = this.mainPreferences.getBoolean("preloadFeaturedStickers", false);
this.youtubePipType = BuildVars.BETA_2 ? "inapp" : this.mainPreferences.getString("youtubePipType", "disabled");
this.keepAliveService = this.mainPreferences.getBoolean("keepAliveService", true);
this.backgroundConnection = this.mainPreferences.getBoolean("keepAliveService", true);
this.promoDialogId = this.plusPreferences.getBoolean("hideProxySponsor", false) ? 0L : this.mainPreferences.getLong("proxy_dialog", 0L);
this.nextPromoInfoCheckTime = this.mainPreferences.getInt("nextPromoInfoCheckTime", 0);
this.promoDialogType = this.mainPreferences.getInt("promo_dialog_type", 0);
this.promoPsaMessage = this.mainPreferences.getString("promo_psa_message", null);
this.promoPsaType = this.mainPreferences.getString("promo_psa_type", null);
this.proxyDialogAddress = this.mainPreferences.getString("proxyDialogAddress", null);
this.venueSearchBot = this.mainPreferences.getString("venueSearchBot", "foursquare");
this.storyVenueSearchBot = this.mainPreferences.getString("storyVenueSearchBot", "foursquare");
this.gifSearchBot = this.mainPreferences.getString("gifSearchBot", "gif");
this.imageSearchBot = this.mainPreferences.getString("imageSearchBot", "pic");
this.blockedCountry = this.mainPreferences.getBoolean("blockedCountry", false);
this.suggestedLangCode = this.mainPreferences.getString("suggestedLangCode", "en");
this.animatedEmojisZoom = this.mainPreferences.getFloat("animatedEmojisZoom", 0.625f);
this.qrLoginCamera = true;
this.saveGifsWithStickers = this.mainPreferences.getBoolean("saveGifsWithStickers", false);
this.filtersEnabled = this.mainPreferences.getBoolean("filtersEnabled", false);
this.getfileExperimentalParams = this.mainPreferences.getBoolean("getfileExperimentalParams", false);
this.smsjobsStickyNotificationEnabled = this.mainPreferences.getBoolean("smsjobsStickyNotificationEnabled", false);
this.showFiltersTooltip = this.mainPreferences.getBoolean("showFiltersTooltip", false);
this.autoarchiveAvailable = this.mainPreferences.getBoolean("autoarchiveAvailable", false);
this.groupCallVideoMaxParticipants = this.mainPreferences.getInt("groipCallVideoMaxParticipants", 30);
this.chatReadMarkSizeThreshold = this.mainPreferences.getInt("chatReadMarkSizeThreshold", 100);
if (this.chatReadMarkExpirePeriod < 100) {
this.chatReadMarkSizeThreshold = 100;
}
this.chatReadMarkExpirePeriod = this.mainPreferences.getInt("chatReadMarkExpirePeriod", 604800);
this.ringtoneDurationMax = this.mainPreferences.getInt("ringtoneDurationMax", 5);
this.ringtoneSizeMax = this.mainPreferences.getInt("ringtoneSizeMax", 102400);
this.pmReadDateExpirePeriod = this.mainPreferences.getInt("pmReadDateExpirePeriod", 604800);
this.suggestStickersApiOnly = this.mainPreferences.getBoolean("suggestStickersApiOnly", false);
this.roundVideoSize = this.mainPreferences.getInt("roundVideoSize", 384);
this.roundVideoBitrate = this.mainPreferences.getInt("roundVideoBitrate", 1000);
this.roundAudioBitrate = this.mainPreferences.getInt("roundAudioBitrate", 64);
this.pendingSuggestions = this.mainPreferences.getStringSet("pendingSuggestions", null);
this.dismissedSuggestions = this.mainPreferences.getStringSet("dismissedSuggestions", null);
int i = this.mainPreferences.getInt("channelsLimitDefault", 500);
this.channelsLimitDefault = i;
this.channelsLimitPremium = this.mainPreferences.getInt("channelsLimitPremium", i * 2);
this.savedGifsLimitDefault = this.mainPreferences.getInt("savedGifsLimitDefault", 200);
this.savedGifsLimitPremium = this.mainPreferences.getInt("savedGifsLimitPremium", 400);
this.stickersFavedLimitDefault = this.mainPreferences.getInt("stickersFavedLimitDefault", 5);
this.stickersFavedLimitPremium = this.mainPreferences.getInt("stickersFavedLimitPremium", 200);
this.maxPinnedDialogsCountDefault = this.mainPreferences.getInt("maxPinnedDialogsCountDefault", 5);
this.maxPinnedDialogsCountPremium = this.mainPreferences.getInt("maxPinnedDialogsCountPremium", 5);
if (this.maxPinnedDialogsCountDefault < 100 && this.increasePinnedDialogsLimit) {
this.maxPinnedDialogsCountDefault = 100;
}
this.dialogFiltersLimitDefault = this.mainPreferences.getInt("dialogFiltersLimitDefault", 10);
this.dialogFiltersLimitPremium = this.mainPreferences.getInt("dialogFiltersLimitPremium", 20);
this.dialogFiltersChatsLimitDefault = this.mainPreferences.getInt("dialogFiltersChatsLimitDefault", 100);
this.dialogFiltersChatsLimitPremium = this.mainPreferences.getInt("dialogFiltersChatsLimitPremium", 200);
this.dialogFiltersPinnedLimitDefault = this.mainPreferences.getInt("dialogFiltersPinnedLimitDefault", 5);
this.dialogFiltersPinnedLimitPremium = this.mainPreferences.getInt("dialogFiltersPinnedLimitPremium", 10);
this.plusPromoChannelDeleted = this.mainPreferences.getLong("plusPromoChannelDeleted", 0L);
this.plusPromoChannelArchived = this.mainPreferences.getLong("plusPromoChannelArchived", 0L);
if (this.increasePinnedDialogsLimit) {
this.maxPinnedDialogsCountDefault = Math.max(100, this.maxPinnedDialogsCountDefault);
this.dialogFiltersPinnedLimitDefault = Math.max(100, this.dialogFiltersPinnedLimitDefault);
this.dialogFiltersPinnedLimitPremium = Math.max(100, this.dialogFiltersPinnedLimitPremium);
}
this.publicLinksLimitDefault = this.mainPreferences.getInt("publicLinksLimitDefault", 10);
this.publicLinksLimitPremium = this.mainPreferences.getInt("publicLinksLimitPremium", 20);
this.captionLengthLimitDefault = this.mainPreferences.getInt("captionLengthLimitDefault", ConnectionsManager.RequestFlagDoNotWaitFloodWait);
this.captionLengthLimitPremium = this.mainPreferences.getInt("captionLengthLimitPremium", 4096);
this.storyCaptionLengthLimitDefault = this.mainPreferences.getInt("storyCaptionLengthLimit", 200);
this.storyCaptionLengthLimitPremium = this.mainPreferences.getInt("storyCaptionLengthLimitPremium", ConnectionsManager.RequestFlagListenAfterCancel);
this.aboutLengthLimitDefault = this.mainPreferences.getInt("aboutLengthLimitDefault", 70);
this.aboutLengthLimitPremium = this.mainPreferences.getInt("aboutLengthLimitPremium", 140);
this.reactionsUserMaxDefault = this.mainPreferences.getInt("reactionsUserMaxDefault", 1);
this.reactionsUserMaxPremium = this.mainPreferences.getInt("reactionsUserMaxPremium", 3);
this.reactionsInChatMax = this.mainPreferences.getInt("reactionsInChatMax", 3);
int i2 = this.mainPreferences.getInt("uploadMaxFileParts", 4000);
this.uploadMaxFileParts = i2;
this.uploadMaxFilePartsPremium = this.mainPreferences.getInt("uploadMaxFilePartsPremium", i2 * 2);
this.premiumInvoiceSlug = this.mainPreferences.getString("premiumInvoiceSlug", null);
this.premiumBotUsername = this.mainPreferences.getString("premiumBotUsername", null);
this.premiumLocked = this.mainPreferences.getBoolean("premiumLocked", false);
this.starsLocked = this.mainPreferences.getBoolean("starsLocked", true);
this.transcribeButtonPressed = this.mainPreferences.getInt("transcribeButtonPressed", 0);
this.forumUpgradeParticipantsMin = this.mainPreferences.getInt("forumUpgradeParticipantsMin", 200);
this.topicsPinnedLimit = this.mainPreferences.getInt("topicsPinnedLimit", 3);
this.telegramAntispamUserId = this.mainPreferences.getLong("telegramAntispamUserId", -1L);
this.telegramAntispamGroupSizeMin = this.mainPreferences.getInt("telegramAntispamGroupSizeMin", 100);
this.hiddenMembersGroupSizeMin = this.mainPreferences.getInt("hiddenMembersGroupSizeMin", 100);
this.chatlistUpdatePeriod = this.mainPreferences.getInt("chatlistUpdatePeriod", 3600);
this.uploadMarkupVideo = this.mainPreferences.getBoolean("uploadMarkupVideo", true);
this.giftAttachMenuIcon = this.mainPreferences.getBoolean("giftAttachMenuIcon", false);
this.giftTextFieldIcon = this.mainPreferences.getBoolean("giftTextFieldIcon", false);
this.checkResetLangpack = this.mainPreferences.getInt("checkResetLangpack", 0);
this.smallQueueMaxActiveOperations = this.mainPreferences.getInt("smallQueueMaxActiveOperations", 5);
this.largeQueueMaxActiveOperations = this.mainPreferences.getInt("largeQueueMaxActiveOperations", 2);
this.stealthModeFuture = this.mainPreferences.getInt("stories_stealth_future_period", 1500);
this.storiesChangelogUserId = this.mainPreferences.getLong("stories_changelog_user_id", 777000L);
this.giveawayAddPeersMax = this.mainPreferences.getLong("giveaway_add_peers_max", 10L);
this.giveawayCountriesMax = this.mainPreferences.getLong("giveaway_countries_max", 10L);
this.giveawayBoostsPerPremium = this.mainPreferences.getLong("giveaway_boosts_per_premium", 4L);
this.boostsPerSentGift = this.mainPreferences.getLong("boosts_per_sent_gift", 3L);
this.giveawayPeriodMax = this.mainPreferences.getLong("giveaway_period_max", 7L);
this.stealthModePast = this.mainPreferences.getInt("stories_stealth_past_period", 300);
this.stealthModeCooldown = this.mainPreferences.getInt("stories_stealth_cooldown_period", 3600);
boolean z = ConnectionsManager.native_isTestBackend(this.currentAccount) != 0;
this.chatlistInvitesLimitDefault = this.mainPreferences.getInt("chatlistInvitesLimitDefault", 3);
this.storyExpiringLimitDefault = this.mainPreferences.getInt("storyExpiringLimitDefault", 50);
this.storyExpiringLimitPremium = this.mainPreferences.getInt("storyExpiringLimitPremium", 100);
this.storiesSentWeeklyLimitDefault = this.mainPreferences.getInt("storiesSentWeeklyLimitDefault", 7);
this.storiesSuggestedReactionsLimitDefault = this.mainPreferences.getInt("storiesSuggestedReactionsLimitDefault", 1);
this.storiesSuggestedReactionsLimitPremium = this.mainPreferences.getInt("storiesSuggestedReactionsLimitPremium", 5);
this.storiesSentWeeklyLimitPremium = this.mainPreferences.getInt("storiesSentWeeklyLimitPremium", 70);
this.storiesSentMonthlyLimitDefault = this.mainPreferences.getInt("storiesSentMonthlyLimitDefault", 30);
this.storiesSentMonthlyLimitPremium = this.mainPreferences.getInt("storiesSentMonthlyLimitPremium", 300);
this.channelBgIconLevelMin = this.mainPreferences.getInt("channelBgIconLevelMin", 1);
this.channelProfileIconLevelMin = this.mainPreferences.getInt("channelProfileIconLevelMin", 1);
this.channelEmojiStatusLevelMin = this.mainPreferences.getInt("channelEmojiStatusLevelMin", 1);
this.groupProfileBgIconLevelMin = this.mainPreferences.getInt("groupProfileBgIconLevelMin", 1);
this.groupEmojiStatusLevelMin = this.mainPreferences.getInt("groupEmojiStatusLevelMin", 1);
this.groupEmojiStickersLevelMin = this.mainPreferences.getInt("groupEmojiStickersLevelMin", 1);
this.groupWallpaperLevelMin = this.mainPreferences.getInt("groupWallpaperLevelMin", 1);
this.groupCustomWallpaperLevelMin = this.mainPreferences.getInt("groupCustomWallpaperLevelMin", 1);
this.groupTranscribeLevelMin = this.mainPreferences.getInt("groupTranscribeLevelMin", 1);
this.quickRepliesLimit = this.mainPreferences.getInt("quickRepliesLimit", 10);
this.quickReplyMessagesLimit = this.mainPreferences.getInt("quickReplyMessagesLimit", 20);
this.channelWallpaperLevelMin = this.mainPreferences.getInt("channelWallpaperLevelMin", 1);
this.channelCustomWallpaperLevelMin = this.mainPreferences.getInt("channelCustomWallpaperLevelMin", 1);
this.chatlistInvitesLimitPremium = this.mainPreferences.getInt("chatlistInvitesLimitPremium", z ? 5 : 20);
this.chatlistJoinedLimitDefault = this.mainPreferences.getInt("chatlistJoinedLimitDefault", 2);
this.chatlistJoinedLimitPremium = this.mainPreferences.getInt("chatlistJoinedLimitPremium", z ? 5 : 20);
this.storiesPosting = this.mainPreferences.getString("storiesPosting", "enabled");
this.storiesEntities = this.mainPreferences.getString("storiesEntities", "premium");
this.storiesExportNopublicLink = this.mainPreferences.getBoolean("storiesExportNopublicLink", false);
this.authorizationAutoconfirmPeriod = this.mainPreferences.getInt("authorization_autoconfirm_period", 604800);
this.quoteLengthMax = this.mainPreferences.getInt("quoteLengthMax", ConnectionsManager.RequestFlagDoNotWaitFloodWait);
this.giveawayGiftsPurchaseAvailable = this.mainPreferences.getBoolean("giveawayGiftsPurchaseAvailable", false);
this.peerColors = PeerColors.fromString(0, this.mainPreferences.getString("peerColors", ""));
this.profilePeerColors = PeerColors.fromString(1, this.mainPreferences.getString("profilePeerColors", ""));
int i3 = this.mainPreferences.getInt("transcribeAudioTrialWeeklyNumber", BuildVars.DEBUG_PRIVATE_VERSION ? 2 : 0);
this.transcribeAudioTrialWeeklyNumber = i3;
this.transcribeAudioTrialCurrentNumber = this.mainPreferences.getInt("transcribeAudioTrialCurrentNumber", i3);
this.transcribeAudioTrialDurationMax = this.mainPreferences.getInt("transcribeAudioTrialDurationMax", 300);
this.transcribeAudioTrialCooldownUntil = this.mainPreferences.getInt("transcribeAudioTrialCooldownUntil", 0);
this.recommendedChannelsLimitDefault = this.mainPreferences.getInt("recommendedChannelsLimitDefault", 10);
this.recommendedChannelsLimitPremium = this.mainPreferences.getInt("recommendedChannelsLimitPremium", 100);
this.boostsChannelLevelMax = this.mainPreferences.getInt("boostsChannelLevelMax", 100);
this.channelRestrictSponsoredLevelMin = this.mainPreferences.getInt("channelRestrictSponsoredLevelMin", 30);
this.savedDialogsPinnedLimitDefault = this.mainPreferences.getInt("savedDialogsPinnedLimitDefault", 4);
this.savedDialogsPinnedLimitPremium = this.mainPreferences.getInt("savedDialogsPinnedLimitPremium", 6);
this.storyQualityFull = this.mainPreferences.getBoolean("storyQualityFull", true);
this.savedViewAsChats = this.mainPreferences.getBoolean("savedViewAsChats", false);
this.folderTags = this.mainPreferences.getBoolean("folderTags", false);
this.uploadPremiumSpeedupUpload = this.mainPreferences.getFloat("uploadPremiumSpeedupUpload", 10.0f);
this.uploadPremiumSpeedupDownload = this.mainPreferences.getFloat("uploadPremiumSpeedupDownload", 10.0f);
this.uploadPremiumSpeedupNotifyPeriod = this.mainPreferences.getInt("uploadPremiumSpeedupNotifyPeriod2", 3600);
this.introTitleLengthLimit = this.mainPreferences.getInt("introTitleLengthLimit", 32);
this.introDescriptionLengthLimit = this.mainPreferences.getInt("introDescriptionLengthLimit", 72);
this.businessChatLinksLimit = this.mainPreferences.getInt("businessChatLinksLimit", 100);
this.channelRevenueWithdrawalEnabled = this.mainPreferences.getBoolean("channelRevenueWithdrawalEnabled", false);
this.newNoncontactPeersRequirePremiumWithoutOwnpremium = this.mainPreferences.getBoolean("newNoncontactPeersRequirePremiumWithoutOwnpremium", false);
this.reactionsUniqMax = this.mainPreferences.getInt("reactionsUniqMax", 11);
this.premiumManageSubscriptionUrl = this.mainPreferences.getString("premiumManageSubscriptionUrl", ApplicationLoader.isStandaloneBuild() ? "https://t.me/premiumbot?start=status" : "https://play.google.com/store/account/subscriptions?sku=telegram_premium&package=org.telegram.messenger");
this.androidDisableRoundCamera2 = this.mainPreferences.getBoolean("androidDisableRoundCamera2", false);
this.storiesPinnedToTopCountMax = this.mainPreferences.getInt("storiesPinnedToTopCountMax", 3);
this.showAnnualPerMonth = this.mainPreferences.getBoolean("showAnnualPerMonth", false);
this.canEditFactcheck = this.mainPreferences.getBoolean("canEditFactcheck", false);
this.factcheckLengthLimit = this.mainPreferences.getInt("factcheckLengthLimit", ConnectionsManager.RequestFlagDoNotWaitFloodWait);
scheduleTranscriptionUpdate();
BuildVars.GOOGLE_AUTH_CLIENT_ID = this.mainPreferences.getString("googleAuthClientId", BuildVars.GOOGLE_AUTH_CLIENT_ID);
if (this.mainPreferences.contains("dcDomainName2")) {
this.dcDomainName = this.mainPreferences.getString("dcDomainName2", "apv3.stel.com");
} else {
this.dcDomainName = z ? "tapv3.stel.com" : "apv3.stel.com";
}
if (this.mainPreferences.contains("webFileDatacenterId")) {
this.webFileDatacenterId = this.mainPreferences.getInt("webFileDatacenterId", 4);
} else {
this.webFileDatacenterId = z ? 2 : 4;
}
Set<String> stringSet = this.mainPreferences.getStringSet("directPaymentsCurrency", null);
if (stringSet != null) {
this.directPaymentsCurrency.clear();
this.directPaymentsCurrency.addAll(stringSet);
}
loadPremiumFeaturesPreviewOrder(this.premiumFeaturesTypesToPosition, this.mainPreferences.getString("premiumFeaturesTypesToPosition", null));
loadPremiumFeaturesPreviewOrder(this.businessFeaturesTypesToPosition, this.mainPreferences.getString("businessFeaturesTypesToPosition", null));
if (this.pendingSuggestions != null) {
this.pendingSuggestions = new HashSet(this.pendingSuggestions);
} else {
this.pendingSuggestions = new HashSet();
}
if (this.dismissedSuggestions != null) {
this.dismissedSuggestions = new HashSet(this.dismissedSuggestions);
} else {
this.dismissedSuggestions = new HashSet();
}
Set<String> stringSet2 = this.mainPreferences.getStringSet("exportUri2", null);
this.exportUri = stringSet2;
if (stringSet2 != null) {
this.exportUri = new HashSet(this.exportUri);
} else {
HashSet hashSet = new HashSet();
this.exportUri = hashSet;
hashSet.add("content://(\\d+@)?com\\.whatsapp\\.provider\\.media/export_chat/");
this.exportUri.add("content://(\\d+@)?com\\.whatsapp\\.w4b\\.provider\\.media/export_chat/");
this.exportUri.add("content://jp\\.naver\\.line\\.android\\.line\\.common\\.FileProvider/export-chat/");
this.exportUri.add(".*WhatsApp.*\\.txt$");
}
Set<String> stringSet3 = this.mainPreferences.getStringSet("exportGroupUri", null);
this.exportGroupUri = stringSet3;
if (stringSet3 != null) {
this.exportGroupUri = new HashSet(this.exportGroupUri);
} else {
HashSet hashSet2 = new HashSet();
this.exportGroupUri = hashSet2;
hashSet2.add("@g.us/");
}
Set<String> stringSet4 = this.mainPreferences.getStringSet("exportPrivateUri", null);
this.exportPrivateUri = stringSet4;
if (stringSet4 != null) {
this.exportPrivateUri = new HashSet(this.exportPrivateUri);
} else {
HashSet hashSet3 = new HashSet();
this.exportPrivateUri = hashSet3;
hashSet3.add("@s.whatsapp.net/");
}
Set<String> stringSet5 = this.mainPreferences.getStringSet("autologinDomains", null);
this.autologinDomains = stringSet5;
if (stringSet5 != null) {
this.autologinDomains = new HashSet(this.autologinDomains);
} else {
this.autologinDomains = new HashSet();
}
Set<String> stringSet6 = this.mainPreferences.getStringSet("authDomains", null);
this.authDomains = stringSet6;
if (stringSet6 != null) {
this.authDomains = new HashSet(this.authDomains);
} else {
this.authDomains = new HashSet();
}
this.autologinToken = this.mainPreferences.getString("autologinToken", null);
Set<String> stringSet7 = this.mainPreferences.getStringSet("diceEmojies", null);
if (stringSet7 == null) {
HashSet<String> hashSet4 = new HashSet<>();
this.diceEmojies = hashSet4;
hashSet4.add("🎲");
this.diceEmojies.add("🎯");
} else {
this.diceEmojies = new HashSet<>(stringSet7);
}
String string = this.mainPreferences.getString("diceSuccess", null);
if (string == null) {
this.diceSuccess.put("🎯", new DiceFrameSuccess(62, 6));
} else {
try {
byte[] decode = Base64.decode(string, 0);
if (decode != null) {
SerializedData serializedData = new SerializedData(decode);
int readInt32 = serializedData.readInt32(true);
for (int i4 = 0; i4 < readInt32; i4++) {
this.diceSuccess.put(serializedData.readString(true), new DiceFrameSuccess(serializedData.readInt32(true), serializedData.readInt32(true)));
}
serializedData.cleanup();
}
} catch (Exception e) {
FileLog.e(e);
}
}
String string2 = this.mainPreferences.getString("emojiSounds", null);
if (string2 != null) {
try {
byte[] decode2 = Base64.decode(string2, 0);
if (decode2 != null) {
SerializedData serializedData2 = new SerializedData(decode2);
int readInt322 = serializedData2.readInt32(true);
for (int i5 = 0; i5 < readInt322; i5++) {
this.emojiSounds.put(serializedData2.readString(true), new EmojiSound(serializedData2.readInt64(true), serializedData2.readInt64(true), serializedData2.readByteArray(true)));
}
serializedData2.cleanup();
}
} catch (Exception e2) {
FileLog.e(e2);
}
}
String string3 = this.mainPreferences.getString("gifSearchEmojies", null);
if (string3 == null) {
this.gifSearchEmojies.add("👍");
this.gifSearchEmojies.add("👎");
this.gifSearchEmojies.add("😍");
this.gifSearchEmojies.add("😂");
this.gifSearchEmojies.add("😮");
this.gifSearchEmojies.add("🙄");
this.gifSearchEmojies.add("😥");
this.gifSearchEmojies.add("😡");
this.gifSearchEmojies.add("🥳");
this.gifSearchEmojies.add("😎");
} else {
try {
byte[] decode3 = Base64.decode(string3, 0);
if (decode3 != null) {
SerializedData serializedData3 = new SerializedData(decode3);
int readInt323 = serializedData3.readInt32(true);
for (int i6 = 0; i6 < readInt323; i6++) {
this.gifSearchEmojies.add(serializedData3.readString(true));
}
serializedData3.cleanup();
}
} catch (Exception e3) {
FileLog.e(e3);
}
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda31(this), 2000L);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda51(this), 400L);
this.topicsController = new TopicsController(num);
this.cacheByChatsController = new CacheByChatsController(num);
this.translateController = new TranslateController(this);
Utilities.globalQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda32(this));
}
public void lambda$new$15() {
MessagesController messagesController = getMessagesController();
getNotificationCenter().addObserver(messagesController, NotificationCenter.fileUploaded);
getNotificationCenter().addObserver(messagesController, NotificationCenter.fileUploadFailed);
getNotificationCenter().addObserver(messagesController, NotificationCenter.fileUploadProgressChanged);
getNotificationCenter().addObserver(messagesController, NotificationCenter.fileLoaded);
getNotificationCenter().addObserver(messagesController, NotificationCenter.fileLoadFailed);
getNotificationCenter().addObserver(messagesController, NotificationCenter.messageReceivedByServer);
getNotificationCenter().addObserver(messagesController, NotificationCenter.updateMessageMedia);
}
public void lambda$new$16() {
checkPeerColors(false);
}
public void lambda$new$17() {
this.enableJoined = this.notificationsPreferences.getBoolean("EnableContactJoined", true);
this.nextTosCheckTime = this.notificationsPreferences.getInt("nextTosCheckTime", 0);
}
private void sendLoadPeersRequest(TLObject req, ArrayList<TLObject> requests, TLRPC.messages_Dialogs pinnedDialogs, TLRPC.messages_Dialogs pinnedRemoteDialogs, ArrayList<TLRPC$User> users, ArrayList<TLRPC.Chat> chats, ArrayList<DialogFilter> filtersToSave, SparseArray<DialogFilter> filtersToDelete, ArrayList<Integer> filtersOrder, HashMap<Integer, HashSet<Long>> filterDialogRemovals, HashSet<Integer> filtersUnreadCounterReset, Runnable onDone) {
getConnectionsManager().sendRequest(req, new MessagesController$.ExternalSyntheticLambda424(this, chats, users, pinnedDialogs, pinnedRemoteDialogs, requests, req, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset, onDone));
}
public void lambda$sendLoadPeersRequest$18(ArrayList arrayList, ArrayList arrayList2, TLRPC.messages_Dialogs messages_dialogs, TLRPC.messages_Dialogs messages_dialogs2, ArrayList arrayList3, TLObject tLObject, ArrayList arrayList4, SparseArray sparseArray, ArrayList arrayList5, HashMap hashMap, HashSet hashSet, Runnable runnable, TLObject tLObject2, TLRPC.TL_error tL_error) {
if (tLObject2 instanceof TLRPC.TL_messages_chats) {
arrayList.addAll(((TLRPC.messages_Chats) ((TLRPC.TL_messages_chats) tLObject2)).chats);
} else if (tLObject2 instanceof TLRPC.Vector) {
TLRPC.Vector vector = (TLRPC.Vector) tLObject2;
int size = vector.objects.size();
for (int i = 0; i < size; i++) {
arrayList2.add((TLRPC$User) vector.objects.get(i));
}
} else if (tLObject2 instanceof TLRPC.TL_messages_peerDialogs) {
TLRPC.TL_messages_peerDialogs tL_messages_peerDialogs = (TLRPC.TL_messages_peerDialogs) tLObject2;
messages_dialogs.dialogs.addAll(tL_messages_peerDialogs.dialogs);
messages_dialogs.messages.addAll(tL_messages_peerDialogs.messages);
messages_dialogs2.dialogs.addAll(tL_messages_peerDialogs.dialogs);
messages_dialogs2.messages.addAll(tL_messages_peerDialogs.messages);
arrayList2.addAll(tL_messages_peerDialogs.users);
arrayList.addAll(tL_messages_peerDialogs.chats);
}
arrayList3.remove(tLObject);
if (arrayList3.isEmpty()) {
getMessagesStorage().processLoadedFilterPeers(messages_dialogs, messages_dialogs2, arrayList2, arrayList, arrayList4, sparseArray, arrayList5, hashMap, hashSet, runnable);
}
}
public void loadFilterPeers(HashMap<Long, TLRPC.InputPeer> dialogsToLoadMap, HashMap<Long, TLRPC.InputPeer> usersToLoadMap, HashMap<Long, TLRPC.InputPeer> chatsToLoadMap, TLRPC.messages_Dialogs pinnedDialogs, TLRPC.messages_Dialogs pinnedRemoteDialogs, ArrayList<TLRPC$User> users, ArrayList<TLRPC.Chat> chats, ArrayList<DialogFilter> filtersToSave, SparseArray<DialogFilter> filtersToDelete, ArrayList<Integer> filtersOrder, HashMap<Integer, HashSet<Long>> filterDialogRemovals, HashSet<Integer> filtersUnreadCounterReset, Runnable onDone) {
if (this.busyLoading) {
return;
}
this.busyLoading = true;
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda176(this, usersToLoadMap, pinnedDialogs, pinnedRemoteDialogs, users, chats, filtersToSave, filtersToDelete, filtersOrder, filterDialogRemovals, filtersUnreadCounterReset, onDone, chatsToLoadMap, dialogsToLoadMap));
}
public void lambda$loadFilterPeers$19(HashMap hashMap, TLRPC.messages_Dialogs messages_dialogs, TLRPC.messages_Dialogs messages_dialogs2, ArrayList arrayList, ArrayList arrayList2, ArrayList arrayList3, SparseArray sparseArray, ArrayList arrayList4, HashMap hashMap2, HashSet hashSet, Runnable runnable, HashMap hashMap3, HashMap hashMap4) {
TLRPC.TL_users_getUsers tL_users_getUsers;
int i;
TLRPC.TL_messages_getPeerDialogs tL_messages_getPeerDialogs;
TLRPC.TL_messages_getChats tL_messages_getChats;
TLRPC.TL_channels_getChannels tL_channels_getChannels;
ArrayList<TLObject> arrayList5 = new ArrayList<>();
loop0: while (true) {
tL_users_getUsers = null;
for (Map.Entry entry : hashMap.entrySet()) {
if (tL_users_getUsers == null) {
tL_users_getUsers = new TLRPC.TL_users_getUsers();
arrayList5.add(tL_users_getUsers);
}
tL_users_getUsers.id.add(getInputUser((TLRPC.InputPeer) entry.getValue()));
if (tL_users_getUsers.id.size() == 100) {
break;
}
}
sendLoadPeersRequest(tL_users_getUsers, arrayList5, messages_dialogs, messages_dialogs2, arrayList, arrayList2, arrayList3, sparseArray, arrayList4, hashMap2, hashSet, runnable);
}
if (tL_users_getUsers != null) {
i = 100;
sendLoadPeersRequest(tL_users_getUsers, arrayList5, messages_dialogs, messages_dialogs2, arrayList, arrayList2, arrayList3, sparseArray, arrayList4, hashMap2, hashSet, runnable);
} else {
i = 100;
}
TLRPC.TL_messages_getChats tL_messages_getChats2 = null;
TLRPC.TL_channels_getChannels tL_channels_getChannels2 = null;
for (Map.Entry entry2 : hashMap3.entrySet()) {
TLRPC.InputPeer inputPeer = (TLRPC.InputPeer) entry2.getValue();
if (inputPeer.chat_id != 0) {
if (tL_messages_getChats2 == null) {
tL_messages_getChats = new TLRPC.TL_messages_getChats();
arrayList5.add(tL_messages_getChats);
} else {
tL_messages_getChats = tL_messages_getChats2;
}
tL_messages_getChats.id.add((Long) entry2.getKey());
if (tL_messages_getChats.id.size() == i) {
sendLoadPeersRequest(tL_messages_getChats, arrayList5, messages_dialogs, messages_dialogs2, arrayList, arrayList2, arrayList3, sparseArray, arrayList4, hashMap2, hashSet, runnable);
tL_messages_getChats2 = null;
} else {
tL_messages_getChats2 = tL_messages_getChats;
}
} else if (inputPeer.channel_id != 0) {
if (tL_channels_getChannels2 == null) {
TLRPC.TL_channels_getChannels tL_channels_getChannels3 = new TLRPC.TL_channels_getChannels();
arrayList5.add(tL_channels_getChannels3);
tL_channels_getChannels = tL_channels_getChannels3;
} else {
tL_channels_getChannels = tL_channels_getChannels2;
}
tL_channels_getChannels.id.add(getInputChannel(inputPeer));
if (tL_channels_getChannels.id.size() == i) {
sendLoadPeersRequest(tL_channels_getChannels, arrayList5, messages_dialogs, messages_dialogs2, arrayList, arrayList2, arrayList3, sparseArray, arrayList4, hashMap2, hashSet, runnable);
tL_channels_getChannels2 = null;
} else {
tL_channels_getChannels2 = tL_channels_getChannels;
}
}
}
if (tL_messages_getChats2 != null) {
sendLoadPeersRequest(tL_messages_getChats2, arrayList5, messages_dialogs, messages_dialogs2, arrayList, arrayList2, arrayList3, sparseArray, arrayList4, hashMap2, hashSet, runnable);
}
if (tL_channels_getChannels2 != null) {
sendLoadPeersRequest(tL_channels_getChannels2, arrayList5, messages_dialogs, messages_dialogs2, arrayList, arrayList2, arrayList3, sparseArray, arrayList4, hashMap2, hashSet, runnable);
}
if (UserConfig.getInstance(this.currentAccount).getCurrentUser() == null || !UserConfig.getInstance(this.currentAccount).getCurrentUser().bot) {
loop3: while (true) {
tL_messages_getPeerDialogs = null;
for (Map.Entry entry3 : hashMap4.entrySet()) {
if (tL_messages_getPeerDialogs == null) {
tL_messages_getPeerDialogs = new TLRPC.TL_messages_getPeerDialogs();
arrayList5.add(tL_messages_getPeerDialogs);
}
TLRPC.TL_inputDialogPeer tL_inputDialogPeer = new TLRPC.TL_inputDialogPeer();
tL_inputDialogPeer.peer = (TLRPC.InputPeer) entry3.getValue();
tL_messages_getPeerDialogs.peers.add(tL_inputDialogPeer);
if (tL_messages_getPeerDialogs.peers.size() == i) {
break;
}
}
sendLoadPeersRequest(tL_messages_getPeerDialogs, arrayList5, messages_dialogs, messages_dialogs2, arrayList, arrayList2, arrayList3, sparseArray, arrayList4, hashMap2, hashSet, runnable);
}
if (tL_messages_getPeerDialogs != null) {
sendLoadPeersRequest(tL_messages_getPeerDialogs, arrayList5, messages_dialogs, messages_dialogs2, arrayList, arrayList2, arrayList3, sparseArray, arrayList4, hashMap2, hashSet, runnable);
}
}
}
public void processLoadedDialogFilters(ArrayList<DialogFilter> filters, TLRPC.messages_Dialogs pinnedDialogs, TLRPC.messages_Dialogs pinnedRemoteDialogs, ArrayList<TLRPC$User> users, ArrayList<TLRPC.Chat> chats, ArrayList<TLRPC.EncryptedChat> encryptedChats, int remote, Runnable onDone) {
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda260(this, pinnedDialogs, encryptedChats, pinnedRemoteDialogs, remote, filters, users, chats, onDone));
}
public void lambda$processLoadedDialogFilters$22(org.telegram.tgnet.TLRPC.messages_Dialogs r20, java.util.ArrayList r21, org.telegram.tgnet.TLRPC.messages_Dialogs r22, int r23, java.util.ArrayList r24, java.util.ArrayList r25, java.util.ArrayList r26, java.lang.Runnable r27) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$processLoadedDialogFilters$22(org.telegram.tgnet.TLRPC$messages_Dialogs, java.util.ArrayList, org.telegram.tgnet.TLRPC$messages_Dialogs, int, java.util.ArrayList, java.util.ArrayList, java.util.ArrayList, java.lang.Runnable):void");
}
public void lambda$processLoadedDialogFilters$21(int i, ArrayList arrayList, ArrayList arrayList2, ArrayList arrayList3, TLRPC.messages_Dialogs messages_dialogs, ArrayList arrayList4, LongSparseArray longSparseArray, LongSparseArray longSparseArray2, Runnable runnable) {
int i2;
boolean z;
long j;
if (i != 2) {
this.dialogFilters = arrayList;
this.dialogFiltersById.clear();
this.dialogFiltersByType.clear();
this.remoteFoldersCount = 0;
int size = this.dialogFilters.size();
for (int i3 = 0; i3 < size; i3++) {
DialogFilter dialogFilter = this.dialogFilters.get(i3);
if (!dialogFilter.local) {
PlusUtils.fixLocalFiltersIssue(dialogFilter);
}
this.dialogFiltersById.put(dialogFilter.id, dialogFilter);
this.dialogFiltersByType.put(dialogFilter.type, dialogFilter);
if (!dialogFilter.local) {
this.remoteFoldersCount++;
}
}
Collections.sort(this.dialogFilters, MessagesController$.ExternalSyntheticLambda303.INSTANCE);
putUsers(arrayList2, true);
putChats(arrayList3, true);
this.dialogFiltersLoaded = true;
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated, new Object[0]);
if (i == 0) {
loadRemoteFilters(false);
}
if (messages_dialogs != null && !messages_dialogs.dialogs.isEmpty()) {
applyDialogsNotificationsSettings(messages_dialogs.dialogs);
}
if (arrayList4 != null) {
for (int i4 = 0; i4 < arrayList4.size(); i4++) {
TLRPC.EncryptedChat encryptedChat = (TLRPC.EncryptedChat) arrayList4.get(i4);
if ((encryptedChat instanceof TLRPC.TL_encryptedChat) && AndroidUtilities.getMyLayerVersion(encryptedChat.layer) < SecretChatHelper.CURRENT_SECRET_CHAT_LAYER) {
getSecretChatHelper().sendNotifyLayerMessage(encryptedChat, (TLRPC.Message) null);
}
putEncryptedChat(encryptedChat, true);
}
}
for (int i5 = 0; i5 < longSparseArray.size(); i5++) {
long keyAt = longSparseArray.keyAt(i5);
TLRPC.Dialog dialog = (TLRPC.Dialog) longSparseArray.valueAt(i5);
TLRPC.Dialog dialog2 = this.dialogs_dict.get(keyAt);
if (messages_dialogs != null && messages_dialogs.dialogs.contains(dialog)) {
if (dialog.draft instanceof TLRPC.TL_draftMessage) {
getMediaDataController().saveDraft(dialog.id, 0L, dialog.draft, (TLRPC.Message) null, false);
}
if (dialog2 != null) {
dialog2.notify_settings = dialog.notify_settings;
}
}
ArrayList<MessageObject> arrayList5 = (ArrayList) longSparseArray2.get(dialog.id);
long j2 = 0;
if (dialog2 == null) {
this.dialogs_dict.put(keyAt, dialog);
this.dialogMessage.put(keyAt, arrayList5);
if (arrayList5 != null) {
for (int i6 = 0; i6 < arrayList5.size(); i6++) {
MessageObject messageObject = arrayList5.get(i6);
if (messageObject != null && messageObject.messageOwner.peer_id.channel_id == 0) {
this.dialogMessagesByIds.put(messageObject.getId(), messageObject);
long j3 = messageObject.messageOwner.random_id;
if (j3 != 0) {
this.dialogMessagesByRandomIds.put(j3, messageObject);
}
}
}
}
getTranslateController().checkDialogMessage(keyAt);
} else {
dialog2.pinned = dialog.pinned;
dialog2.pinnedNum = dialog.pinnedNum;
ArrayList<MessageObject> arrayList6 = this.dialogMessage.get(keyAt);
for (int i7 = 0; arrayList6 != null && i7 < arrayList6.size(); i7++) {
if (arrayList6.get(i7) != null && arrayList6.get(i7).deleted) {
z = true;
break;
}
}
z = false;
if (z || arrayList6 == null || dialog2.top_message > 0) {
if (dialog.top_message < dialog2.top_message) {
if ((arrayList6 == null) == (arrayList5 == null)) {
if (arrayList6 != null) {
if (arrayList5 != null) {
if (arrayList6.size() == arrayList5.size()) {
}
}
}
}
}
this.dialogs_dict.put(keyAt, dialog);
this.dialogMessage.put(keyAt, arrayList5);
if (arrayList6 != null) {
for (int i8 = 0; i8 < arrayList6.size(); i8++) {
MessageObject messageObject2 = arrayList6.get(i8);
if (messageObject2 != null) {
if (messageObject2.messageOwner.peer_id.channel_id == 0) {
this.dialogMessagesByIds.remove(messageObject2.getId());
}
long j4 = messageObject2.messageOwner.random_id;
if (j4 != 0) {
this.dialogMessagesByRandomIds.remove(j4);
}
}
}
}
if (arrayList5 != null) {
for (int i9 = 0; i9 < arrayList5.size(); i9++) {
MessageObject messageObject3 = arrayList5.get(i9);
if (messageObject3 != null && messageObject3.messageOwner.peer_id.channel_id == j2) {
int i10 = 0;
while (true) {
if (arrayList6 == null || i10 >= arrayList6.size()) {
break;
}
MessageObject messageObject4 = arrayList6.get(i10);
if (messageObject4 != null && messageObject4.getId() == messageObject3.getId()) {
messageObject3.deleted = messageObject4.deleted;
break;
}
i10++;
}
this.dialogMessagesByIds.put(messageObject3.getId(), messageObject3);
long j5 = messageObject3.messageOwner.random_id;
j2 = 0;
if (j5 != 0) {
this.dialogMessagesByRandomIds.put(j5, messageObject3);
}
}
}
}
getTranslateController().checkDialogMessage(keyAt);
} else {
this.dialogs_dict.put(keyAt, dialog);
this.dialogMessage.put(keyAt, arrayList5);
int i11 = 0;
while (i11 < arrayList6.size()) {
MessageObject messageObject5 = arrayList6.get(i11);
if (messageObject5 == null) {
j = keyAt;
} else {
j = keyAt;
if (messageObject5.messageOwner.peer_id.channel_id == 0) {
this.dialogMessagesByIds.remove(messageObject5.getId());
}
long j6 = messageObject5.messageOwner.random_id;
if (j6 != 0) {
this.dialogMessagesByRandomIds.remove(j6);
}
}
i11++;
keyAt = j;
}
long j7 = keyAt;
if (arrayList5 != null) {
for (int i12 = 0; i12 < arrayList5.size(); i12++) {
MessageObject messageObject6 = arrayList5.get(i12);
if (messageObject6 != null && messageObject6.messageOwner.peer_id.channel_id == 0) {
int i13 = 0;
while (true) {
if (i13 >= arrayList6.size()) {
break;
}
MessageObject messageObject7 = arrayList6.get(i13);
if (messageObject7 != null && messageObject7.getId() == messageObject6.getId()) {
messageObject6.deleted = messageObject7.deleted;
break;
}
i13++;
}
this.dialogMessagesByIds.put(messageObject6.getId(), messageObject6);
long j8 = messageObject6.messageOwner.random_id;
if (j8 != 0) {
this.dialogMessagesByRandomIds.put(j8, messageObject6);
}
}
}
}
getTranslateController().checkDialogMessage(j7);
}
}
}
this.allDialogs.clear();
int size2 = this.dialogs_dict.size();
for (int i14 = 0; i14 < size2; i14++) {
TLRPC.Dialog valueAt = this.dialogs_dict.valueAt(i14);
if (this.deletingDialogs.indexOfKey(valueAt.id) < 0) {
this.allDialogs.add(valueAt);
}
}
sortDialogs(null);
i2 = 0;
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
} else {
i2 = 0;
}
if (i != 0) {
getUserConfig().filtersLoaded = true;
getUserConfig().saveConfig(i2);
this.loadingRemoteFilters = i2;
getNotificationCenter().postNotificationName(NotificationCenter.filterSettingsUpdated, new Object[i2]);
}
lockFiltersInternal();
if (runnable != null) {
runnable.run();
}
}
public static int lambda$processLoadedDialogFilters$20(DialogFilter dialogFilter, DialogFilter dialogFilter2) {
int i = dialogFilter.order;
int i2 = dialogFilter2.order;
if (i > i2) {
return 1;
}
return i < i2 ? -1 : 0;
}
public void sortDialogsFilterOrder() {
Collections.sort(this.dialogFilters, MessagesController$.ExternalSyntheticLambda304.INSTANCE);
}
public static int lambda$sortDialogsFilterOrder$23(DialogFilter dialogFilter, DialogFilter dialogFilter2) {
int i = dialogFilter.order;
int i2 = dialogFilter2.order;
if (i > i2) {
return 1;
}
return i < i2 ? -1 : 0;
}
public DialogFilter getFavsFilter() {
DialogFilter dialogFilter = this.dialogFiltersByType.get(26);
if (dialogFilter == null) {
int size = this.dialogFilters.size();
for (int i = 0; i < size; i++) {
DialogFilter dialogFilter2 = this.dialogFilters.get(i);
if (dialogFilter2.type == 26) {
return dialogFilter2;
}
String str = dialogFilter2.name;
if (str == null) {
str = "";
}
int i2 = R.string.Favorites;
if (str.equals(LocaleController.getString("Favorites", i2)) || str.equals(LocaleController.getEnglishString(i2))) {
return dialogFilter2;
}
}
}
return dialogFilter;
}
public void loadSuggestedFilters() {
if (this.loadingSuggestedFilters) {
return;
}
this.loadingSuggestedFilters = true;
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
getConnectionsManager().sendRequest(new TLRPC.TL_messages_getSuggestedDialogFilters(), new MessagesController$.ExternalSyntheticLambda338(this));
}
}
public void lambda$loadSuggestedFilters$25(TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda191(this, tLObject));
}
public void lambda$loadSuggestedFilters$24(TLObject tLObject) {
TLRPC.DialogFilter dialogFilter;
this.loadingSuggestedFilters = false;
this.suggestedFilters.clear();
if (tLObject instanceof TLRPC.Vector) {
TLRPC.Vector vector = (TLRPC.Vector) tLObject;
int size = vector.objects.size();
for (int i = 0; i < size; i++) {
try {
TLRPC.TL_dialogFilterSuggested tL_dialogFilterSuggested = (TLRPC.TL_dialogFilterSuggested) vector.objects.get(i);
if (tL_dialogFilterSuggested != null && (dialogFilter = tL_dialogFilterSuggested.filter) != null) {
dialogFilter.exclude_archived = true;
if (!dialogFilter.title.equals(LocaleController.getString("FilterPersonal", R.string.FilterPersonal))) {
tL_dialogFilterSuggested.filter.title.equals(LocaleController.getString("FilterUnread", R.string.FilterUnread));
}
}
} catch (Exception e) {
e.printStackTrace();
}
this.suggestedFilters.add((TLRPC.TL_dialogFilterSuggested) vector.objects.get(i));
}
}
if (this.dialogFiltersByType.get(20) == null) {
TLRPC.TL_dialogFilterSuggested tL_dialogFilterSuggested2 = new TLRPC.TL_dialogFilterSuggested();
TLRPC.TL_dialogFilter tL_dialogFilter = new TLRPC.TL_dialogFilter();
tL_dialogFilterSuggested2.filter = tL_dialogFilter;
((TLRPC.DialogFilter) tL_dialogFilter).title = LocaleController.getString("Users", R.string.Users);
tL_dialogFilterSuggested2.description = LocaleController.getString("LocalFolder", R.string.LocalFolder);
TLRPC.DialogFilter dialogFilter2 = tL_dialogFilterSuggested2.filter;
dialogFilter2.contacts = true;
dialogFilter2.non_contacts = true;
dialogFilter2.exclude_archived = true;
dialogFilter2.id = 20;
this.suggestedFilters.add(tL_dialogFilterSuggested2);
}
if (this.dialogFiltersByType.get(23) == null) {
TLRPC.TL_dialogFilterSuggested tL_dialogFilterSuggested3 = new TLRPC.TL_dialogFilterSuggested();
TLRPC.TL_dialogFilter tL_dialogFilter2 = new TLRPC.TL_dialogFilter();
tL_dialogFilterSuggested3.filter = tL_dialogFilter2;
((TLRPC.DialogFilter) tL_dialogFilter2).title = LocaleController.getString("FilterGroups", R.string.FilterGroups);
tL_dialogFilterSuggested3.description = LocaleController.getString("LocalFolder", R.string.LocalFolder) + ": " + LocaleController.getString("Groups", R.string.Groups) + ", " + LocaleController.getString("SuperGroups", R.string.SuperGroups);
TLRPC.DialogFilter dialogFilter3 = tL_dialogFilterSuggested3.filter;
dialogFilter3.groups = true;
dialogFilter3.exclude_archived = true;
dialogFilter3.id = 23;
this.suggestedFilters.add(tL_dialogFilterSuggested3);
}
if (this.dialogFiltersByType.get(21) == null) {
TLRPC.TL_dialogFilterSuggested tL_dialogFilterSuggested4 = new TLRPC.TL_dialogFilterSuggested();
TLRPC.TL_dialogFilter tL_dialogFilter3 = new TLRPC.TL_dialogFilter();
tL_dialogFilterSuggested4.filter = tL_dialogFilter3;
((TLRPC.DialogFilter) tL_dialogFilter3).title = LocaleController.getString("FilterGroups", R.string.FilterGroups);
tL_dialogFilterSuggested4.description = LocaleController.getString("LocalFolder", R.string.LocalFolder) + ": " + LocaleController.getString("Groups", R.string.Groups);
TLRPC.DialogFilter dialogFilter4 = tL_dialogFilterSuggested4.filter;
dialogFilter4.groups = true;
dialogFilter4.exclude_archived = true;
dialogFilter4.id = 21;
this.suggestedFilters.add(tL_dialogFilterSuggested4);
}
if (this.dialogFiltersByType.get(22) == null) {
TLRPC.TL_dialogFilterSuggested tL_dialogFilterSuggested5 = new TLRPC.TL_dialogFilterSuggested();
TLRPC.TL_dialogFilter tL_dialogFilter4 = new TLRPC.TL_dialogFilter();
tL_dialogFilterSuggested5.filter = tL_dialogFilter4;
((TLRPC.DialogFilter) tL_dialogFilter4).title = LocaleController.getString("SuperGroups", R.string.SuperGroups);
tL_dialogFilterSuggested5.description = LocaleController.getString("LocalFolder", R.string.LocalFolder);
TLRPC.DialogFilter dialogFilter5 = tL_dialogFilterSuggested5.filter;
dialogFilter5.groups = true;
dialogFilter5.exclude_archived = true;
dialogFilter5.id = 22;
this.suggestedFilters.add(tL_dialogFilterSuggested5);
}
if (this.dialogFiltersByType.get(24) == null) {
TLRPC.TL_dialogFilterSuggested tL_dialogFilterSuggested6 = new TLRPC.TL_dialogFilterSuggested();
TLRPC.TL_dialogFilter tL_dialogFilter5 = new TLRPC.TL_dialogFilter();
tL_dialogFilterSuggested6.filter = tL_dialogFilter5;
((TLRPC.DialogFilter) tL_dialogFilter5).title = LocaleController.getString("FilterChannels", R.string.FilterChannels);
tL_dialogFilterSuggested6.description = LocaleController.getString("LocalFolder", R.string.LocalFolder);
TLRPC.DialogFilter dialogFilter6 = tL_dialogFilterSuggested6.filter;
dialogFilter6.broadcasts = true;
dialogFilter6.exclude_archived = true;
dialogFilter6.id = 24;
this.suggestedFilters.add(tL_dialogFilterSuggested6);
}
if (this.dialogFiltersByType.get(25) == null) {
TLRPC.TL_dialogFilterSuggested tL_dialogFilterSuggested7 = new TLRPC.TL_dialogFilterSuggested();
TLRPC.TL_dialogFilter tL_dialogFilter6 = new TLRPC.TL_dialogFilter();
tL_dialogFilterSuggested7.filter = tL_dialogFilter6;
((TLRPC.DialogFilter) tL_dialogFilter6).title = LocaleController.getString("FilterBots", R.string.FilterBots);
tL_dialogFilterSuggested7.description = LocaleController.getString("LocalFolder", R.string.LocalFolder);
TLRPC.DialogFilter dialogFilter7 = tL_dialogFilterSuggested7.filter;
dialogFilter7.bots = true;
dialogFilter7.exclude_archived = true;
dialogFilter7.id = 25;
this.suggestedFilters.add(tL_dialogFilterSuggested7);
}
if (this.dialogFiltersByType.get(26) == null) {
TLRPC.TL_dialogFilterSuggested tL_dialogFilterSuggested8 = new TLRPC.TL_dialogFilterSuggested();
TLRPC.TL_dialogFilter tL_dialogFilter7 = new TLRPC.TL_dialogFilter();
tL_dialogFilterSuggested8.filter = tL_dialogFilter7;
((TLRPC.DialogFilter) tL_dialogFilter7).title = LocaleController.getString("Favorites", R.string.Favorites);
tL_dialogFilterSuggested8.description = LocaleController.getString("LocalFolder", R.string.LocalFolder);
TLRPC.DialogFilter dialogFilter8 = tL_dialogFilterSuggested8.filter;
dialogFilter8.exclude_archived = true;
dialogFilter8.id = 26;
for (int i2 = 0; i2 < this.favsDialogs.size(); i2++) {
tL_dialogFilterSuggested8.filter.include_peers.add(getInputPeer((int) this.favsDialogs.get(i2).longValue()));
}
this.suggestedFilters.add(tL_dialogFilterSuggested8);
}
if (this.dialogFiltersByType.get(27) == null) {
TLRPC.TL_dialogFilterSuggested tL_dialogFilterSuggested9 = new TLRPC.TL_dialogFilterSuggested();
TLRPC.TL_dialogFilter tL_dialogFilter8 = new TLRPC.TL_dialogFilter();
tL_dialogFilterSuggested9.filter = tL_dialogFilter8;
((TLRPC.DialogFilter) tL_dialogFilter8).title = LocaleController.getString("Administrator", R.string.Administrator);
tL_dialogFilterSuggested9.description = LocaleController.getString("LocalFolder", R.string.LocalFolder);
TLRPC.DialogFilter dialogFilter9 = tL_dialogFilterSuggested9.filter;
dialogFilter9.exclude_archived = true;
dialogFilter9.id = 27;
for (int i3 = 0; i3 < getDialogsByType(27, 0).size(); i3++) {
if (getDialogsByType(27, 0).get(i3) instanceof TLRPC.TL_dialog) {
tL_dialogFilterSuggested9.filter.include_peers.add(getInputPeer((int) getDialogsByType(27, 0).get(i3).id));
}
}
this.suggestedFilters.add(tL_dialogFilterSuggested9);
}
if (this.dialogFiltersByType.get(29) == null) {
TLRPC.TL_dialogFilterSuggested tL_dialogFilterSuggested10 = new TLRPC.TL_dialogFilterSuggested();
TLRPC.TL_dialogFilter tL_dialogFilter9 = new TLRPC.TL_dialogFilter();
tL_dialogFilterSuggested10.filter = tL_dialogFilter9;
((TLRPC.DialogFilter) tL_dialogFilter9).title = LocaleController.getString("FilterUnmuted", R.string.FilterUnmuted);
tL_dialogFilterSuggested10.description = LocaleController.getString("LocalFolder", R.string.LocalFolder);
TLRPC.DialogFilter dialogFilter10 = tL_dialogFilterSuggested10.filter;
dialogFilter10.contacts = true;
dialogFilter10.non_contacts = true;
dialogFilter10.groups = true;
dialogFilter10.broadcasts = true;
dialogFilter10.bots = true;
dialogFilter10.exclude_muted = true;
dialogFilter10.exclude_archived = true;
dialogFilter10.id = 29;
this.suggestedFilters.add(tL_dialogFilterSuggested10);
}
if (this.dialogFiltersByType.get(28) == null) {
TLRPC.TL_dialogFilterSuggested tL_dialogFilterSuggested11 = new TLRPC.TL_dialogFilterSuggested();
TLRPC.TL_dialogFilter tL_dialogFilter10 = new TLRPC.TL_dialogFilter();
tL_dialogFilterSuggested11.filter = tL_dialogFilter10;
((TLRPC.DialogFilter) tL_dialogFilter10).title = LocaleController.getString("FilterUnread", R.string.FilterUnread);
tL_dialogFilterSuggested11.description = LocaleController.getString("LocalFolder", R.string.LocalFolder);
TLRPC.DialogFilter dialogFilter11 = tL_dialogFilterSuggested11.filter;
dialogFilter11.contacts = true;
dialogFilter11.non_contacts = true;
dialogFilter11.groups = true;
dialogFilter11.broadcasts = true;
dialogFilter11.bots = true;
dialogFilter11.exclude_read = true;
dialogFilter11.exclude_archived = true;
dialogFilter11.id = 28;
this.suggestedFilters.add(tL_dialogFilterSuggested11);
}
getNotificationCenter().postNotificationName(NotificationCenter.suggestedFiltersLoaded, new Object[0]);
}
public void loadRemoteFilters(boolean force) {
loadRemoteFilters(force, null);
}
public void loadRemoteFilters(boolean force, Utilities.Callback<Boolean> whenDone) {
if (whenDone != null) {
this.onLoadedRemoteFilters = whenDone;
}
if (this.loadingRemoteFilters || !getUserConfig().isClientActivated()) {
return;
}
if (force || !getUserConfig().filtersLoaded) {
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
if (force) {
getUserConfig().filtersLoaded = false;
getUserConfig().saveConfig(false);
}
getConnectionsManager().sendRequest(new TLRPC.TL_messages_getDialogFilters(), new MessagesController$.ExternalSyntheticLambda343(this));
}
}
}
public void lambda$loadRemoteFilters$30(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject instanceof TLRPC.Vector) {
ArrayList arrayList = new ArrayList();
TLRPC.Vector vector = (TLRPC.Vector) tLObject;
for (int i = 0; i < vector.objects.size(); i++) {
arrayList.add((TLRPC.DialogFilter) vector.objects.get(i));
}
getMessagesStorage().checkLoadedRemoteFilters(arrayList, new MessagesController$.ExternalSyntheticLambda48(this));
return;
}
if (tLObject instanceof TLRPC.TL_messages_dialogFilters) {
TLRPC.TL_messages_dialogFilters tL_messages_dialogFilters = (TLRPC.TL_messages_dialogFilters) tLObject;
boolean z = this.folderTags;
boolean z2 = tL_messages_dialogFilters.tags_enabled;
if (z != z2) {
setFolderTags(z2);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda49(this));
}
getMessagesStorage().checkLoadedRemoteFilters(tL_messages_dialogFilters.filters, new MessagesController$.ExternalSyntheticLambda46(this));
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda53(this));
}
public void lambda$loadRemoteFilters$26() {
Utilities.Callback<Boolean> callback = this.onLoadedRemoteFilters;
if (callback != null) {
callback.run(Boolean.TRUE);
this.onLoadedRemoteFilters = null;
}
}
public void lambda$loadRemoteFilters$27() {
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated, new Object[0]);
}
public void lambda$loadRemoteFilters$28() {
Utilities.Callback<Boolean> callback = this.onLoadedRemoteFilters;
if (callback != null) {
callback.run(Boolean.TRUE);
this.onLoadedRemoteFilters = null;
}
}
public void lambda$loadRemoteFilters$29() {
this.loadingRemoteFilters = false;
Utilities.Callback<Boolean> callback = this.onLoadedRemoteFilters;
if (callback != null) {
callback.run(Boolean.FALSE);
this.onLoadedRemoteFilters = null;
}
}
public void logDeviceStats() {
if (!this.collectDeviceStats || this.loggedDeviceStats) {
return;
}
ArrayList<File> rootDirs = AndroidUtilities.getRootDirs();
if (!rootDirs.isEmpty()) {
int i = 0;
String absolutePath = rootDirs.get(0).getAbsolutePath();
if (!TextUtils.isEmpty(SharedConfig.storageCacheDir)) {
int size = rootDirs.size();
while (true) {
if (i >= size) {
break;
}
String absolutePath2 = rootDirs.get(i).getAbsolutePath();
if (absolutePath2.startsWith(SharedConfig.storageCacheDir)) {
absolutePath = absolutePath2;
break;
}
i++;
}
}
boolean contains = absolutePath.contains("/storage/emulated/");
TLRPC.TL_help_saveAppLog tL_help_saveAppLog = new TLRPC.TL_help_saveAppLog();
TLRPC.TL_inputAppEvent tL_inputAppEvent = new TLRPC.TL_inputAppEvent();
tL_inputAppEvent.time = getConnectionsManager().getCurrentTime();
tL_inputAppEvent.type = "android_sdcard_exists";
TLRPC.TL_jsonBool tL_jsonBool = new TLRPC.TL_jsonBool();
tL_jsonBool.value = contains;
tL_inputAppEvent.data = tL_jsonBool;
tL_inputAppEvent.peer = contains ? 1L : 0L;
tL_help_saveAppLog.events.add(tL_inputAppEvent);
getConnectionsManager().sendRequest(tL_help_saveAppLog, MessagesController$.ExternalSyntheticLambda470.INSTANCE);
}
this.loggedDeviceStats = true;
}
public void selectDialogFilter(DialogFilter filter, int index) {
DialogFilter[] dialogFilterArr = this.selectedDialogFilter;
if (dialogFilterArr[index] == filter) {
return;
}
DialogFilter dialogFilter = dialogFilterArr[index];
dialogFilterArr[index] = filter;
if (dialogFilterArr[index == 0 ? (char) 1 : (char) 0] == filter) {
dialogFilterArr[index != 0 ? (char) 0 : (char) 1] = null;
}
if (dialogFilterArr[index] != null) {
sortDialogs(null);
} else if (dialogFilter != null) {
dialogFilter.dialogs.clear();
dialogFilter.dialogsForward.clear();
}
}
public void onFilterUpdate(DialogFilter filter) {
for (int i = 0; i < 2; i++) {
if (this.selectedDialogFilter[i] == filter) {
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[]{Boolean.TRUE});
return;
}
}
}
public void addFilter(DialogFilter filter, boolean atBegin) {
if (atBegin) {
int i = 254;
int size = this.dialogFilters.size();
for (int i2 = 0; i2 < size; i2++) {
i = Math.min(i, this.dialogFilters.get(i2).order);
}
filter.order = i - 1;
if (this.dialogFilters.get(0).isDefault()) {
this.dialogFilters.add(1, filter);
} else {
this.dialogFilters.add(0, filter);
}
} else {
int size2 = this.dialogFilters.size();
int i3 = 0;
for (int i4 = 0; i4 < size2; i4++) {
i3 = Math.max(i3, this.dialogFilters.get(i4).order);
}
filter.order = i3 + 1;
this.dialogFilters.add(filter);
}
this.dialogFiltersById.put(filter.id, filter);
if (this.dialogFilters.size() == 1 && SharedConfig.getChatSwipeAction(this.currentAccount) != 5) {
SharedConfig.updateChatListSwipeSetting(5);
}
lockFiltersInternal();
this.dialogFiltersByType.put(filter.type, filter);
if (filter.local) {
return;
}
this.remoteFoldersCount++;
}
public void updateEmojiStatus(TLRPC.EmojiStatus newStatus) {
TLRPC.TL_account_updateEmojiStatus tL_account_updateEmojiStatus = new TLRPC.TL_account_updateEmojiStatus();
tL_account_updateEmojiStatus.emoji_status = newStatus;
TLRPC$User currentUser = getUserConfig().getCurrentUser();
if (currentUser != null) {
currentUser.emoji_status = tL_account_updateEmojiStatus.emoji_status;
getNotificationCenter().postNotificationName(NotificationCenter.userEmojiStatusUpdated, new Object[]{currentUser});
getMessagesController().updateEmojiStatusUntilUpdate(currentUser.id, currentUser.emoji_status);
}
getConnectionsManager().sendRequest(tL_account_updateEmojiStatus, MessagesController$.ExternalSyntheticLambda453.INSTANCE);
}
public static void lambda$updateEmojiStatus$32(TLObject tLObject, TLRPC.TL_error tL_error) {
boolean z = tLObject instanceof TLRPC.TL_boolTrue;
}
public void removeFilter(DialogFilter filter) {
this.dialogFilters.remove(filter);
this.dialogFiltersById.remove(filter.id);
this.dialogFiltersByType.remove(filter.type);
if (!filter.local) {
this.remoteFoldersCount--;
}
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated, new Object[0]);
}
public void loadAppConfig() {
loadAppConfig(false);
}
public void loadAppConfig(boolean force) {
AndroidUtilities.cancelRunOnUIThread(this.loadAppConfigRunnable);
if (force) {
this.appConfigFetcher.forceRequest(this.currentAccount, 0);
}
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
this.appConfigFetcher.fetch(this.currentAccount, 0, new MessagesController$.ExternalSyntheticLambda316(this));
}
}
public void lambda$loadAppConfig$34(TLRPC.TL_help_appConfig tL_help_appConfig) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda235(this, tL_help_appConfig));
}
public void lambda$loadAppConfig$33(TLRPC.TL_help_appConfig tL_help_appConfig) {
if (tL_help_appConfig != null) {
TLRPC.JSONValue jSONValue = tL_help_appConfig.config;
if (jSONValue instanceof TLRPC.TL_jsonObject) {
applyAppConfig((TLRPC.TL_jsonObject) jSONValue);
}
}
AndroidUtilities.cancelRunOnUIThread(this.loadAppConfigRunnable);
AndroidUtilities.runOnUIThread(this.loadAppConfigRunnable, 240010L);
}
private void applyAppConfig(org.telegram.tgnet.TLRPC.TL_jsonObject r34) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.applyAppConfig(org.telegram.tgnet.TLRPC$TL_jsonObject):void");
}
public void lambda$applyAppConfig$35() {
getNotificationCenter().postNotificationName(NotificationCenter.storiesEnabledUpdate, new Object[0]);
}
public void updateTranscribeAudioTrialCurrentNumber(int num) {
if (num != this.transcribeAudioTrialCurrentNumber) {
this.transcribeAudioTrialCurrentNumber = num;
this.mainPreferences.edit().putInt("transcribeAudioTrialCurrentNumber", this.transcribeAudioTrialCurrentNumber).apply();
}
}
public void updateTranscribeAudioTrialCooldownUntil(int until) {
if (until != this.transcribeAudioTrialCooldownUntil) {
this.transcribeAudioTrialCooldownUntil = until;
this.mainPreferences.edit().putInt("transcribeAudioTrialCooldownUntil", this.transcribeAudioTrialCooldownUntil).apply();
scheduleTranscriptionUpdate();
}
}
private void scheduleTranscriptionUpdate() {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda58(this));
}
public void lambda$scheduleTranscriptionUpdate$36() {
AndroidUtilities.cancelRunOnUIThread(this.notifyTranscriptionAudioCooldownUpdate);
long currentTime = this.transcribeAudioTrialCooldownUntil - getConnectionsManager().getCurrentTime();
if (currentTime > 0) {
AndroidUtilities.runOnUIThread(this.notifyTranscriptionAudioCooldownUpdate, currentTime);
}
}
public void lambda$new$37() {
getNotificationCenter().postNotificationName(NotificationCenter.updateTranscriptionLock, new Object[0]);
}
private void resetAppConfig() {
this.getfileExperimentalParams = false;
this.channelRevenueWithdrawalEnabled = false;
this.collectDeviceStats = false;
this.smsjobsStickyNotificationEnabled = false;
this.showAnnualPerMonth = false;
this.canEditFactcheck = false;
this.starsLocked = true;
this.factcheckLengthLimit = ConnectionsManager.RequestFlagDoNotWaitFloodWait;
this.mainPreferences.edit().remove("starsLocked").remove("getfileExperimentalParams").remove("smsjobsStickyNotificationEnabled").remove("channelRevenueWithdrawalEnabled").remove("showAnnualPerMonth").remove("canEditFactcheck").remove("factcheckLengthLimit").apply();
}
private boolean savePremiumFeaturesPreviewOrder(String key, SparseIntArray array, SharedPreferences.Editor editor, ArrayList<TLRPC.JSONValue> value) {
int serverStringToFeatureType;
StringBuilder sb = new StringBuilder();
array.clear();
int i = 0;
while (true) {
if (i >= value.size()) {
break;
}
String str = value.get(i) instanceof TLRPC.TL_jsonString ? value.get(i).value : null;
if (str != null && (serverStringToFeatureType = PremiumPreviewFragment.serverStringToFeatureType(str)) >= 0) {
array.put(serverStringToFeatureType, i);
if (sb.length() > 0) {
sb.append('_');
}
sb.append(serverStringToFeatureType);
}
i++;
}
if (sb.length() > 0) {
String sb2 = sb.toString();
boolean equals = true ^ sb2.equals(this.mainPreferences.getString(key, null));
editor.putString(key, sb2);
return equals;
}
editor.remove(key);
return this.mainPreferences.getString(key, null) != null;
}
private void loadPremiumFeaturesPreviewOrder(SparseIntArray array, String string) {
array.clear();
if (string != null) {
String[] split = string.split("_");
for (int i = 0; i < split.length; i++) {
array.put(Integer.parseInt(split[i]), i);
}
}
}
public void removeSuggestion(long did, String suggestion) {
if (TextUtils.isEmpty(suggestion)) {
return;
}
if (did == 0) {
if (!this.pendingSuggestions.remove(suggestion) && this.dismissedSuggestions.contains(suggestion)) {
return;
}
this.dismissedSuggestions.add(suggestion);
SharedPreferences.Editor edit = this.mainPreferences.edit();
edit.putStringSet("pendingSuggestions", this.pendingSuggestions);
edit.putStringSet("dismissedSuggestions", this.dismissedSuggestions);
edit.commit();
getNotificationCenter().postNotificationName(NotificationCenter.newSuggestionsAvailable, new Object[0]);
}
TLRPC.TL_help_dismissSuggestion tL_help_dismissSuggestion = new TLRPC.TL_help_dismissSuggestion();
tL_help_dismissSuggestion.suggestion = suggestion;
if (did == 0) {
tL_help_dismissSuggestion.peer = new TLRPC.TL_inputPeerEmpty();
} else {
tL_help_dismissSuggestion.peer = getInputPeer(did);
}
getConnectionsManager().sendRequest(tL_help_dismissSuggestion, MessagesController$.ExternalSyntheticLambda466.INSTANCE);
}
public void updateConfig(final TLRPC.TL_config config) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda224(this, config));
}
public void lambda$updateConfig$39(TLRPC.TL_config tL_config) {
getDownloadController().loadAutoDownloadConfig(false);
loadAppConfig(true);
checkPeerColors(true);
this.remoteConfigLoaded = true;
this.maxMegagroupCount = tL_config.megagroup_size_max;
this.maxGroupCount = tL_config.chat_size_max;
this.maxEditTime = tL_config.edit_time_limit;
this.ratingDecay = tL_config.rating_e_decay;
this.maxRecentStickersCount = tL_config.stickers_recent_limit;
if (this.maxFaveStickersCount < 20) {
this.maxFaveStickersCount = ConnectionsManager.DEFAULT_DATACENTER_ID;
}
this.thisDc = tL_config.this_dc;
this.revokeTimeLimit = tL_config.revoke_time_limit;
this.revokeTimePmLimit = tL_config.revoke_pm_time_limit;
this.canRevokePmInbox = tL_config.revoke_pm_inbox;
String str = tL_config.me_url_prefix;
this.linkPrefix = str;
boolean z = tL_config.force_try_ipv6;
if (str.endsWith("/")) {
String str2 = this.linkPrefix;
this.linkPrefix = str2.substring(0, str2.length() - 1);
}
if (this.linkPrefix.startsWith("https://")) {
this.linkPrefix = this.linkPrefix.substring(8);
} else if (this.linkPrefix.startsWith("http://")) {
this.linkPrefix = this.linkPrefix.substring(7);
}
this.callReceiveTimeout = tL_config.call_receive_timeout_ms;
this.callRingTimeout = tL_config.call_ring_timeout_ms;
this.callConnectTimeout = tL_config.call_connect_timeout_ms;
this.callPacketTimeout = tL_config.call_packet_timeout_ms;
this.maxMessageLength = tL_config.message_length_max;
this.maxCaptionLength = tL_config.caption_length_max;
this.preloadFeaturedStickers = tL_config.preload_featured_stickers;
String str3 = tL_config.venue_search_username;
if (str3 != null) {
this.venueSearchBot = str3;
}
String str4 = tL_config.gif_search_username;
if (str4 != null) {
this.gifSearchBot = str4;
}
if (this.imageSearchBot != null) {
this.imageSearchBot = tL_config.img_search_username;
}
this.blockedCountry = tL_config.blocked_mode;
this.dcDomainName = tL_config.dc_txt_domain_name;
this.webFileDatacenterId = tL_config.webfile_dc_id;
String str5 = tL_config.suggested_lang_code;
if (str5 != null) {
String str6 = this.suggestedLangCode;
boolean z2 = str6 == null || !str6.equals(str5);
this.suggestedLangCode = tL_config.suggested_lang_code;
if (z2) {
LocaleController.getInstance().loadRemoteLanguages(this.currentAccount);
}
}
Theme.loadRemoteThemes(this.currentAccount, false);
Theme.checkCurrentRemoteTheme(false);
if (tL_config.static_maps_provider == null) {
tL_config.static_maps_provider = "telegram";
}
this.mapKey = null;
this.mapProvider = 2;
this.availableMapProviders = 0;
FileLog.d("map providers = " + tL_config.static_maps_provider);
String[] split = tL_config.static_maps_provider.split(",");
for (int i = 0; i < split.length; i++) {
String[] split2 = split[i].split("\\+");
if (split2.length > 0) {
String[] split3 = split2[0].split(":");
if (split3.length > 0) {
if ("yandex".equals(split3[0])) {
if (i == 0) {
if (split2.length > 1) {
this.mapProvider = 3;
} else {
this.mapProvider = 1;
}
}
this.availableMapProviders |= 4;
} else if ("google".equals(split3[0])) {
if (i == 0 && split2.length > 1) {
this.mapProvider = 4;
}
this.availableMapProviders |= 1;
} else if ("telegram".equals(split3[0])) {
if (i == 0) {
this.mapProvider = 2;
}
this.availableMapProviders |= 2;
}
if (split3.length > 1) {
this.mapKey = split3[1];
}
}
}
}
SharedPreferences.Editor edit = this.mainPreferences.edit();
edit.putBoolean("remoteConfigLoaded", this.remoteConfigLoaded);
edit.putInt("maxGroupCount", this.maxGroupCount);
edit.putInt("maxMegagroupCount", this.maxMegagroupCount);
edit.putInt("maxEditTime", this.maxEditTime);
edit.putInt("ratingDecay", this.ratingDecay);
edit.putInt("maxRecentGifsCount", this.maxRecentGifsCount);
edit.putInt("maxRecentStickersCount", this.maxRecentStickersCount);
edit.putInt("maxFaveStickersCount", this.maxFaveStickersCount);
edit.putInt("callReceiveTimeout", this.callReceiveTimeout);
edit.putInt("callRingTimeout", this.callRingTimeout);
edit.putInt("callConnectTimeout", this.callConnectTimeout);
edit.putInt("callPacketTimeout", this.callPacketTimeout);
edit.putString("linkPrefix", this.linkPrefix);
edit.putInt("maxFolderPinnedDialogsCountDefault", this.maxFolderPinnedDialogsCountDefault);
edit.putInt("maxFolderPinnedDialogsCountPremium", this.maxFolderPinnedDialogsCountPremium);
edit.putInt("maxMessageLength", this.maxMessageLength);
edit.putInt("maxCaptionLength", this.maxCaptionLength);
edit.putBoolean("preloadFeaturedStickers", this.preloadFeaturedStickers);
edit.putInt("revokeTimeLimit", this.revokeTimeLimit);
edit.putInt("revokeTimePmLimit", this.revokeTimePmLimit);
edit.putInt("mapProvider", this.mapProvider);
String str7 = this.mapKey;
if (str7 != null) {
edit.putString("pk", str7);
} else {
edit.remove("pk");
}
edit.putBoolean("canRevokePmInbox", this.canRevokePmInbox);
edit.putBoolean("blockedCountry", this.blockedCountry);
edit.putString("venueSearchBot", this.venueSearchBot);
edit.putString("gifSearchBot", this.gifSearchBot);
edit.putString("imageSearchBot", this.imageSearchBot);
edit.putString("dcDomainName2", this.dcDomainName);
edit.putInt("webFileDatacenterId", this.webFileDatacenterId);
edit.putString("suggestedLangCode", this.suggestedLangCode);
edit.putBoolean("forceTryIpV6", z);
String str8 = tL_config.autologin_token;
this.autologinToken = str8;
edit.putString("autologinToken", str8);
edit.commit();
getConnectionsManager().setForceTryIpV6(z);
LocaleController.getInstance().checkUpdateForCurrentRemoteLocale(this.currentAccount, tL_config.lang_pack_version, tL_config.base_lang_pack_version);
getNotificationCenter().postNotificationName(NotificationCenter.configLoaded, new Object[0]);
}
public void addSupportUser() {
TLRPC.TL_userForeign_old2 tL_userForeign_old2 = new TLRPC.TL_userForeign_old2();
tL_userForeign_old2.phone = "333";
tL_userForeign_old2.id = 333000L;
tL_userForeign_old2.first_name = "Telegram";
tL_userForeign_old2.last_name = "";
tL_userForeign_old2.status = null;
tL_userForeign_old2.photo = new TLRPC.TL_userProfilePhotoEmpty();
putUser(tL_userForeign_old2, true);
TLRPC.TL_userForeign_old2 tL_userForeign_old22 = new TLRPC.TL_userForeign_old2();
tL_userForeign_old22.phone = "42777";
tL_userForeign_old22.id = 777000L;
tL_userForeign_old22.verified = true;
tL_userForeign_old22.first_name = "Telegram";
tL_userForeign_old22.last_name = "Notifications";
tL_userForeign_old22.status = null;
tL_userForeign_old22.photo = new TLRPC.TL_userProfilePhotoEmpty();
putUser(tL_userForeign_old22, true);
}
public TLRPC.InputUser getInputUser(TLRPC$User user) {
if (user == null) {
return new TLRPC.TL_inputUserEmpty();
}
if (user.id == getUserConfig().getClientUserId()) {
return new TLRPC.TL_inputUserSelf();
}
TLRPC.TL_inputUser tL_inputUser = new TLRPC.TL_inputUser();
((TLRPC.InputUser) tL_inputUser).user_id = user.id;
((TLRPC.InputUser) tL_inputUser).access_hash = user.access_hash;
return tL_inputUser;
}
public TLRPC.InputUser getInputUser(TLRPC.InputPeer peer) {
if (peer == null) {
return new TLRPC.TL_inputUserEmpty();
}
if (peer instanceof TLRPC.TL_inputPeerSelf) {
return new TLRPC.TL_inputUserSelf();
}
TLRPC.TL_inputUser tL_inputUser = new TLRPC.TL_inputUser();
((TLRPC.InputUser) tL_inputUser).user_id = peer.user_id;
((TLRPC.InputUser) tL_inputUser).access_hash = peer.access_hash;
return tL_inputUser;
}
public TLRPC.InputUser getInputUser(long userId) {
return getInputUser(getUser(Long.valueOf(userId)));
}
public static TLRPC.InputChannel getInputChannel(TLRPC.Chat chat) {
if ((chat instanceof TLRPC.TL_channel) || (chat instanceof TLRPC.TL_channelForbidden)) {
TLRPC.TL_inputChannel tL_inputChannel = new TLRPC.TL_inputChannel();
((TLRPC.InputChannel) tL_inputChannel).channel_id = chat.id;
((TLRPC.InputChannel) tL_inputChannel).access_hash = chat.access_hash;
return tL_inputChannel;
}
return new TLRPC.TL_inputChannelEmpty();
}
public static TLRPC.InputChannel getInputChannel(TLRPC.InputPeer peer) {
TLRPC.TL_inputChannel tL_inputChannel = new TLRPC.TL_inputChannel();
((TLRPC.InputChannel) tL_inputChannel).channel_id = peer.channel_id;
((TLRPC.InputChannel) tL_inputChannel).access_hash = peer.access_hash;
return tL_inputChannel;
}
public TLRPC.InputChannel getInputChannel(long chatId) {
return getInputChannel(getChat(Long.valueOf(chatId)));
}
public TLRPC.InputPeer getInputPeer(TLRPC.Peer peer) {
if (peer instanceof TLRPC.TL_peerChat) {
TLRPC.TL_inputPeerChat tL_inputPeerChat = new TLRPC.TL_inputPeerChat();
((TLRPC.InputPeer) tL_inputPeerChat).chat_id = peer.chat_id;
return tL_inputPeerChat;
}
if (peer instanceof TLRPC.TL_peerChannel) {
TLRPC.TL_inputPeerChannel tL_inputPeerChannel = new TLRPC.TL_inputPeerChannel();
long j = peer.channel_id;
((TLRPC.InputPeer) tL_inputPeerChannel).channel_id = j;
TLRPC.Chat chat = getChat(Long.valueOf(j));
if (chat == null) {
return tL_inputPeerChannel;
}
((TLRPC.InputPeer) tL_inputPeerChannel).access_hash = chat.access_hash;
return tL_inputPeerChannel;
}
TLRPC.TL_inputPeerUser tL_inputPeerUser = new TLRPC.TL_inputPeerUser();
long j2 = peer.user_id;
((TLRPC.InputPeer) tL_inputPeerUser).user_id = j2;
TLRPC$User user = getUser(Long.valueOf(j2));
if (user == null) {
return tL_inputPeerUser;
}
((TLRPC.InputPeer) tL_inputPeerUser).access_hash = user.access_hash;
return tL_inputPeerUser;
}
public TLRPC.InputPeer getInputPeer(long id) {
TLRPC.TL_inputPeerChannel tL_inputPeerUser;
if (id == getUserConfig().getClientUserId()) {
return new TLRPC.TL_inputPeerSelf();
}
if (id < 0) {
long j = -id;
TLRPC.Chat chat = getChat(Long.valueOf(j));
if (ChatObject.isChannel(chat)) {
tL_inputPeerUser = new TLRPC.TL_inputPeerChannel();
((TLRPC.InputPeer) tL_inputPeerUser).channel_id = j;
((TLRPC.InputPeer) tL_inputPeerUser).access_hash = chat.access_hash;
} else {
TLRPC.TL_inputPeerChat tL_inputPeerChat = new TLRPC.TL_inputPeerChat();
((TLRPC.InputPeer) tL_inputPeerChat).chat_id = j;
return tL_inputPeerChat;
}
} else {
TLRPC$User user = getUser(Long.valueOf(id));
tL_inputPeerUser = new TLRPC.TL_inputPeerUser();
((TLRPC.InputPeer) tL_inputPeerUser).user_id = id;
if (user != null) {
((TLRPC.InputPeer) tL_inputPeerUser).access_hash = user.access_hash;
}
}
return tL_inputPeerUser;
}
public static TLRPC.InputPeer getInputPeer(TLRPC.Chat chat) {
if (ChatObject.isChannel(chat)) {
TLRPC.TL_inputPeerChannel tL_inputPeerChannel = new TLRPC.TL_inputPeerChannel();
((TLRPC.InputPeer) tL_inputPeerChannel).channel_id = chat.id;
((TLRPC.InputPeer) tL_inputPeerChannel).access_hash = chat.access_hash;
return tL_inputPeerChannel;
}
TLRPC.TL_inputPeerChat tL_inputPeerChat = new TLRPC.TL_inputPeerChat();
((TLRPC.InputPeer) tL_inputPeerChat).chat_id = chat.id;
return tL_inputPeerChat;
}
public static TLRPC.InputPeer getInputPeer(TLRPC$User user) {
TLRPC.TL_inputPeerUser tL_inputPeerUser = new TLRPC.TL_inputPeerUser();
((TLRPC.InputPeer) tL_inputPeerUser).user_id = user.id;
((TLRPC.InputPeer) tL_inputPeerUser).access_hash = user.access_hash;
return tL_inputPeerUser;
}
public static TLRPC.InputPeer getInputPeer(TLObject userOrChat) {
if (userOrChat instanceof TLRPC$User) {
return getInputPeer((TLRPC$User) userOrChat);
}
if (userOrChat instanceof TLRPC.Chat) {
return getInputPeer((TLRPC.Chat) userOrChat);
}
return null;
}
public TLRPC.Peer getPeer(long id) {
if (id < 0) {
long j = -id;
TLRPC.Chat chat = getChat(Long.valueOf(j));
if ((chat instanceof TLRPC.TL_channel) || (chat instanceof TLRPC.TL_channelForbidden)) {
TLRPC.TL_peerChannel tL_peerChannel = new TLRPC.TL_peerChannel();
((TLRPC.Peer) tL_peerChannel).channel_id = j;
return tL_peerChannel;
}
TLRPC.TL_peerChat tL_peerChat = new TLRPC.TL_peerChat();
((TLRPC.Peer) tL_peerChat).chat_id = j;
return tL_peerChat;
}
TLRPC.TL_peerUser tL_peerUser = new TLRPC.TL_peerUser();
((TLRPC.Peer) tL_peerUser).user_id = id;
return tL_peerUser;
}
public TLRPC.InputDocument getInputDocument(TLRPC$Document document) {
if (document == null) {
return null;
}
TLRPC.TL_inputDocument tL_inputDocument = new TLRPC.TL_inputDocument();
((TLRPC.InputDocument) tL_inputDocument).id = document.id;
((TLRPC.InputDocument) tL_inputDocument).access_hash = document.access_hash;
byte[] bArr = document.file_reference;
((TLRPC.InputDocument) tL_inputDocument).file_reference = bArr;
if (bArr == null) {
((TLRPC.InputDocument) tL_inputDocument).file_reference = new byte[0];
}
return tL_inputDocument;
}
public String getPeerName(long dialogId) {
return getPeerName(dialogId, false);
}
public String getPeerName(long dialogId, boolean firstName) {
if (dialogId >= 0) {
TLRPC$User user = getUser(Long.valueOf(dialogId));
if (firstName) {
return UserObject.getFirstName(user, true);
}
return UserObject.getUserName(user);
}
TLRPC.Chat chat = getChat(Long.valueOf(-dialogId));
return chat == null ? "" : chat.title;
}
@Override
public void didReceivedNotification(int id, int account, Object... args) {
MessageObject messageObject;
TLRPC.InputFile inputFile;
Theme.ThemeInfo themeInfo;
TLRPC.InputFile inputFile2;
Theme.ThemeAccent themeAccent;
TLRPC.TL_theme tL_theme;
TLRPC.TL_inputThemeSettings tL_inputThemeSettings = null;
if (id == NotificationCenter.fileUploaded) {
String str = (String) args[0];
TLRPC.InputFile inputFile3 = (TLRPC.InputFile) args[1];
String str2 = this.uploadingAvatar;
if (str2 != null && str2.equals(str)) {
TLRPC.TL_photos_uploadProfilePhoto tL_photos_uploadProfilePhoto = new TLRPC.TL_photos_uploadProfilePhoto();
tL_photos_uploadProfilePhoto.file = inputFile3;
tL_photos_uploadProfilePhoto.flags |= 1;
getConnectionsManager().sendRequest(tL_photos_uploadProfilePhoto, new MessagesController$.ExternalSyntheticLambda330(this));
} else {
String str3 = this.uploadingWallpaper;
if (str3 != null && str3.equals(str)) {
TLRPC.TL_account_uploadWallPaper tL_account_uploadWallPaper = new TLRPC.TL_account_uploadWallPaper();
tL_account_uploadWallPaper.file = inputFile3;
tL_account_uploadWallPaper.mime_type = "image/jpeg";
Theme.OverrideWallpaperInfo overrideWallpaperInfo = this.uploadingWallpaperInfo;
String str4 = this.uploadingWallpaper;
TLRPC.TL_wallPaperSettings tL_wallPaperSettings = new TLRPC.TL_wallPaperSettings();
((TLRPC.WallPaperSettings) tL_wallPaperSettings).blur = overrideWallpaperInfo.isBlurred;
((TLRPC.WallPaperSettings) tL_wallPaperSettings).motion = overrideWallpaperInfo.isMotion;
tL_account_uploadWallPaper.settings = tL_wallPaperSettings;
Theme.OverrideWallpaperInfo overrideWallpaperInfo2 = this.uploadingWallpaperInfo;
overrideWallpaperInfo2.uploadingProgress = 1.0f;
overrideWallpaperInfo2.requestIds = new ArrayList();
this.uploadingWallpaperInfo.requestIds.add(Integer.valueOf(getConnectionsManager().sendRequest(tL_account_uploadWallPaper, new MessagesController$.ExternalSyntheticLambda439(this, overrideWallpaperInfo, tL_wallPaperSettings, str4))));
} else {
Object obj = this.uploadingThemes.get(str);
if (obj instanceof Theme.ThemeInfo) {
themeInfo = (Theme.ThemeInfo) obj;
if (str.equals(themeInfo.uploadingThumb)) {
themeInfo.uploadedThumb = inputFile3;
themeInfo.uploadingThumb = null;
} else if (str.equals(themeInfo.uploadingFile)) {
themeInfo.uploadedFile = inputFile3;
themeInfo.uploadingFile = null;
}
inputFile = themeInfo.uploadedThumb;
inputFile2 = themeInfo.uploadedFile;
themeAccent = null;
} else if (obj instanceof Theme.ThemeAccent) {
Theme.ThemeAccent themeAccent2 = (Theme.ThemeAccent) obj;
if (str.equals(themeAccent2.uploadingThumb)) {
themeAccent2.uploadedThumb = inputFile3;
themeAccent2.uploadingThumb = null;
} else if (str.equals(themeAccent2.uploadingFile)) {
themeAccent2.uploadedFile = inputFile3;
themeAccent2.uploadingFile = null;
}
Theme.ThemeInfo themeInfo2 = themeAccent2.parentTheme;
TLRPC.InputFile inputFile4 = themeAccent2.uploadedThumb;
TLRPC.InputFile inputFile5 = themeAccent2.uploadedFile;
themeInfo = themeInfo2;
inputFile = inputFile4;
inputFile2 = inputFile5;
themeAccent = themeAccent2;
} else {
inputFile = null;
themeInfo = null;
inputFile2 = null;
themeAccent = null;
}
this.uploadingThemes.remove(str);
if (inputFile2 != null && inputFile != null) {
new File(str);
TLRPC.TL_account_uploadTheme tL_account_uploadTheme = new TLRPC.TL_account_uploadTheme();
tL_account_uploadTheme.mime_type = "application/x-tgtheme-android";
tL_account_uploadTheme.file_name = "theme.attheme";
tL_account_uploadTheme.file = inputFile2;
inputFile2.name = "theme.attheme";
tL_account_uploadTheme.thumb = inputFile;
inputFile.name = "theme-preview.jpg";
tL_account_uploadTheme.flags |= 1;
if (themeAccent != null) {
themeAccent.uploadedFile = null;
themeAccent.uploadedThumb = null;
tL_theme = themeAccent.info;
tL_inputThemeSettings = new TLRPC.TL_inputThemeSettings();
tL_inputThemeSettings.base_theme = Theme.getBaseThemeByKey(themeInfo.name);
tL_inputThemeSettings.accent_color = themeAccent.accentColor;
int i = themeAccent.accentColor2;
if (i != 0) {
tL_inputThemeSettings.flags |= 8;
tL_inputThemeSettings.outbox_accent_color = i;
}
int i2 = themeAccent.myMessagesAccentColor;
if (i2 != 0) {
tL_inputThemeSettings.message_colors.add(Integer.valueOf(i2));
tL_inputThemeSettings.flags |= 1;
int i3 = themeAccent.myMessagesGradientAccentColor1;
if (i3 != 0) {
tL_inputThemeSettings.message_colors.add(Integer.valueOf(i3));
int i4 = themeAccent.myMessagesGradientAccentColor2;
if (i4 != 0) {
tL_inputThemeSettings.message_colors.add(Integer.valueOf(i4));
int i5 = themeAccent.myMessagesGradientAccentColor3;
if (i5 != 0) {
tL_inputThemeSettings.message_colors.add(Integer.valueOf(i5));
}
}
}
tL_inputThemeSettings.message_colors_animated = themeAccent.myMessagesAnimated;
}
tL_inputThemeSettings.flags |= 2;
tL_inputThemeSettings.wallpaper_settings = new TLRPC.TL_wallPaperSettings();
if (!TextUtils.isEmpty(themeAccent.patternSlug)) {
TLRPC.TL_inputWallPaperSlug tL_inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug();
tL_inputWallPaperSlug.slug = themeAccent.patternSlug;
tL_inputThemeSettings.wallpaper = tL_inputWallPaperSlug;
TLRPC.WallPaperSettings wallPaperSettings = tL_inputThemeSettings.wallpaper_settings;
wallPaperSettings.intensity = (int) (themeAccent.patternIntensity * 100.0f);
wallPaperSettings.flags |= 8;
} else {
TLRPC.TL_inputWallPaperNoFile tL_inputWallPaperNoFile = new TLRPC.TL_inputWallPaperNoFile();
tL_inputWallPaperNoFile.id = 0L;
tL_inputThemeSettings.wallpaper = tL_inputWallPaperNoFile;
}
TLRPC.WallPaperSettings wallPaperSettings2 = tL_inputThemeSettings.wallpaper_settings;
wallPaperSettings2.motion = themeAccent.patternMotion;
long j = themeAccent.backgroundOverrideColor;
if (j != 0) {
wallPaperSettings2.background_color = (int) j;
wallPaperSettings2.flags |= 1;
}
long j2 = themeAccent.backgroundGradientOverrideColor1;
if (j2 != 0) {
wallPaperSettings2.second_background_color = (int) j2;
wallPaperSettings2.flags |= 16;
wallPaperSettings2.rotation = AndroidUtilities.getWallpaperRotation(themeAccent.backgroundRotation, true);
}
long j3 = themeAccent.backgroundGradientOverrideColor2;
if (j3 != 0) {
TLRPC.WallPaperSettings wallPaperSettings3 = tL_inputThemeSettings.wallpaper_settings;
wallPaperSettings3.third_background_color = (int) j3;
wallPaperSettings3.flags |= 32;
}
long j4 = themeAccent.backgroundGradientOverrideColor3;
if (j4 != 0) {
TLRPC.WallPaperSettings wallPaperSettings4 = tL_inputThemeSettings.wallpaper_settings;
wallPaperSettings4.fourth_background_color = (int) j4;
wallPaperSettings4.flags |= 64;
}
} else {
themeInfo.uploadedFile = null;
themeInfo.uploadedThumb = null;
tL_theme = themeInfo.info;
}
getConnectionsManager().sendRequest(tL_account_uploadTheme, new MessagesController$.ExternalSyntheticLambda434(this, tL_theme, themeInfo, tL_inputThemeSettings, themeAccent));
}
}
}
} else if (id == NotificationCenter.fileUploadFailed) {
String str5 = (String) args[0];
String str6 = this.uploadingAvatar;
if (str6 != null && str6.equals(str5)) {
this.uploadingAvatar = null;
} else {
String str7 = this.uploadingWallpaper;
if (str7 != null && str7.equals(str5)) {
this.uploadingWallpaper = null;
this.uploadingWallpaperInfo = null;
} else {
Object remove = this.uploadingThemes.remove(str5);
if (remove instanceof Theme.ThemeInfo) {
Theme.ThemeInfo themeInfo3 = (Theme.ThemeInfo) remove;
themeInfo3.uploadedFile = null;
themeInfo3.uploadedThumb = null;
getNotificationCenter().postNotificationName(NotificationCenter.themeUploadError, new Object[]{themeInfo3, null});
} else if (remove instanceof Theme.ThemeAccent) {
Theme.ThemeAccent themeAccent3 = (Theme.ThemeAccent) remove;
themeAccent3.uploadingThumb = null;
getNotificationCenter().postNotificationName(NotificationCenter.themeUploadError, new Object[]{themeAccent3.parentTheme, themeAccent3});
}
}
}
}
if (id == NotificationCenter.fileUploadProgressChanged) {
String str8 = (String) args[0];
String str9 = this.uploadingWallpaper;
if (str9 == null || !str9.equals(str8)) {
return;
}
this.uploadingWallpaperInfo.uploadingProgress = ((Long) args[1]).longValue() / ((Long) args[2]).longValue();
return;
}
if (id == NotificationCenter.messageReceivedByServer) {
if (((Boolean) args[6]).booleanValue()) {
return;
}
Integer num = (Integer) args[0];
Integer num2 = (Integer) args[1];
Long l = (Long) args[3];
ArrayList<MessageObject> arrayList = this.dialogMessage.get(l.longValue());
for (int i6 = 0; arrayList != null && i6 < arrayList.size(); i6++) {
MessageObject messageObject2 = arrayList.get(i6);
if (messageObject2 != null && (messageObject2.getId() == num.intValue() || messageObject2.messageOwner.local_id == num.intValue())) {
messageObject2.messageOwner.id = num2.intValue();
messageObject2.messageOwner.send_state = 0;
}
MessageObject messageObject3 = this.dialogMessagesByIds.get(num.intValue());
if (messageObject3 != null) {
this.dialogMessagesByIds.remove(num.intValue());
this.dialogMessagesByIds.put(num2.intValue(), messageObject3);
}
}
TLRPC.Dialog dialog = this.dialogs_dict.get(l.longValue());
if (dialog != null && dialog.top_message == num.intValue()) {
dialog.top_message = num2.intValue();
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
if (DialogObject.isChatDialog(l.longValue())) {
TLRPC.ChatFull chatFull = this.fullChats.get(-l.longValue());
TLRPC.Chat chat = getChat(Long.valueOf(-l.longValue()));
if (chat == null || ChatObject.hasAdminRights(chat) || chatFull == null || chatFull.slowmode_seconds == 0) {
return;
}
chatFull.slowmode_next_send_date = getConnectionsManager().getCurrentTime() + chatFull.slowmode_seconds;
chatFull.flags |= 262144;
getMessagesStorage().updateChatInfo(chatFull, false);
return;
}
return;
}
if (id == NotificationCenter.updateMessageMedia) {
TLRPC.Message message = (TLRPC.Message) args[0];
if (message.peer_id.channel_id != 0 || (messageObject = this.dialogMessagesByIds.get(message.id)) == null) {
return;
}
messageObject.messageOwner.media = MessageObject.getMedia(message);
if (MessageObject.getMedia(message).ttl_seconds != 0) {
if ((MessageObject.getMedia(message).photo instanceof TLRPC.TL_photoEmpty) || (MessageObject.getMedia(message).document instanceof TLRPC.TL_documentEmpty)) {
messageObject.setType();
getNotificationCenter().postNotificationName(NotificationCenter.notificationsSettingsUpdated, new Object[0]);
return;
}
return;
}
return;
}
if (id == NotificationCenter.currentUserPremiumStatusChanged) {
loadAppConfig(false);
getContactsController().reloadContactsStatusesMaybe(true);
if ((!this.storyQualityFull || getUserConfig().isPremium()) && !getUserConfig().isPremium()) {
return;
}
getNotificationCenter().postNotificationName(NotificationCenter.storyQualityUpdate, new Object[0]);
}
}
public void lambda$didReceivedNotification$41(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC$User user = getUser(Long.valueOf(getUserConfig().getClientUserId()));
if (user == null) {
user = getUserConfig().getCurrentUser();
putUser(user, true);
} else {
getUserConfig().setCurrentUser(user);
}
if (user == null) {
return;
}
TLRPC.TL_photos_photo tL_photos_photo = (TLRPC.TL_photos_photo) tLObject;
ArrayList arrayList = tL_photos_photo.photo.sizes;
TLRPC.PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(arrayList, 100);
TLRPC.PhotoSize closestPhotoSizeWithSize2 = FileLoader.getClosestPhotoSizeWithSize(arrayList, 1000);
TLRPC.TL_userProfilePhoto tL_userProfilePhoto = new TLRPC.TL_userProfilePhoto();
user.photo = tL_userProfilePhoto;
((TLRPC.UserProfilePhoto) tL_userProfilePhoto).photo_id = tL_photos_photo.photo.id;
if (closestPhotoSizeWithSize != null) {
((TLRPC.UserProfilePhoto) tL_userProfilePhoto).photo_small = closestPhotoSizeWithSize.location;
}
if (closestPhotoSizeWithSize2 != null) {
((TLRPC.UserProfilePhoto) tL_userProfilePhoto).photo_big = closestPhotoSizeWithSize2.location;
}
getDialogPhotos(user.id).reset();
getDialogPhotos(user.id).load(0, 80);
ArrayList arrayList2 = new ArrayList();
arrayList2.add(user);
getMessagesStorage().putUsersAndChats(arrayList2, (List) null, false, true);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda44(this));
}
}
public void lambda$didReceivedNotification$40() {
getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged, new Object[0]);
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_AVATAR)});
getUserConfig().saveConfig(true);
}
public void lambda$didReceivedNotification$43(Theme.OverrideWallpaperInfo overrideWallpaperInfo, TLRPC.TL_wallPaperSettings tL_wallPaperSettings, String str, TLObject tLObject, TLRPC.TL_error tL_error) {
TLRPC.WallPaper wallPaper = (TLRPC.WallPaper) tLObject;
File file = new File(ApplicationLoader.getFilesDirFixed(), overrideWallpaperInfo.originalFileName);
if (wallPaper != null) {
try {
AndroidUtilities.copyFile(file, getFileLoader().getPathToAttach(wallPaper.document, true));
} catch (Exception unused) {
}
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda255(this, wallPaper, tL_wallPaperSettings, overrideWallpaperInfo, file, str));
}
public void lambda$didReceivedNotification$42(TLRPC.WallPaper wallPaper, TLRPC.TL_wallPaperSettings tL_wallPaperSettings, Theme.OverrideWallpaperInfo overrideWallpaperInfo, File file, String str) {
if (this.uploadingWallpaper == null || this.uploadingWallpaperInfo.requestIds == null || wallPaper == null) {
return;
}
wallPaper.settings = tL_wallPaperSettings;
wallPaper.flags |= 4;
overrideWallpaperInfo.slug = wallPaper.slug;
overrideWallpaperInfo.saveOverrideWallpaper();
ArrayList arrayList = new ArrayList();
arrayList.add(wallPaper);
getMessagesStorage().putWallpapers(arrayList, 2);
TLRPC.PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(wallPaper.document.thumbs, 320);
if (closestPhotoSizeWithSize != null) {
ImageLoader.getInstance().replaceImageInCache(Utilities.MD5(file.getAbsolutePath()) + "@100_100", closestPhotoSizeWithSize.location.volume_id + "_" + closestPhotoSizeWithSize.location.local_id + "@100_100", ImageLocation.getForDocument(closestPhotoSizeWithSize, wallPaper.document), false);
}
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.wallpapersNeedReload, new Object[]{wallPaper.slug});
ArrayList arrayList2 = this.uploadingWallpaperInfo.requestIds;
if (arrayList2 == null || overrideWallpaperInfo.dialogId == 0) {
return;
}
arrayList2.add(Integer.valueOf(ChatThemeController.getInstance(this.currentAccount).setWallpaperToPeer(overrideWallpaperInfo.dialogId, str, overrideWallpaperInfo, (MessageObject) null, (Runnable) null)));
}
public void lambda$didReceivedNotification$49(TLRPC.TL_theme tL_theme, Theme.ThemeInfo themeInfo, TLRPC.TL_inputThemeSettings tL_inputThemeSettings, Theme.ThemeAccent themeAccent, TLObject tLObject, TLRPC.TL_error tL_error) {
String name = tL_theme != null ? tL_theme.title : themeInfo.getName();
int lastIndexOf = name.lastIndexOf(".attheme");
if (lastIndexOf > 0) {
name = name.substring(0, lastIndexOf);
}
if (tLObject != null) {
TLRPC$Document tLRPC$Document = (TLRPC$Document) tLObject;
TLRPC.TL_inputDocument tL_inputDocument = new TLRPC.TL_inputDocument();
((TLRPC.InputDocument) tL_inputDocument).access_hash = tLRPC$Document.access_hash;
((TLRPC.InputDocument) tL_inputDocument).id = tLRPC$Document.id;
((TLRPC.InputDocument) tL_inputDocument).file_reference = tLRPC$Document.file_reference;
if (tL_theme == null || !tL_theme.creator) {
TLRPC.TL_account_createTheme tL_account_createTheme = new TLRPC.TL_account_createTheme();
tL_account_createTheme.document = tL_inputDocument;
tL_account_createTheme.flags |= 4;
tL_account_createTheme.slug = (tL_theme == null || TextUtils.isEmpty(tL_theme.slug)) ? "" : tL_theme.slug;
tL_account_createTheme.title = name;
if (tL_inputThemeSettings != null) {
tL_account_createTheme.settings = tL_inputThemeSettings;
tL_account_createTheme.flags |= 8;
}
getConnectionsManager().sendRequest(tL_account_createTheme, new MessagesController$.ExternalSyntheticLambda440(this, themeInfo, themeAccent));
return;
}
TLRPC.TL_account_updateTheme tL_account_updateTheme = new TLRPC.TL_account_updateTheme();
TLRPC.TL_inputTheme tL_inputTheme = new TLRPC.TL_inputTheme();
tL_inputTheme.id = tL_theme.id;
tL_inputTheme.access_hash = tL_theme.access_hash;
tL_account_updateTheme.theme = tL_inputTheme;
tL_account_updateTheme.slug = tL_theme.slug;
int i = tL_account_updateTheme.flags | 1;
tL_account_updateTheme.flags = i;
tL_account_updateTheme.title = name;
int i2 = i | 2;
tL_account_updateTheme.flags = i2;
tL_account_updateTheme.document = tL_inputDocument;
int i3 = i2 | 4;
tL_account_updateTheme.flags = i3;
if (tL_inputThemeSettings != null) {
tL_account_updateTheme.settings = tL_inputThemeSettings;
tL_account_updateTheme.flags = i3 | 8;
}
tL_account_updateTheme.format = "android";
getConnectionsManager().sendRequest(tL_account_updateTheme, new MessagesController$.ExternalSyntheticLambda441(this, themeInfo, themeAccent));
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda272(this, themeInfo, themeAccent));
}
public void lambda$didReceivedNotification$45(Theme.ThemeInfo themeInfo, Theme.ThemeAccent themeAccent, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda202(this, tLObject, themeInfo, themeAccent));
}
public void lambda$didReceivedNotification$44(TLObject tLObject, Theme.ThemeInfo themeInfo, Theme.ThemeAccent themeAccent) {
if (tLObject instanceof TLRPC.TL_theme) {
Theme.setThemeUploadInfo(themeInfo, themeAccent, (TLRPC.TL_theme) tLObject, this.currentAccount, false);
installTheme(themeInfo, themeAccent, themeInfo == Theme.getCurrentNightTheme());
getNotificationCenter().postNotificationName(NotificationCenter.themeUploadedToServer, new Object[]{themeInfo, themeAccent});
return;
}
getNotificationCenter().postNotificationName(NotificationCenter.themeUploadError, new Object[]{themeInfo, themeAccent});
}
public void lambda$didReceivedNotification$47(Theme.ThemeInfo themeInfo, Theme.ThemeAccent themeAccent, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda203(this, tLObject, themeInfo, themeAccent));
}
public void lambda$didReceivedNotification$46(TLObject tLObject, Theme.ThemeInfo themeInfo, Theme.ThemeAccent themeAccent) {
if (tLObject instanceof TLRPC.TL_theme) {
Theme.setThemeUploadInfo(themeInfo, themeAccent, (TLRPC.TL_theme) tLObject, this.currentAccount, false);
getNotificationCenter().postNotificationName(NotificationCenter.themeUploadedToServer, new Object[]{themeInfo, themeAccent});
} else {
getNotificationCenter().postNotificationName(NotificationCenter.themeUploadError, new Object[]{themeInfo, themeAccent});
}
}
public void lambda$didReceivedNotification$48(Theme.ThemeInfo themeInfo, Theme.ThemeAccent themeAccent) {
getNotificationCenter().postNotificationName(NotificationCenter.themeUploadError, new Object[]{themeInfo, themeAccent});
}
public void cleanup() {
getContactsController().cleanup();
MediaController.getInstance().cleanup();
getNotificationsController().cleanup();
getSendMessagesHelper().cleanup();
getSecretChatHelper().cleanup();
getLocationController().cleanup();
getMediaDataController().cleanup();
getColorPalette().cleanup();
getTranslateController().cleanup();
getSavedMessagesController().cleanup();
StoriesController storiesController = this.storiesController;
if (storiesController != null) {
storiesController.cleanup();
}
UnconfirmedAuthController unconfirmedAuthController = this.unconfirmedAuthController;
if (unconfirmedAuthController != null) {
unconfirmedAuthController.cleanup();
}
this.showFiltersTooltip = false;
DialogsActivity.dialogsLoaded[this.currentAccount] = false;
this.notificationsPreferences.edit().clear().commit();
this.emojiPreferences.edit().putLong("lastGifLoadTime", 0L).putLong("lastStickersLoadTime", 0L).putLong("lastStickersLoadTimeMask", 0L).putLong("lastStickersLoadTimeFavs", 0L).commit();
this.mainPreferences.edit().remove("archivehint").remove("proximityhint").remove("archivehint_l").remove("gifhint").remove("reminderhint").remove("soundHint").remove("dcDomainName2").remove("webFileDatacenterId").remove("themehint").remove("showFiltersTooltip").remove("transcribeButtonPressed").commit();
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("shortcut_widget", 0);
SharedPreferences.Editor editor = null;
ArrayList arrayList = null;
ArrayList arrayList2 = null;
AppWidgetManager appWidgetManager = null;
for (Map.Entry<String, ?> entry : sharedPreferences.getAll().entrySet()) {
String key = entry.getKey();
if (key.startsWith("account") && ((Integer) entry.getValue()).intValue() == this.currentAccount) {
int intValue = Utilities.parseInt(key).intValue();
if (editor == null) {
editor = sharedPreferences.edit();
appWidgetManager = AppWidgetManager.getInstance(ApplicationLoader.applicationContext);
}
editor.putBoolean("deleted" + intValue, true);
if (sharedPreferences.getInt("type" + intValue, 0) == 0) {
if (arrayList == null) {
arrayList = new ArrayList();
}
arrayList.add(Integer.valueOf(intValue));
} else {
if (arrayList2 == null) {
arrayList2 = new ArrayList();
}
arrayList2.add(Integer.valueOf(intValue));
}
}
}
if (editor != null) {
editor.commit();
}
if (arrayList != null) {
int size = arrayList.size();
for (int i = 0; i < size; i++) {
ChatsWidgetProvider.updateWidget(ApplicationLoader.applicationContext, appWidgetManager, ((Integer) arrayList.get(i)).intValue());
}
}
if (arrayList2 != null) {
int size2 = arrayList2.size();
for (int i2 = 0; i2 < size2; i2++) {
ContactsWidgetProvider.updateWidget(ApplicationLoader.applicationContext, appWidgetManager, ((Integer) arrayList2.get(i2)).intValue());
}
}
this.lastScheduledServerQueryTime.clear();
this.lastQuickReplyServerQueryTime.clear();
this.lastSavedServerQueryTime.clear();
this.lastServerQueryTime.clear();
this.reloadingWebpages.clear();
this.reloadingWebpagesPending.clear();
this.reloadingScheduledWebpages.clear();
this.reloadingScheduledWebpagesPending.clear();
this.reloadingSavedWebpages.clear();
this.reloadingSavedWebpagesPending.clear();
this.sponsoredMessages.clear();
this.sendAsPeers.clear();
this.dialogs_dict.clear();
this.dialogs_read_inbox_max.clear();
this.loadingPinnedDialogs.clear();
this.dialogs_read_outbox_max.clear();
this.exportedChats.clear();
this.fullUsers.clear();
this.fullChats.clear();
this.activeVoiceChatsMap.clear();
this.loadingGroupCalls.clear();
this.groupCallsByChatId.clear();
this.dialogsByFolder.clear();
this.unreadUnmutedDialogs = 0;
this.joiningToChannels.clear();
this.migratedChats.clear();
this.channelViewsToSend.clear();
this.pollsToCheck.clear();
this.pollsToCheckSize = 0;
this.dialogsServerOnly.clear();
this.dialogsForward.clear();
this.allDialogs.clear();
this.dialogsLoadedTillDate = ConnectionsManager.DEFAULT_DATACENTER_ID;
this.dialogsCanAddUsers.clear();
this.dialogsMyChannels.clear();
this.dialogsMyGroups.clear();
this.dialogsChannelsOnly.clear();
this.dialogsGroupsOnly.clear();
this.dialogsUsersOnly.clear();
this.dialogsForBlock.clear();
this.dialogsTopicsGroups.clear();
this.dialogsUsersByFolder.clear();
this.dialogsGroupsByFolder.clear();
this.dialogsGroupsAllByFolder.clear();
this.dialogsBotsByFolder.clear();
this.dialogsMegaGroupsByFolder.clear();
this.dialogsChannelsByFolder.clear();
this.dialogsFavsByFolder.clear();
this.dialogsAdminByFolder.clear();
this.dialogsUnreadByFolder.clear();
this.dialogsHiddenByFolder.clear();
this.dialogFiltersByType.clear();
this.remoteFoldersCount = 0;
this.dialogMessagesByIds.clear();
this.dialogMessagesByRandomIds.clear();
this.channelAdmins.clear();
this.loadingChannelAdmins.clear();
this.users.clear();
this.objectsByUsernames.clear();
this.chats.clear();
this.dialogMessage.clear();
this.deletedHistory.clear();
this.printingUsers.clear();
this.printingStrings.clear();
this.printingStringsTypes.clear();
this.onlinePrivacy.clear();
this.loadingPeerSettings.clear();
this.deletingDialogs.clear();
this.clearingHistoryDialogs.clear();
this.lastPrintingStringCount = 0;
DialogFilter[] dialogFilterArr = this.selectedDialogFilter;
dialogFilterArr[1] = null;
dialogFilterArr[0] = null;
this.dialogFilters.clear();
this.dialogFiltersById.clear();
this.loadingSuggestedFilters = false;
this.loadingRemoteFilters = false;
this.suggestedFilters.clear();
this.gettingAppChangelog = false;
this.dialogFiltersLoaded = false;
this.ignoreSetOnline = false;
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda34(this));
this.createdDialogMainThreadIds.clear();
this.visibleDialogMainThreadIds.clear();
this.visibleScheduledDialogMainThreadIds.clear();
this.blockePeers.clear();
int i3 = 0;
while (true) {
LongSparseArray<LongSparseArray<Boolean>>[] longSparseArrayArr = this.sendingTypings;
if (i3 >= longSparseArrayArr.length) {
break;
}
if (longSparseArrayArr[i3] != null) {
longSparseArrayArr[i3].clear();
}
i3++;
}
this.loadingFullUsers.clear();
this.loadedFullUsers.clear();
this.reloadingMessages.clear();
this.loadingFullChats.clear();
this.loadingFullParticipants.clear();
this.loadedFullParticipants.clear();
this.loadedFullChats.clear();
this.dialogsLoaded = false;
this.nextDialogsCacheOffset.clear();
this.loadingDialogs.clear();
this.dialogsEndReached.clear();
this.serverDialogsEndReached.clear();
this.checkingTosUpdate = false;
this.nextTosCheckTime = 0;
this.nextPromoInfoCheckTime = 0;
this.checkingPromoInfo = false;
this.loadingUnreadDialogs = false;
this.currentDeletingTaskTime = 0;
this.currentDeletingTaskMids = null;
this.currentDeletingTaskMediaMids = null;
this.gettingNewDeleteTask = false;
this.loadingBlockedPeers = false;
this.totalBlockedCount = -1;
this.blockedEndReached = false;
this.firstGettingTask = false;
this.updatingState = false;
this.resetingDialogs = false;
this.lastStatusUpdateTime = 0L;
this.offlineSent = false;
this.registeringForPush = false;
this.getDifferenceFirstSync = true;
this.uploadingAvatar = null;
this.uploadingWallpaper = null;
this.uploadingWallpaperInfo = null;
this.uploadingThemes.clear();
this.gettingChatInviters.clear();
this.statusRequest = 0;
this.statusSettingState = 0;
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda43(this));
if (this.currentDeleteTaskRunnable != null) {
Utilities.stageQueue.cancelRunnable(this.currentDeleteTaskRunnable);
this.currentDeleteTaskRunnable = null;
}
addSupportUser();
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda52(this));
}
public void lambda$cleanup$50() {
this.readTasks.clear();
this.readTasksMap.clear();
this.repliesReadTasks.clear();
this.threadsReadTasksMap.clear();
this.updatesQueueSeq.clear();
this.updatesQueuePts.clear();
this.updatesQueueQts.clear();
this.gettingUnknownChannels.clear();
this.gettingUnknownDialogs.clear();
this.updatesStartWaitTimeSeq = 0L;
this.updatesStartWaitTimePts = 0L;
this.updatesStartWaitTimeQts = 0L;
this.createdDialogIds.clear();
this.createdScheduledDialogIds.clear();
this.gettingDifference = false;
this.resetDialogsPinned = null;
this.resetDialogsAll = null;
}
public void lambda$cleanup$51() {
FileLog.d("cleanup: isUpdating = false");
getConnectionsManager().setIsUpdating(false);
this.updatesQueueChannels.clear();
this.updatesStartWaitTimeChannels.clear();
this.gettingDifferenceChannels.clear();
this.channelsPts.clear();
this.shortPollChannels.clear();
this.needShortPollChannels.clear();
this.shortPollOnlines.clear();
this.needShortPollOnlines.clear();
}
public void lambda$cleanup$52() {
getNotificationCenter().postNotificationName(NotificationCenter.suggestedFiltersLoaded, new Object[0]);
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated, new Object[0]);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
public boolean isChatNoForwards(TLRPC.Chat chat) {
TLRPC.Chat chat2;
if (chat == null) {
return false;
}
TLRPC.InputChannel inputChannel = chat.migrated_to;
if (inputChannel != null && (chat2 = getChat(Long.valueOf(inputChannel.channel_id))) != null) {
return chat2.noforwards;
}
return chat.noforwards;
}
public boolean isChatNoForwards(long chatId) {
return isChatNoForwards(getChat(Long.valueOf(chatId)));
}
public TLRPC$User getUser(Long id) {
if (id.longValue() == 0) {
return UserConfig.getInstance(this.currentAccount).getCurrentUser();
}
return (TLRPC$User) this.users.get(id);
}
public TLObject getUserOrChat(long dialogId) {
if (this.users.containsKey(Long.valueOf(dialogId))) {
return (TLObject) this.users.get(Long.valueOf(dialogId));
}
long j = -dialogId;
if (this.chats.containsKey(Long.valueOf(j))) {
return (TLObject) this.chats.get(Long.valueOf(j));
}
return null;
}
public TLObject getUserOrChat(String username) {
if (username == null || username.length() == 0) {
return null;
}
return (TLObject) this.objectsByUsernames.get(username.toLowerCase());
}
public ConcurrentHashMap<Long, TLRPC$User> getUsers() {
return this.users;
}
public ConcurrentHashMap<Long, TLRPC.Chat> getChats() {
return this.chats;
}
public TLRPC.Chat getChat(Long id) {
return (TLRPC.Chat) this.chats.get(id);
}
public TLRPC.EncryptedChat getEncryptedChat(Integer id) {
return (TLRPC.EncryptedChat) this.encryptedChats.get(id);
}
public TLRPC.EncryptedChat getEncryptedChatDB(int chatId, boolean created) {
TLRPC.EncryptedChat encryptedChat = (TLRPC.EncryptedChat) this.encryptedChats.get(Integer.valueOf(chatId));
if (encryptedChat != null) {
if (!created) {
return encryptedChat;
}
if (!(encryptedChat instanceof TLRPC.TL_encryptedChatWaiting) && !(encryptedChat instanceof TLRPC.TL_encryptedChatRequested)) {
return encryptedChat;
}
}
CountDownLatch countDownLatch = new CountDownLatch(1);
ArrayList arrayList = new ArrayList();
getMessagesStorage().getEncryptedChat(chatId, countDownLatch, arrayList);
try {
countDownLatch.await();
} catch (Exception e) {
FileLog.e(e);
}
if (arrayList.size() != 2) {
return encryptedChat;
}
TLRPC.EncryptedChat encryptedChat2 = (TLRPC.EncryptedChat) arrayList.get(0);
TLRPC$User tLRPC$User = (TLRPC$User) arrayList.get(1);
putEncryptedChat(encryptedChat2, false);
putUser(tLRPC$User, true);
return encryptedChat2;
}
public boolean isDialogVisible(long dialogId, boolean scheduled) {
return (scheduled ? this.visibleScheduledDialogMainThreadIds : this.visibleDialogMainThreadIds).contains(Long.valueOf(dialogId));
}
public void setLastVisibleDialogId(final long dialogId, boolean scheduled, boolean set) {
ArrayList<Long> arrayList = scheduled ? this.visibleScheduledDialogMainThreadIds : this.visibleDialogMainThreadIds;
if (set) {
if (arrayList.contains(Long.valueOf(dialogId))) {
return;
}
arrayList.add(Long.valueOf(dialogId));
return;
}
arrayList.remove(Long.valueOf(dialogId));
}
public void setLastCreatedDialogId(final long dialogId, boolean scheduled, boolean set) {
if (!scheduled) {
ArrayList<Long> arrayList = this.createdDialogMainThreadIds;
if (set) {
if (arrayList.contains(Long.valueOf(dialogId))) {
return;
} else {
arrayList.add(Long.valueOf(dialogId));
}
} else {
arrayList.remove(Long.valueOf(dialogId));
SparseArray<MessageObject> sparseArray = this.pollsToCheck.get(dialogId);
if (sparseArray != null) {
int size = sparseArray.size();
for (int i = 0; i < size; i++) {
sparseArray.valueAt(i).pollVisibleOnScreen = false;
}
}
}
}
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda280(this, scheduled, set, dialogId));
}
public void lambda$setLastCreatedDialogId$53(boolean z, boolean z2, long j) {
ArrayList<Long> arrayList = z ? this.createdScheduledDialogIds : this.createdDialogIds;
if (z2) {
if (arrayList.contains(Long.valueOf(j))) {
return;
}
arrayList.add(Long.valueOf(j));
return;
}
arrayList.remove(Long.valueOf(j));
}
public TLRPC.TL_chatInviteExported getExportedInvite(long chatId) {
return this.exportedChats.get(chatId);
}
public boolean putUser(TLRPC$User user, boolean fromCache) {
return putUser(user, fromCache, false);
}
public boolean putUser(org.telegram.tgnet.TLRPC$User r9, boolean r10, boolean r11) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.putUser(org.telegram.tgnet.TLRPC$User, boolean, boolean):boolean");
}
public void reloadUser(long userId) {
TLObject tL_users_getUsers = new TLRPC.TL_users_getUsers();
TLRPC.InputUser inputUser = getInputUser(userId);
if (inputUser == null) {
return;
}
((TLRPC.TL_users_getUsers) tL_users_getUsers).id.add(inputUser);
ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_users_getUsers, new MessagesController$.ExternalSyntheticLambda328(this));
}
public void lambda$reloadUser$54(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject instanceof TLRPC.Vector) {
ArrayList arrayList = ((TLRPC.Vector) tLObject).objects;
ArrayList<TLRPC$User> arrayList2 = new ArrayList<>();
for (int i = 0; i < arrayList.size(); i++) {
if (arrayList.get(i) instanceof TLRPC$User) {
arrayList2.add((TLRPC$User) arrayList.get(i));
}
}
getMessagesController().putUsers(arrayList2, false);
}
}
public void putUsers(ArrayList<TLRPC$User> users, boolean fromCache) {
if (users == null || users.isEmpty()) {
return;
}
int size = users.size();
boolean z = false;
for (int i = 0; i < size; i++) {
if (putUser(users.get(i), fromCache)) {
z = true;
}
}
if (z) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda33(this));
}
}
public void lambda$putUsers$55() {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_STATUS)});
}
public void putChat(final TLRPC.Chat chat, boolean fromCache) {
TLRPC.Chat chat2;
if (chat == null || (chat2 = (TLRPC.Chat) this.chats.get(Long.valueOf(chat.id))) == chat) {
return;
}
if (chat2 != null && !TextUtils.isEmpty(chat2.username)) {
this.objectsByUsernames.remove(chat2.username.toLowerCase());
}
if (chat2 != null && chat2.usernames != null) {
for (int i = 0; i < chat2.usernames.size(); i++) {
TLRPC.TL_username tL_username = (TLRPC.TL_username) chat2.usernames.get(i);
if (tL_username != null && !TextUtils.isEmpty(tL_username.username)) {
this.objectsByUsernames.remove(tL_username.username.toLowerCase());
}
}
}
if (!TextUtils.isEmpty(chat.username)) {
this.objectsByUsernames.put(chat.username.toLowerCase(), chat);
}
if (chat.usernames != null) {
for (int i2 = 0; i2 < chat.usernames.size(); i2++) {
TLRPC.TL_username tL_username2 = (TLRPC.TL_username) chat.usernames.get(i2);
if (tL_username2 != null && !TextUtils.isEmpty(tL_username2.username) && tL_username2.active) {
this.objectsByUsernames.put(tL_username2.username.toLowerCase(), chat);
}
}
}
updateEmojiStatusUntilUpdate(-chat.id, chat.emoji_status);
if (!chat.min) {
if (!fromCache) {
if (chat2 != null) {
if (chat.version != chat2.version) {
this.loadedFullChats.delete(chat.id);
}
int i3 = chat2.participants_count;
if (i3 != 0 && chat.participants_count == 0) {
chat.participants_count = i3;
chat.flags |= 131072;
}
TLRPC.TL_chatBannedRights tL_chatBannedRights = chat2.banned_rights;
int i4 = tL_chatBannedRights != null ? tL_chatBannedRights.flags : 0;
TLRPC.TL_chatBannedRights tL_chatBannedRights2 = chat.banned_rights;
int i5 = tL_chatBannedRights2 != null ? tL_chatBannedRights2.flags : 0;
TLRPC.TL_chatBannedRights tL_chatBannedRights3 = chat2.default_banned_rights;
int i6 = tL_chatBannedRights3 != null ? tL_chatBannedRights3.flags : 0;
TLRPC.TL_chatBannedRights tL_chatBannedRights4 = chat.default_banned_rights;
int i7 = tL_chatBannedRights4 != null ? tL_chatBannedRights4.flags : 0;
chat2.default_banned_rights = tL_chatBannedRights4;
if (tL_chatBannedRights4 == null) {
chat2.flags &= -262145;
} else {
chat2.flags = 262144 | chat2.flags;
}
chat2.banned_rights = tL_chatBannedRights2;
if (tL_chatBannedRights2 == null) {
chat2.flags &= -32769;
} else {
chat2.flags |= 32768;
}
TLRPC.TL_chatAdminRights tL_chatAdminRights = chat.admin_rights;
chat2.admin_rights = tL_chatAdminRights;
if (tL_chatAdminRights == null) {
chat2.flags &= -16385;
} else {
chat2.flags |= 16384;
}
if (chat.stories_hidden_min) {
chat.stories_hidden = chat2.stories_hidden;
}
if (i4 != i5 || i6 != i7) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda210(this, chat));
}
}
this.chats.put(Long.valueOf(chat.id), chat);
} else if (chat2 == null) {
this.chats.put(Long.valueOf(chat.id), chat);
} else if (chat2.min) {
chat.title = chat2.title;
chat.photo = chat2.photo;
chat.broadcast = chat2.broadcast;
chat.verified = chat2.verified;
chat.megagroup = chat2.megagroup;
TLRPC.TL_chatBannedRights tL_chatBannedRights5 = chat2.default_banned_rights;
if (tL_chatBannedRights5 != null) {
chat.default_banned_rights = tL_chatBannedRights5;
chat.flags |= 262144;
}
TLRPC.TL_chatAdminRights tL_chatAdminRights2 = chat2.admin_rights;
if (tL_chatAdminRights2 != null) {
chat.admin_rights = tL_chatAdminRights2;
chat.flags |= 16384;
}
TLRPC.TL_chatBannedRights tL_chatBannedRights6 = chat2.banned_rights;
if (tL_chatBannedRights6 != null) {
chat.banned_rights = tL_chatBannedRights6;
chat.flags |= 32768;
}
String str = chat2.username;
if (str != null) {
chat.username = str;
chat.flags |= 64;
} else {
chat.flags &= -65;
chat.username = null;
}
int i8 = chat2.participants_count;
if (i8 != 0 && chat.participants_count == 0) {
chat.participants_count = i8;
chat.flags |= 131072;
}
this.chats.put(Long.valueOf(chat.id), chat);
}
addOrRemoveActiveVoiceChat(chat);
} else if (chat2 == null) {
this.chats.put(Long.valueOf(chat.id), chat);
addOrRemoveActiveVoiceChat(chat);
} else if (!fromCache) {
getUserNameResolver().update(chat2, chat);
chat2.title = chat.title;
chat2.photo = chat.photo;
chat2.broadcast = chat.broadcast;
chat2.verified = chat.verified;
chat2.megagroup = chat.megagroup;
chat2.call_not_empty = chat.call_not_empty;
chat2.call_active = chat.call_active;
TLRPC.TL_chatBannedRights tL_chatBannedRights7 = chat.default_banned_rights;
if (tL_chatBannedRights7 != null) {
chat2.default_banned_rights = tL_chatBannedRights7;
chat2.flags |= 262144;
}
TLRPC.TL_chatAdminRights tL_chatAdminRights3 = chat.admin_rights;
if (tL_chatAdminRights3 != null) {
chat2.admin_rights = tL_chatAdminRights3;
chat2.flags |= 16384;
}
TLRPC.TL_chatBannedRights tL_chatBannedRights8 = chat.banned_rights;
if (tL_chatBannedRights8 != null) {
chat2.banned_rights = tL_chatBannedRights8;
chat2.flags |= 32768;
}
String str2 = chat.username;
if (str2 != null) {
chat2.username = str2;
chat2.flags |= 64;
} else {
chat2.flags &= -65;
chat2.username = null;
}
int i9 = chat.participants_count;
if (i9 != 0) {
chat2.participants_count = i9;
}
addOrRemoveActiveVoiceChat(chat2);
boolean z = chat2.forum;
boolean z2 = chat.forum;
if (z != z2) {
chat2.forum = z2;
if (z2) {
chat2.flags |= 1073741824;
} else {
chat2.flags &= -1073741825;
}
getNotificationCenter().postNotificationName(NotificationCenter.chatSwithcedToForum, new Object[]{Long.valueOf(chat.id)});
}
}
if (chat2 == null || chat2.forum == chat.forum) {
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda208(this, chat));
}
public void lambda$putChat$56(TLRPC.Chat chat) {
getNotificationCenter().postNotificationName(NotificationCenter.channelRightsUpdated, new Object[]{chat});
}
public void lambda$putChat$57(TLRPC.Chat chat) {
getNotificationCenter().postNotificationName(NotificationCenter.chatSwithcedToForum, new Object[]{Long.valueOf(chat.id)});
}
public void putChats(ArrayList<TLRPC.Chat> chats, boolean fromCache) {
if (chats == null || chats.isEmpty()) {
return;
}
int size = chats.size();
for (int i = 0; i < size; i++) {
putChat(chats.get(i), fromCache);
}
}
private void addOrRemoveActiveVoiceChat(TLRPC.Chat chat) {
if (Thread.currentThread() != Looper.getMainLooper().getThread()) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda206(this, chat));
} else {
lambda$addOrRemoveActiveVoiceChat$58(chat);
}
}
public void lambda$addOrRemoveActiveVoiceChat$58(TLRPC.Chat chat) {
TLRPC.Chat chat2 = this.activeVoiceChatsMap.get(Long.valueOf(chat.id));
if (chat.call_active && chat.call_not_empty && chat.migrated_to == null && !ChatObject.isNotInChat(chat)) {
if (chat2 != null) {
return;
}
this.activeVoiceChatsMap.put(Long.valueOf(chat.id), chat);
getNotificationCenter().postNotificationName(NotificationCenter.activeGroupCallsUpdated, new Object[0]);
return;
}
if (chat2 == null) {
return;
}
this.activeVoiceChatsMap.remove(Long.valueOf(chat.id));
getNotificationCenter().postNotificationName(NotificationCenter.activeGroupCallsUpdated, new Object[0]);
}
public ArrayList<Long> getActiveGroupCalls() {
return new ArrayList<>(this.activeVoiceChatsMap.keySet());
}
public void setReferer(String referer) {
if (referer == null) {
return;
}
this.installReferer = referer;
this.mainPreferences.edit().putString("installReferer", referer).commit();
}
public void putEncryptedChat(TLRPC.EncryptedChat encryptedChat, boolean fromCache) {
if (encryptedChat == null) {
return;
}
if (fromCache) {
this.encryptedChats.putIfAbsent(Integer.valueOf(encryptedChat.id), encryptedChat);
} else {
this.encryptedChats.put(Integer.valueOf(encryptedChat.id), encryptedChat);
}
}
public void putEncryptedChats(ArrayList<TLRPC.EncryptedChat> encryptedChats, boolean fromCache) {
if (encryptedChats == null || encryptedChats.isEmpty()) {
return;
}
int size = encryptedChats.size();
for (int i = 0; i < size; i++) {
putEncryptedChat(encryptedChats.get(i), fromCache);
}
}
public String getUserAbout(int uid) {
long j = uid;
return getUserFull(j) != null ? getUserFull(j).about : "";
}
public TLRPC.UserFull getUserFull(long uid) {
return this.fullUsers.get(uid);
}
public TLRPC.ChatFull getChatFull(long chatId) {
return this.fullChats.get(chatId);
}
public void putGroupCall(long chatId, ChatObject.Call call) {
this.groupCalls.put(call.call.id, call);
this.groupCallsByChatId.put(chatId, call);
TLRPC.ChatFull chatFull = getChatFull(chatId);
if (chatFull != null) {
chatFull.call = call.getInputGroupCall();
}
getNotificationCenter().postNotificationName(NotificationCenter.groupCallUpdated, new Object[]{Long.valueOf(chatId), Long.valueOf(call.call.id), Boolean.FALSE});
loadFullChat(chatId, 0, true);
}
public ChatObject.Call getGroupCall(long chatId, boolean load) {
return getGroupCall(chatId, load, null);
}
public ChatObject.Call getGroupCall(long chatId, boolean load, Runnable onLoad) {
TLRPC.TL_inputGroupCall tL_inputGroupCall;
TLRPC.ChatFull chatFull = getChatFull(chatId);
if (chatFull == null || (tL_inputGroupCall = chatFull.call) == null) {
return null;
}
ChatObject.Call call = this.groupCalls.get(tL_inputGroupCall.id);
if (call == null && load && !this.loadingGroupCalls.contains(Long.valueOf(chatId))) {
this.loadingGroupCalls.add(Long.valueOf(chatId));
if (chatFull.call != null) {
TLRPC.TL_phone_getGroupCall tL_phone_getGroupCall = new TLRPC.TL_phone_getGroupCall();
tL_phone_getGroupCall.call = chatFull.call;
tL_phone_getGroupCall.limit = 20;
getConnectionsManager().sendRequest(tL_phone_getGroupCall, new MessagesController$.ExternalSyntheticLambda400(this, chatId, onLoad));
}
}
if (call == null || !(call.call instanceof TLRPC.TL_groupCallDiscarded)) {
return call;
}
return null;
}
public void lambda$getGroupCall$60(long j, Runnable runnable, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda199(this, tLObject, j, runnable));
}
public void lambda$getGroupCall$59(TLObject tLObject, long j, Runnable runnable) {
if (tLObject != null) {
TLRPC.TL_phone_groupCall tL_phone_groupCall = (TLRPC.TL_phone_groupCall) tLObject;
putUsers(tL_phone_groupCall.users, false);
putChats(tL_phone_groupCall.chats, false);
ChatObject.Call call = new ChatObject.Call();
call.setCall(getAccountInstance(), j, tL_phone_groupCall);
this.groupCalls.put(tL_phone_groupCall.call.id, call);
this.groupCallsByChatId.put(j, call);
getNotificationCenter().postNotificationName(NotificationCenter.groupCallUpdated, new Object[]{Long.valueOf(j), Long.valueOf(tL_phone_groupCall.call.id), Boolean.FALSE});
if (runnable != null) {
runnable.run();
}
}
this.loadingGroupCalls.remove(Long.valueOf(j));
}
public void cancelLoadFullUser(long userId) {
this.loadingFullUsers.remove(Long.valueOf(userId));
}
public void cancelLoadFullChat(long chatId) {
this.loadingFullChats.remove(Long.valueOf(chatId));
}
public void clearFullUsers() {
this.loadedFullUsers.clear();
this.loadedFullChats.clear();
}
private void reloadDialogsReadValue(ArrayList<TLRPC.Dialog> dialogs, long did) {
if (did == 0 && (dialogs == null || dialogs.isEmpty())) {
return;
}
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
TLRPC.TL_messages_getPeerDialogs tL_messages_getPeerDialogs = new TLRPC.TL_messages_getPeerDialogs();
if (dialogs != null) {
for (int i = 0; i < dialogs.size(); i++) {
TLRPC.InputPeer inputPeer = getInputPeer(dialogs.get(i).id);
if (!(inputPeer instanceof TLRPC.TL_inputPeerChannel) || inputPeer.access_hash != 0) {
TLRPC.TL_inputDialogPeer tL_inputDialogPeer = new TLRPC.TL_inputDialogPeer();
tL_inputDialogPeer.peer = inputPeer;
long peerDialogId = DialogObject.getPeerDialogId(inputPeer);
Long l = this.peerDialogsRequested.get(peerDialogId);
if (l == null || System.currentTimeMillis() - l.longValue() > 240000) {
tL_messages_getPeerDialogs.peers.add(tL_inputDialogPeer);
this.peerDialogsRequested.put(peerDialogId, Long.valueOf(System.currentTimeMillis()));
}
}
}
} else {
TLRPC.InputPeer inputPeer2 = getInputPeer(did);
if ((inputPeer2 instanceof TLRPC.TL_inputPeerChannel) && inputPeer2.access_hash == 0) {
return;
}
TLRPC.TL_inputDialogPeer tL_inputDialogPeer2 = new TLRPC.TL_inputDialogPeer();
tL_inputDialogPeer2.peer = inputPeer2;
long peerDialogId2 = DialogObject.getPeerDialogId(inputPeer2);
Long l2 = this.peerDialogsRequested.get(peerDialogId2);
if (l2 == null || System.currentTimeMillis() - l2.longValue() > 240000) {
tL_messages_getPeerDialogs.peers.add(tL_inputDialogPeer2);
this.peerDialogsRequested.put(peerDialogId2, Long.valueOf(System.currentTimeMillis()));
}
}
if (tL_messages_getPeerDialogs.peers.isEmpty()) {
return;
}
getConnectionsManager().sendRequest(tL_messages_getPeerDialogs, new MessagesController$.ExternalSyntheticLambda324(this));
}
}
public void lambda$reloadDialogsReadValue$61(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
TLRPC.TL_messages_peerDialogs tL_messages_peerDialogs = (TLRPC.TL_messages_peerDialogs) tLObject;
ArrayList<TLRPC$Update> arrayList = new ArrayList<>();
for (int i = 0; i < tL_messages_peerDialogs.dialogs.size(); i++) {
TLRPC.Dialog dialog = (TLRPC.Dialog) tL_messages_peerDialogs.dialogs.get(i);
DialogObject.initDialog(dialog);
Integer num = (Integer) this.dialogs_read_inbox_max.get(Long.valueOf(dialog.id));
if (num == null) {
num = 0;
}
this.dialogs_read_inbox_max.put(Long.valueOf(dialog.id), Integer.valueOf(Math.max(dialog.read_inbox_max_id, num.intValue())));
if (num.intValue() == 0) {
if (dialog.peer.channel_id != 0) {
TLRPC.TL_updateReadChannelInbox tL_updateReadChannelInbox = new TLRPC.TL_updateReadChannelInbox();
tL_updateReadChannelInbox.channel_id = dialog.peer.channel_id;
tL_updateReadChannelInbox.max_id = dialog.read_inbox_max_id;
tL_updateReadChannelInbox.still_unread_count = dialog.unread_count;
arrayList.add(tL_updateReadChannelInbox);
} else {
TLRPC.TL_updateReadHistoryInbox tL_updateReadHistoryInbox = new TLRPC.TL_updateReadHistoryInbox();
tL_updateReadHistoryInbox.peer = dialog.peer;
tL_updateReadHistoryInbox.max_id = dialog.read_inbox_max_id;
arrayList.add(tL_updateReadHistoryInbox);
}
}
Integer num2 = (Integer) this.dialogs_read_outbox_max.get(Long.valueOf(dialog.id));
if (num2 == null) {
num2 = 0;
}
this.dialogs_read_outbox_max.put(Long.valueOf(dialog.id), Integer.valueOf(Math.max(dialog.read_outbox_max_id, num2.intValue())));
if (dialog.read_outbox_max_id > num2.intValue()) {
if (dialog.peer.channel_id != 0) {
TLRPC.TL_updateReadChannelOutbox tL_updateReadChannelOutbox = new TLRPC.TL_updateReadChannelOutbox();
tL_updateReadChannelOutbox.channel_id = dialog.peer.channel_id;
tL_updateReadChannelOutbox.max_id = dialog.read_outbox_max_id;
arrayList.add(tL_updateReadChannelOutbox);
} else {
TLRPC.TL_updateReadHistoryOutbox tL_updateReadHistoryOutbox = new TLRPC.TL_updateReadHistoryOutbox();
tL_updateReadHistoryOutbox.peer = dialog.peer;
tL_updateReadHistoryOutbox.max_id = dialog.read_outbox_max_id;
arrayList.add(tL_updateReadHistoryOutbox);
}
}
}
if (arrayList.isEmpty()) {
return;
}
processUpdateArray(arrayList, null, null, false, 0);
}
}
public TLRPC.ChannelParticipant getAdminInChannel(long uid, long chatId) {
LongSparseArray<TLRPC.ChannelParticipant> longSparseArray = this.channelAdmins.get(chatId);
if (longSparseArray == null) {
return null;
}
return longSparseArray.get(uid);
}
public String getAdminRank(long chatId, long uid) {
TLRPC.ChannelParticipant channelParticipant;
if (chatId == uid) {
return "";
}
LongSparseArray<TLRPC.ChannelParticipant> longSparseArray = this.channelAdmins.get(chatId);
if (longSparseArray == null || (channelParticipant = longSparseArray.get(uid)) == null) {
return null;
}
String str = channelParticipant.rank;
return str != null ? str : "";
}
public boolean isCreator(long chatId, long uid) {
TLRPC.ChannelParticipant channelParticipant;
LongSparseArray<TLRPC.ChannelParticipant> longSparseArray = this.channelAdmins.get(chatId);
return (longSparseArray == null || (channelParticipant = longSparseArray.get(uid)) == null || !(channelParticipant instanceof TLRPC.TL_channelParticipantCreator)) ? false : true;
}
public boolean isChannelAdminsLoaded(long chatId) {
return this.channelAdmins.get(chatId) != null;
}
public void loadChannelAdmins(long chatId, boolean cache) {
if ((SystemClock.elapsedRealtime() / 1000) - this.loadingChannelAdmins.get(chatId) < 60) {
return;
}
this.loadingChannelAdmins.put(chatId, (int) (SystemClock.elapsedRealtime() / 1000));
if (cache) {
getMessagesStorage().loadChannelAdmins(chatId);
return;
}
TLRPC.TL_channels_getParticipants tL_channels_getParticipants = new TLRPC.TL_channels_getParticipants();
tL_channels_getParticipants.channel = getInputChannel(chatId);
tL_channels_getParticipants.limit = 100;
tL_channels_getParticipants.filter = new TLRPC.TL_channelParticipantsAdmins();
getConnectionsManager().sendRequest(tL_channels_getParticipants, new MessagesController$.ExternalSyntheticLambda381(this, chatId));
}
public void lambda$loadChannelAdmins$62(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject instanceof TLRPC.TL_channels_channelParticipants) {
processLoadedAdminsResponse(j, (TLRPC.TL_channels_channelParticipants) tLObject);
}
}
public void processLoadedAdminsResponse(long chatId, TLRPC.TL_channels_channelParticipants participants) {
LongSparseArray<TLRPC.ChannelParticipant> longSparseArray = new LongSparseArray<>(((TLRPC.channels_ChannelParticipants) participants).participants.size());
for (int i = 0; i < ((TLRPC.channels_ChannelParticipants) participants).participants.size(); i++) {
TLRPC.ChannelParticipant channelParticipant = (TLRPC.ChannelParticipant) ((TLRPC.channels_ChannelParticipants) participants).participants.get(i);
longSparseArray.put(MessageObject.getPeerId(channelParticipant.peer), channelParticipant);
}
processLoadedChannelAdmins(longSparseArray, chatId, false);
}
public void processLoadedChannelAdmins(final LongSparseArray<TLRPC.ChannelParticipant> array, long chatId, boolean cache) {
if (!cache) {
getMessagesStorage().putChannelAdmins(chatId, array);
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda125(this, chatId, array, cache));
}
public void lambda$processLoadedChannelAdmins$63(long j, LongSparseArray longSparseArray, boolean z) {
this.channelAdmins.put(j, longSparseArray);
if (z) {
this.loadingChannelAdmins.delete(j);
loadChannelAdmins(j, false);
getNotificationCenter().postNotificationName(NotificationCenter.didLoadChatAdmins, new Object[]{Long.valueOf(j)});
}
}
public void loadFullChat(long chatId, int classGuid, boolean force) {
TLRPC.TL_channels_getFullChannel tL_messages_getFullChat;
boolean z = this.loadedFullChats.get(chatId, 0L) > 0;
if (this.loadingFullChats.contains(Long.valueOf(chatId))) {
return;
}
if (force || !z) {
this.loadingFullChats.add(Long.valueOf(chatId));
long j = -chatId;
TLRPC.Chat chat = getChat(Long.valueOf(chatId));
if (ChatObject.isChannel(chat)) {
tL_messages_getFullChat = new TLRPC.TL_channels_getFullChannel();
tL_messages_getFullChat.channel = getInputChannel(chat);
loadChannelAdmins(chatId, true ^ z);
} else {
tL_messages_getFullChat = new TLRPC.TL_messages_getFullChat();
((TLRPC.TL_messages_getFullChat) tL_messages_getFullChat).chat_id = chatId;
if (this.dialogs_read_inbox_max.get(Long.valueOf(j)) == null || this.dialogs_read_outbox_max.get(Long.valueOf(j)) == null) {
reloadDialogsReadValue(null, j);
}
}
int sendRequest = getConnectionsManager().sendRequest(tL_messages_getFullChat, new MessagesController$.ExternalSyntheticLambda398(this, j, chatId, chat, classGuid));
if (classGuid != 0) {
getConnectionsManager().bindRequestToGuid(sendRequest, classGuid);
}
}
}
public void lambda$loadFullChat$66(long j, long j2, TLRPC.Chat chat, int i, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC.TL_messages_chatFull tL_messages_chatFull = (TLRPC.TL_messages_chatFull) tLObject;
getMessagesStorage().putUsersAndChats(tL_messages_chatFull.users, tL_messages_chatFull.chats, true, true);
getMessagesStorage().updateChatInfo(tL_messages_chatFull.full_chat, false);
getStoriesController().updateStoriesFromFullPeer(j, tL_messages_chatFull.full_chat.stories);
ChatThemeController.getInstance(this.currentAccount).saveChatWallpaper(-j2, tL_messages_chatFull.full_chat.wallpaper);
if (ChatObject.isChannel(chat)) {
Integer num = (Integer) this.dialogs_read_inbox_max.get(Long.valueOf(j));
if (num == null) {
num = Integer.valueOf(getMessagesStorage().getDialogReadMax(false, j));
}
this.dialogs_read_inbox_max.put(Long.valueOf(j), Integer.valueOf(Math.max(tL_messages_chatFull.full_chat.read_inbox_max_id, num.intValue())));
if (tL_messages_chatFull.full_chat.read_inbox_max_id > num.intValue()) {
ArrayList<TLRPC$Update> arrayList = new ArrayList<>();
TLRPC.TL_updateReadChannelInbox tL_updateReadChannelInbox = new TLRPC.TL_updateReadChannelInbox();
tL_updateReadChannelInbox.channel_id = j2;
TLRPC.ChatFull chatFull = tL_messages_chatFull.full_chat;
tL_updateReadChannelInbox.max_id = chatFull.read_inbox_max_id;
tL_updateReadChannelInbox.still_unread_count = chatFull.unread_count;
arrayList.add(tL_updateReadChannelInbox);
processUpdateArray(arrayList, null, null, false, 0);
}
Integer num2 = (Integer) this.dialogs_read_outbox_max.get(Long.valueOf(j));
if (num2 == null) {
num2 = Integer.valueOf(getMessagesStorage().getDialogReadMax(true, j));
}
this.dialogs_read_outbox_max.put(Long.valueOf(j), Integer.valueOf(Math.max(tL_messages_chatFull.full_chat.read_outbox_max_id, num2.intValue())));
if (tL_messages_chatFull.full_chat.read_outbox_max_id > num2.intValue()) {
ArrayList<TLRPC$Update> arrayList2 = new ArrayList<>();
TLRPC.TL_updateReadChannelOutbox tL_updateReadChannelOutbox = new TLRPC.TL_updateReadChannelOutbox();
tL_updateReadChannelOutbox.channel_id = j2;
tL_updateReadChannelOutbox.max_id = tL_messages_chatFull.full_chat.read_outbox_max_id;
arrayList2.add(tL_updateReadChannelOutbox);
processUpdateArray(arrayList2, null, null, false, 0);
}
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda139(this, j2, tL_messages_chatFull, i, j));
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda225(this, tL_error, j2));
}
public void lambda$loadFullChat$64(long j, TLRPC.TL_messages_chatFull tL_messages_chatFull, int i, long j2) {
TLRPC.ChatFull chatFull = this.fullChats.get(j);
if (chatFull != null) {
tL_messages_chatFull.full_chat.inviterId = chatFull.inviterId;
}
this.fullChats.put(j, tL_messages_chatFull.full_chat);
long j3 = -j;
getTranslateController().updateDialogFull(j3);
applyDialogNotificationsSettings(j3, 0L, tL_messages_chatFull.full_chat.notify_settings);
for (int i2 = 0; i2 < tL_messages_chatFull.full_chat.bot_info.size(); i2++) {
getMediaDataController().putBotInfo(j3, (TLRPC.BotInfo) tL_messages_chatFull.full_chat.bot_info.get(i2));
}
int indexOfKey = this.blockePeers.indexOfKey(j3);
if (tL_messages_chatFull.full_chat.blocked) {
if (indexOfKey < 0) {
this.blockePeers.put(j3, 1);
getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad, new Object[0]);
}
} else if (indexOfKey >= 0) {
this.blockePeers.removeAt(indexOfKey);
getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad, new Object[0]);
}
this.exportedChats.put(j, tL_messages_chatFull.full_chat.exported_invite);
this.loadingFullChats.remove(Long.valueOf(j));
this.loadedFullChats.put(j, System.currentTimeMillis());
putUsers(tL_messages_chatFull.users, false);
putChats(tL_messages_chatFull.chats, false);
if (tL_messages_chatFull.full_chat.stickerset != null) {
getMediaDataController().getGroupStickerSetById(tL_messages_chatFull.full_chat.stickerset);
}
if (tL_messages_chatFull.full_chat.emojiset != null) {
getMediaDataController().getGroupStickerSetById(tL_messages_chatFull.full_chat.emojiset);
}
getNotificationCenter().postNotificationName(NotificationCenter.chatInfoDidLoad, new Object[]{tL_messages_chatFull.full_chat, Integer.valueOf(i), Boolean.FALSE, Boolean.TRUE});
TLRPC.Dialog dialog = this.dialogs_dict.get(j3);
if (dialog != null) {
TLRPC.ChatFull chatFull2 = tL_messages_chatFull.full_chat;
if ((chatFull2.flags & ConnectionsManager.RequestFlagListenAfterCancel) != 0) {
int i3 = dialog.folder_id;
int i4 = chatFull2.folder_id;
if (i3 != i4) {
dialog.folder_id = i4;
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
}
int i5 = dialog.ttl_period;
int i6 = tL_messages_chatFull.full_chat.ttl_period;
if (i5 != i6) {
dialog.ttl_period = i6;
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
boolean z = dialog.view_forum_as_messages;
boolean z2 = tL_messages_chatFull.full_chat.view_forum_as_messages;
if (z != z2) {
dialog.view_forum_as_messages = z2;
getMessagesStorage().setDialogViewThreadAsMessages(j2, tL_messages_chatFull.full_chat.view_forum_as_messages);
}
}
}
public void lambda$loadFullChat$65(TLRPC.TL_error tL_error, long j) {
checkChannelError(tL_error.text, j);
this.loadingFullChats.remove(Long.valueOf(j));
}
public void loadFullUser(final TLRPC$User user, int classGuid, boolean force) {
if (user == null || this.loadingFullUsers.contains(Long.valueOf(user.id))) {
return;
}
if (force || this.loadedFullUsers.get(user.id) <= 0) {
this.loadingFullUsers.add(Long.valueOf(user.id));
TLRPC.TL_users_getFullUser tL_users_getFullUser = new TLRPC.TL_users_getFullUser();
tL_users_getFullUser.id = getInputUser(user);
long j = user.id;
if (this.dialogs_read_inbox_max.get(Long.valueOf(j)) == null || this.dialogs_read_outbox_max.get(Long.valueOf(j)) == null) {
reloadDialogsReadValue(null, j);
}
getConnectionsManager().bindRequestToGuid(getConnectionsManager().sendRequest(tL_users_getFullUser, new MessagesController$.ExternalSyntheticLambda411(this, j, user, classGuid)), classGuid);
}
}
public void lambda$loadFullUser$69(long j, TLRPC$User tLRPC$User, int i, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC.TL_users_userFull tL_users_userFull = (TLRPC.TL_users_userFull) tLObject;
TLRPC.UserFull userFull = tL_users_userFull.full_user;
putUsers(tL_users_userFull.users, false);
putChats(tL_users_userFull.chats, false);
TLRPC.UserFull userFull2 = tL_users_userFull.full_user;
userFull2.user = getUser(Long.valueOf(userFull2.id));
getMessagesStorage().updateUserInfo(userFull, false);
getStoriesController().updateStoriesFromFullPeer(j, userFull.stories);
ChatThemeController chatThemeController = ChatThemeController.getInstance(this.currentAccount);
TLRPC.UserFull userFull3 = tL_users_userFull.full_user;
chatThemeController.saveChatWallpaper(userFull3.id, userFull3.wallpaper);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda254(this, userFull, tLRPC$User, i));
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda251(this, tLRPC$User));
}
public void lambda$loadFullUser$67(TLRPC.UserFull userFull, TLRPC$User tLRPC$User, int i) {
savePeerSettings(userFull.user.id, userFull.settings, false);
applyDialogNotificationsSettings(tLRPC$User.id, 0L, userFull.notify_settings);
TLRPC.BotInfo botInfo = userFull.bot_info;
if (botInfo instanceof TLRPC.TL_botInfo) {
botInfo.user_id = tLRPC$User.id;
getMediaDataController().putBotInfo(tLRPC$User.id, userFull.bot_info);
}
int indexOfKey = this.blockePeers.indexOfKey(tLRPC$User.id);
if (userFull.blocked) {
if (indexOfKey < 0) {
this.blockePeers.put(tLRPC$User.id, 1);
getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad, new Object[0]);
}
} else if (indexOfKey >= 0) {
this.blockePeers.removeAt(indexOfKey);
getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad, new Object[0]);
}
this.fullUsers.put(tLRPC$User.id, userFull);
getTranslateController().updateDialogFull(tLRPC$User.id);
this.loadingFullUsers.remove(Long.valueOf(tLRPC$User.id));
this.loadedFullUsers.put(tLRPC$User.id, System.currentTimeMillis());
String str = tLRPC$User.first_name + tLRPC$User.last_name + UserObject.getPublicUsername(tLRPC$User);
ArrayList<TLRPC$User> arrayList = new ArrayList<>();
arrayList.add(userFull.user);
putUsers(arrayList, false);
getMessagesStorage().putUsersAndChats(arrayList, (List) null, false, true);
if (!str.equals(userFull.user.first_name + userFull.user.last_name + UserObject.getPublicUsername(userFull.user))) {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_NAME)});
}
TLRPC.UserProfilePhoto userProfilePhoto = userFull.user.photo;
if (userProfilePhoto != null && userProfilePhoto.has_video) {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_AVATAR)});
}
TLRPC.BotInfo botInfo2 = userFull.bot_info;
if (botInfo2 instanceof TLRPC.TL_botInfo) {
botInfo2.user_id = userFull.id;
getNotificationCenter().postNotificationName(NotificationCenter.botInfoDidLoad, new Object[]{userFull.bot_info, Integer.valueOf(i)});
}
getNotificationCenter().postNotificationName(NotificationCenter.userInfoDidLoad, new Object[]{Long.valueOf(tLRPC$User.id), userFull});
TLRPC.Dialog dialog = this.dialogs_dict.get(tLRPC$User.id);
if (dialog != null) {
if ((userFull.flags & ConnectionsManager.RequestFlagListenAfterCancel) != 0) {
int i2 = dialog.folder_id;
int i3 = userFull.folder_id;
if (i2 != i3) {
dialog.folder_id = i3;
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
}
if ((userFull.flags & 16384) != 0) {
int i4 = dialog.ttl_period;
int i5 = userFull.ttl_period;
if (i4 != i5) {
dialog.ttl_period = i5;
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
}
}
}
public void lambda$loadFullUser$68(TLRPC$User tLRPC$User) {
this.loadingFullUsers.remove(Long.valueOf(tLRPC$User.id));
}
private void reloadMessages(ArrayList<Integer> mids, long dialogId, int mode) {
TLRPC.TL_channels_getMessages tL_messages_getMessages;
if (mids.isEmpty()) {
return;
}
boolean z = mode == 1;
ArrayList arrayList = new ArrayList();
TLRPC.Chat chat = DialogObject.isChatDialog(dialogId) ? getChat(Long.valueOf(-dialogId)) : null;
if (ChatObject.isChannel(chat)) {
tL_messages_getMessages = new TLRPC.TL_channels_getMessages();
tL_messages_getMessages.channel = getInputChannel(chat);
tL_messages_getMessages.id = arrayList;
} else {
tL_messages_getMessages = new TLRPC.TL_messages_getMessages();
((TLRPC.TL_messages_getMessages) tL_messages_getMessages).id = arrayList;
}
TLRPC.TL_channels_getMessages tL_channels_getMessages = tL_messages_getMessages;
ArrayList<Integer> arrayList2 = this.reloadingMessages.get(dialogId);
for (int i = 0; i < mids.size(); i++) {
Integer num = mids.get(i);
if (arrayList2 == null || !arrayList2.contains(num)) {
arrayList.add(num);
}
}
if (arrayList.isEmpty()) {
return;
}
if (arrayList2 == null) {
arrayList2 = new ArrayList<>();
this.reloadingMessages.put(dialogId, arrayList2);
}
arrayList2.addAll(arrayList);
getConnectionsManager().sendRequest(tL_channels_getMessages, new MessagesController$.ExternalSyntheticLambda414(this, dialogId, z, mode, arrayList));
}
public void lambda$reloadMessages$71(long j, boolean z, int i, ArrayList arrayList, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject;
LongSparseArray longSparseArray = new LongSparseArray();
for (int i2 = 0; i2 < messages_messages.users.size(); i2++) {
TLRPC$User tLRPC$User = (TLRPC$User) messages_messages.users.get(i2);
longSparseArray.put(tLRPC$User.id, tLRPC$User);
}
LongSparseArray longSparseArray2 = new LongSparseArray();
for (int i3 = 0; i3 < messages_messages.chats.size(); i3++) {
TLRPC.Chat chat = (TLRPC.Chat) messages_messages.chats.get(i3);
longSparseArray2.put(chat.id, chat);
}
Integer num = (Integer) this.dialogs_read_inbox_max.get(Long.valueOf(j));
if (num == null) {
num = Integer.valueOf(getMessagesStorage().getDialogReadMax(false, j));
this.dialogs_read_inbox_max.put(Long.valueOf(j), num);
}
Integer num2 = (Integer) this.dialogs_read_outbox_max.get(Long.valueOf(j));
if (num2 == null) {
num2 = Integer.valueOf(getMessagesStorage().getDialogReadMax(true, j));
this.dialogs_read_outbox_max.put(Long.valueOf(j), num2);
}
ArrayList arrayList2 = new ArrayList();
int i4 = 0;
while (i4 < messages_messages.messages.size()) {
TLRPC.Message message = (TLRPC.Message) messages_messages.messages.get(i4);
message.dialog_id = j;
if (!z) {
message.unread = (message.out ? num2 : num).intValue() < message.id;
}
Integer num3 = num;
ArrayList arrayList3 = arrayList2;
arrayList3.add(new MessageObject(this.currentAccount, message, longSparseArray, longSparseArray2, true, true));
i4++;
arrayList2 = arrayList3;
num = num3;
}
ImageLoader.saveMessagesThumbs(messages_messages.messages);
getMessagesStorage().putMessages(messages_messages, j, -1, 0, false, i, 0L);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda134(this, j, arrayList, arrayList2));
}
}
public void lambda$reloadMessages$70(long j, ArrayList arrayList, ArrayList arrayList2) {
ArrayList<Integer> arrayList3 = this.reloadingMessages.get(j);
if (arrayList3 != null) {
arrayList3.removeAll(arrayList);
if (arrayList3.isEmpty()) {
this.reloadingMessages.remove(j);
}
}
ArrayList<MessageObject> arrayList4 = this.dialogMessage.get(j);
if (arrayList4 != null) {
for (int i = 0; i < arrayList4.size(); i++) {
MessageObject messageObject = arrayList4.get(i);
int i2 = 0;
while (true) {
if (i2 < arrayList2.size()) {
MessageObject messageObject2 = (MessageObject) arrayList2.get(i2);
if (messageObject.getId() == messageObject2.getId()) {
arrayList4.set(i, messageObject2);
if (messageObject2.messageOwner.peer_id.channel_id == 0) {
MessageObject messageObject3 = this.dialogMessagesByIds.get(messageObject2.getId());
this.dialogMessagesByIds.remove(messageObject2.getId());
if (messageObject3 != null) {
this.dialogMessagesByIds.put(messageObject3.getId(), messageObject3);
}
}
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
} else {
i2++;
}
}
}
}
}
getNotificationCenter().postNotificationName(NotificationCenter.replaceMessagesObjects, new Object[]{Long.valueOf(j), arrayList2});
}
public void hidePeerSettingsBar(final long dialogId, TLRPC$User currentUser, TLRPC.Chat currentChat) {
if (currentUser == null && currentChat == null) {
return;
}
SharedPreferences.Editor edit = this.notificationsPreferences.edit();
edit.putInt("dialog_bar_vis3" + dialogId, 3);
edit.remove("dialog_bar_invite" + dialogId);
edit.commit();
if (DialogObject.isEncryptedDialog(dialogId)) {
return;
}
TLRPC.TL_messages_hidePeerSettingsBar tL_messages_hidePeerSettingsBar = new TLRPC.TL_messages_hidePeerSettingsBar();
if (currentUser != null) {
tL_messages_hidePeerSettingsBar.peer = getInputPeer(currentUser.id);
} else {
tL_messages_hidePeerSettingsBar.peer = getInputPeer(-currentChat.id);
}
getConnectionsManager().sendRequest(tL_messages_hidePeerSettingsBar, MessagesController$.ExternalSyntheticLambda452.INSTANCE);
}
public void reportSpam(final long dialogId, TLRPC$User currentUser, TLRPC.Chat currentChat, TLRPC.EncryptedChat currentEncryptedChat, boolean geo) {
if (currentUser == null && currentChat == null && currentEncryptedChat == null) {
return;
}
SharedPreferences.Editor edit = this.notificationsPreferences.edit();
edit.putInt("dialog_bar_vis3" + dialogId, 3);
edit.commit();
if (DialogObject.isEncryptedDialog(dialogId)) {
if (currentEncryptedChat == null || currentEncryptedChat.access_hash == 0) {
return;
}
TLRPC.TL_messages_reportEncryptedSpam tL_messages_reportEncryptedSpam = new TLRPC.TL_messages_reportEncryptedSpam();
TLRPC.TL_inputEncryptedChat tL_inputEncryptedChat = new TLRPC.TL_inputEncryptedChat();
tL_messages_reportEncryptedSpam.peer = tL_inputEncryptedChat;
tL_inputEncryptedChat.chat_id = currentEncryptedChat.id;
tL_inputEncryptedChat.access_hash = currentEncryptedChat.access_hash;
getConnectionsManager().sendRequest(tL_messages_reportEncryptedSpam, MessagesController$.ExternalSyntheticLambda462.INSTANCE, 2);
return;
}
if (geo) {
TLRPC.TL_account_reportPeer tL_account_reportPeer = new TLRPC.TL_account_reportPeer();
if (currentChat != null) {
tL_account_reportPeer.peer = getInputPeer(-currentChat.id);
} else if (currentUser != null) {
tL_account_reportPeer.peer = getInputPeer(currentUser.id);
}
tL_account_reportPeer.message = "";
tL_account_reportPeer.reason = new TLRPC.TL_inputReportReasonGeoIrrelevant();
getConnectionsManager().sendRequest(tL_account_reportPeer, MessagesController$.ExternalSyntheticLambda460.INSTANCE, 2);
return;
}
TLRPC.TL_messages_reportSpam tL_messages_reportSpam = new TLRPC.TL_messages_reportSpam();
if (currentChat != null) {
tL_messages_reportSpam.peer = getInputPeer(-currentChat.id);
} else if (currentUser != null) {
tL_messages_reportSpam.peer = getInputPeer(currentUser.id);
}
getConnectionsManager().sendRequest(tL_messages_reportSpam, MessagesController$.ExternalSyntheticLambda461.INSTANCE, 2);
}
private void savePeerSettings(long j, TLRPC.PeerSettings peerSettings, boolean z) {
if (peerSettings == null) {
return;
}
SharedPreferences.Editor edit = this.notificationsPreferences.edit();
if (peerSettings.business_bot_id != 0) {
edit.putLong("dialog_botid" + j, peerSettings.business_bot_id);
edit.putString("dialog_boturl" + j, peerSettings.business_bot_manage_url);
edit.putInt("dialog_botflags" + j, (peerSettings.business_bot_paused ? 1 : 0) + (peerSettings.business_bot_can_reply ? 2 : 0));
} else {
edit.remove("dialog_botid" + j).remove("dialog_boturl" + j).remove("dialog_botflags" + j);
}
if (this.notificationsPreferences.getInt("dialog_bar_vis3" + j, 0) == 3) {
edit.apply();
getNotificationCenter().postNotificationName(NotificationCenter.peerSettingsDidLoad, new Object[]{Long.valueOf(j)});
return;
}
boolean z2 = peerSettings.flags == 0;
if (BuildVars.LOGS_ENABLED) {
FileLog.d("peer settings loaded for " + j + " add = " + peerSettings.add_contact + " block = " + peerSettings.block_contact + " spam = " + peerSettings.report_spam + " share = " + peerSettings.share_contact + " geo = " + peerSettings.report_geo + " hide = " + z2 + " distance = " + peerSettings.geo_distance + " invite = " + peerSettings.invite_members);
}
edit.putInt("dialog_bar_vis3" + j, z2 ? 1 : 2);
edit.putBoolean("dialog_bar_share" + j, peerSettings.share_contact);
edit.putBoolean("dialog_bar_report" + j, peerSettings.report_spam);
edit.putBoolean("dialog_bar_add" + j, peerSettings.add_contact);
edit.putBoolean("dialog_bar_block" + j, peerSettings.block_contact);
edit.putBoolean("dialog_bar_exception" + j, peerSettings.need_contacts_exception);
edit.putBoolean("dialog_bar_location" + j, peerSettings.report_geo);
edit.putBoolean("dialog_bar_archived" + j, peerSettings.autoarchived);
edit.putBoolean("dialog_bar_invite" + j, peerSettings.invite_members);
edit.putString("dialog_bar_chat_with_admin_title" + j, peerSettings.request_chat_title);
edit.putBoolean("dialog_bar_chat_with_channel" + j, peerSettings.request_chat_broadcast);
edit.putInt("dialog_bar_chat_with_date" + j, peerSettings.request_chat_date);
if (this.notificationsPreferences.getInt("dialog_bar_distance" + j, -1) != -2) {
if ((peerSettings.flags & 64) != 0) {
edit.putInt("dialog_bar_distance" + j, peerSettings.geo_distance);
} else {
edit.remove("dialog_bar_distance" + j);
}
}
if (j == getUserConfig().getClientUserId()) {
peerSettings.business_bot_id = 1271266957L;
peerSettings.business_bot_manage_url = "https://telegram.org/";
}
edit.apply();
getNotificationCenter().postNotificationName(NotificationCenter.peerSettingsDidLoad, new Object[]{Long.valueOf(j)});
}
public void loadPeerSettings(TLRPC$User currentUser, TLRPC.Chat currentChat) {
long j;
if (currentUser == null && currentChat == null) {
return;
}
if (currentUser != null) {
j = currentUser.id;
} else {
j = -currentChat.id;
}
if (this.loadingPeerSettings.indexOfKey(j) >= 0) {
return;
}
this.loadingPeerSettings.put(j, Boolean.TRUE);
if (BuildVars.LOGS_ENABLED) {
FileLog.d("request spam button for " + j);
}
int i = this.notificationsPreferences.getInt("dialog_bar_vis3" + j, 0);
if (i == 1 || i == 3) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("dialog bar already hidden for " + j);
return;
}
return;
}
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
TLRPC.TL_messages_getPeerSettings tL_messages_getPeerSettings = new TLRPC.TL_messages_getPeerSettings();
if (currentUser != null) {
tL_messages_getPeerSettings.peer = getInputPeer(currentUser.id);
} else {
tL_messages_getPeerSettings.peer = getInputPeer(-currentChat.id);
}
getConnectionsManager().sendRequest(tL_messages_getPeerSettings, new MessagesController$.ExternalSyntheticLambda380(this, j));
}
}
public void lambda$loadPeerSettings$77(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda136(this, j, tLObject));
}
public void lambda$loadPeerSettings$76(long j, TLObject tLObject) {
this.loadingPeerSettings.remove(j);
if (tLObject != null) {
TLRPC.TL_messages_peerSettings tL_messages_peerSettings = (TLRPC.TL_messages_peerSettings) tLObject;
TLRPC.PeerSettings peerSettings = tL_messages_peerSettings.settings;
putUsers(tL_messages_peerSettings.users, false);
putChats(tL_messages_peerSettings.chats, false);
savePeerSettings(j, peerSettings, false);
}
}
public void processNewChannelDifferenceParams(int pts, int pts_count, long channelId) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("processNewChannelDifferenceParams pts = " + pts + " pts_count = " + pts_count + " channeldId = " + channelId);
}
int i = this.channelsPts.get(channelId);
if (i == 0) {
i = getMessagesStorage().getChannelPtsSync(channelId);
if (i == 0) {
i = 1;
}
this.channelsPts.put(channelId, i);
}
if (i + pts_count == pts) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("APPLY CHANNEL PTS");
}
this.channelsPts.put(channelId, pts);
getMessagesStorage().saveChannelPts(channelId, pts);
return;
}
if (i != pts) {
long j = this.updatesStartWaitTimeChannels.get(channelId);
if (this.gettingDifferenceChannels.get(channelId, Boolean.FALSE).booleanValue() || j == 0 || Math.abs(System.currentTimeMillis() - j) <= 1500) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("ADD CHANNEL UPDATE TO QUEUE pts = " + pts + " pts_count = " + pts_count);
}
if (j == 0) {
this.updatesStartWaitTimeChannels.put(channelId, System.currentTimeMillis());
}
TLRPC.Updates userActionUpdatesPts = new UserActionUpdatesPts((UserActionUpdatesPts-IA) null);
userActionUpdatesPts.pts = pts;
userActionUpdatesPts.pts_count = pts_count;
userActionUpdatesPts.chat_id = channelId;
ArrayList<TLRPC.Updates> arrayList = this.updatesQueueChannels.get(channelId);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.updatesQueueChannels.put(channelId, arrayList);
}
arrayList.add(userActionUpdatesPts);
return;
}
getChannelDifference(channelId);
}
}
public void processNewDifferenceParams(int seq, int pts, int date, int pts_count) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("processNewDifferenceParams seq = " + seq + " pts = " + pts + " date = " + date + " pts_count = " + pts_count);
}
if (pts != -1) {
if (getMessagesStorage().getLastPtsValue() + pts_count == pts) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("APPLY PTS");
}
getMessagesStorage().setLastPtsValue(pts);
getMessagesStorage().saveDiffParams(getMessagesStorage().getLastSeqValue(), getMessagesStorage().getLastPtsValue(), getMessagesStorage().getLastDateValue(), getMessagesStorage().getLastQtsValue());
} else if (getMessagesStorage().getLastPtsValue() != pts) {
if (this.gettingDifference || this.updatesStartWaitTimePts == 0 || Math.abs(System.currentTimeMillis() - this.updatesStartWaitTimePts) <= 1500) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("ADD UPDATE TO QUEUE pts = " + pts + " pts_count = " + pts_count);
}
if (this.updatesStartWaitTimePts == 0) {
this.updatesStartWaitTimePts = System.currentTimeMillis();
}
TLRPC.Updates userActionUpdatesPts = new UserActionUpdatesPts((UserActionUpdatesPts-IA) null);
userActionUpdatesPts.pts = pts;
userActionUpdatesPts.pts_count = pts_count;
this.updatesQueuePts.add(userActionUpdatesPts);
} else {
getDifference();
}
}
}
if (seq != -1) {
if (getMessagesStorage().getLastSeqValue() + 1 == seq) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("APPLY SEQ");
}
getMessagesStorage().setLastSeqValue(seq);
if (date != -1) {
getMessagesStorage().setLastDateValue(date);
}
getMessagesStorage().saveDiffParams(getMessagesStorage().getLastSeqValue(), getMessagesStorage().getLastPtsValue(), getMessagesStorage().getLastDateValue(), getMessagesStorage().getLastQtsValue());
return;
}
if (getMessagesStorage().getLastSeqValue() != seq) {
if (this.gettingDifference || this.updatesStartWaitTimeSeq == 0 || Math.abs(System.currentTimeMillis() - this.updatesStartWaitTimeSeq) <= 1500) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("ADD UPDATE TO QUEUE seq = " + seq);
}
if (this.updatesStartWaitTimeSeq == 0) {
this.updatesStartWaitTimeSeq = System.currentTimeMillis();
}
TLRPC.Updates userActionUpdatesSeq = new UserActionUpdatesSeq((UserActionUpdatesSeq-IA) null);
userActionUpdatesSeq.seq = seq;
this.updatesQueueSeq.add(userActionUpdatesSeq);
return;
}
getDifference();
}
}
}
public void didAddedNewTask(int minDate, long dialogId, SparseArray<ArrayList<Integer>> mids) {
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda72(this, minDate));
if (mids != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda124(this, dialogId, mids));
}
}
public void lambda$didAddedNewTask$78(int i) {
int i2;
if (!(this.currentDeletingTaskMids == null && this.currentDeletingTaskMediaMids == null && !this.gettingNewDeleteTask) && ((i2 = this.currentDeletingTaskTime) == 0 || i >= i2)) {
return;
}
getNewDeleteTask(null, null);
}
public void lambda$didAddedNewTask$79(long j, SparseArray sparseArray) {
getNotificationCenter().postNotificationName(NotificationCenter.didCreatedNewDeleteTask, new Object[]{Long.valueOf(j), sparseArray});
}
public void getNewDeleteTask(LongSparseArray<ArrayList<Integer>> oldTask, LongSparseArray<ArrayList<Integer>> oldTaskMedia) {
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda148(this, oldTask, oldTaskMedia));
}
public void lambda$getNewDeleteTask$80(LongSparseArray longSparseArray, LongSparseArray longSparseArray2) {
this.gettingNewDeleteTask = true;
getMessagesStorage().getNewTask(longSparseArray, longSparseArray2);
}
private boolean checkDeletingTask(boolean runnable) {
int i;
int currentTime = getConnectionsManager().getCurrentTime();
if ((this.currentDeletingTaskMids == null && this.currentDeletingTaskMediaMids == null) || (!runnable && ((i = this.currentDeletingTaskTime) == 0 || i > currentTime))) {
return false;
}
this.currentDeletingTaskTime = 0;
if (this.currentDeleteTaskRunnable != null && !runnable) {
Utilities.stageQueue.cancelRunnable(this.currentDeleteTaskRunnable);
}
this.currentDeleteTaskRunnable = null;
LongSparseArray<ArrayList<Integer>> longSparseArray = this.currentDeletingTaskMids;
LongSparseArray<ArrayList<Integer>> m2clone = longSparseArray != null ? longSparseArray.m2clone() : null;
LongSparseArray<ArrayList<Integer>> longSparseArray2 = this.currentDeletingTaskMediaMids;
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda147(this, m2clone, longSparseArray2 != null ? longSparseArray2.m2clone() : null));
return true;
}
public void lambda$checkDeletingTask$83(LongSparseArray longSparseArray, LongSparseArray longSparseArray2) {
long j;
ArrayList arrayList;
boolean z = true;
if (longSparseArray != null) {
int size = longSparseArray.size();
for (int i = 0; i < size; i++) {
ArrayList<Integer> arrayList2 = (ArrayList) longSparseArray.valueAt(i);
deleteMessages(arrayList2, null, null, longSparseArray.keyAt(i), 0, true, 0, !arrayList2.isEmpty() && arrayList2.get(0).intValue() > 0);
}
}
if (longSparseArray2 != null) {
boolean z2 = SecretMediaViewer.hasInstance() && SecretMediaViewer.getInstance().isVisible();
MessageObject currentMessageObject = z2 ? SecretMediaViewer.getInstance().getCurrentMessageObject() : null;
int size2 = longSparseArray2.size();
int i2 = 0;
while (i2 < size2) {
long keyAt = longSparseArray2.keyAt(i2);
ArrayList arrayList3 = (ArrayList) longSparseArray2.valueAt(i2);
if (z2 && currentMessageObject != null && currentMessageObject.currentAccount == this.currentAccount && currentMessageObject.getDialogId() == keyAt && arrayList3.contains(Integer.valueOf(currentMessageObject.getId()))) {
int id = currentMessageObject.getId();
arrayList3.remove(Integer.valueOf(id));
currentMessageObject.forceExpired = z;
j = keyAt;
arrayList = arrayList3;
SecretMediaViewer.getInstance().setOnClose(new MessagesController$.ExternalSyntheticLambda118(this, createDeleteShowOnceTask(keyAt, id), keyAt, id));
getNotificationCenter().postNotificationName(NotificationCenter.updateMessageMedia, new Object[]{currentMessageObject.messageOwner});
} else {
j = keyAt;
arrayList = arrayList3;
}
if (!arrayList.isEmpty()) {
getMessagesStorage().emptyMessagesMedia(j, arrayList);
}
i2++;
z = true;
}
}
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda150(this, longSparseArray, longSparseArray2));
}
public void lambda$checkDeletingTask$82(LongSparseArray longSparseArray, LongSparseArray longSparseArray2) {
getNewDeleteTask(longSparseArray, longSparseArray2);
this.currentDeletingTaskTime = 0;
this.currentDeletingTaskMids = null;
this.currentDeletingTaskMediaMids = null;
}
public void processLoadedDeleteTask(int taskTime, LongSparseArray<ArrayList<Integer>> task, LongSparseArray<ArrayList<Integer>> taskMedia) {
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda151(this, task, taskMedia, taskTime));
}
public void lambda$processLoadedDeleteTask$85(LongSparseArray longSparseArray, LongSparseArray longSparseArray2, int i) {
this.gettingNewDeleteTask = false;
if (longSparseArray != null || longSparseArray2 != null) {
this.currentDeletingTaskTime = i;
this.currentDeletingTaskMids = longSparseArray;
this.currentDeletingTaskMediaMids = longSparseArray2;
if (this.currentDeleteTaskRunnable != null) {
Utilities.stageQueue.cancelRunnable(this.currentDeleteTaskRunnable);
this.currentDeleteTaskRunnable = null;
}
if (checkDeletingTask(false)) {
return;
}
this.currentDeleteTaskRunnable = new MessagesController$.ExternalSyntheticLambda70(this);
Utilities.stageQueue.postRunnable(this.currentDeleteTaskRunnable, Math.abs(getConnectionsManager().getCurrentTime() - this.currentDeletingTaskTime) * 1000);
return;
}
this.currentDeletingTaskTime = 0;
this.currentDeletingTaskMids = null;
this.currentDeletingTaskMediaMids = null;
}
public void lambda$processLoadedDeleteTask$84() {
checkDeletingTask(true);
}
public DialogPhotos getDialogPhotos(long dialogId) {
DialogPhotos dialogPhotos = this.dialogPhotos.get(dialogId);
if (dialogPhotos != null) {
return dialogPhotos;
}
LongSparseArray<DialogPhotos> longSparseArray = this.dialogPhotos;
DialogPhotos dialogPhotos2 = new DialogPhotos(this, dialogId);
longSparseArray.put(dialogId, dialogPhotos2);
return dialogPhotos2;
}
public void blockPeer(long id) {
TLRPC.Chat chat;
TLRPC$User tLRPC$User = null;
if (id > 0) {
TLRPC$User user = getUser(Long.valueOf(id));
if (user == null) {
return;
}
chat = null;
tLRPC$User = user;
} else {
chat = getChat(Long.valueOf(-id));
if (chat == null) {
return;
}
}
if (this.blockePeers.indexOfKey(id) >= 0) {
return;
}
this.blockePeers.put(id, 1);
if (tLRPC$User != null) {
if (tLRPC$User.bot) {
getMediaDataController().removeInline(id);
} else {
getMediaDataController().removePeer(id);
}
}
int i = this.totalBlockedCount;
if (i >= 0) {
this.totalBlockedCount = i + 1;
}
getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad, new Object[0]);
TLRPC.TL_contacts_block tL_contacts_block = new TLRPC.TL_contacts_block();
if (tLRPC$User != null) {
tL_contacts_block.id = getInputPeer(tLRPC$User);
} else {
tL_contacts_block.id = getInputPeer(chat);
}
getConnectionsManager().sendRequest(tL_contacts_block, MessagesController$.ExternalSyntheticLambda456.INSTANCE);
}
public void setParticipantBannedRole(long chatId, TLRPC$User user, TLRPC.Chat chat, TLRPC.TL_chatBannedRights rights, boolean isChannel, BaseFragment parentFragment) {
setParticipantBannedRole(chatId, user, chat, rights, isChannel, parentFragment, null);
}
public void setParticipantBannedRole(long chatId, TLRPC$User user, TLRPC.Chat chat, TLRPC.TL_chatBannedRights rights, boolean isChannel, BaseFragment parentFragment, Runnable whenDone) {
if ((user == null && chat == null) || rights == null) {
return;
}
TLRPC.TL_channels_editBanned tL_channels_editBanned = new TLRPC.TL_channels_editBanned();
tL_channels_editBanned.channel = getInputChannel(chatId);
if (user != null) {
tL_channels_editBanned.participant = getInputPeer(user);
} else {
tL_channels_editBanned.participant = getInputPeer(chat);
}
tL_channels_editBanned.banned_rights = rights;
getConnectionsManager().sendRequest(tL_channels_editBanned, new MessagesController$.ExternalSyntheticLambda402(this, chatId, whenDone, parentFragment, tL_channels_editBanned, isChannel));
}
public void lambda$setParticipantBannedRole$89(long j, Runnable runnable, BaseFragment baseFragment, TLRPC.TL_channels_editBanned tL_channels_editBanned, boolean z, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
processUpdates((TLRPC.Updates) tLObject, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda103(this, j), 1000L);
if (runnable != null) {
AndroidUtilities.runOnUIThread(runnable);
return;
}
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda230(this, tL_error, baseFragment, tL_channels_editBanned, z));
}
public void lambda$setParticipantBannedRole$87(long j) {
loadFullChat(j, 0, true);
}
public void lambda$setParticipantBannedRole$88(TLRPC.TL_error tL_error, BaseFragment baseFragment, TLRPC.TL_channels_editBanned tL_channels_editBanned, boolean z) {
AlertsCreator.processError(this.currentAccount, tL_error, baseFragment, tL_channels_editBanned, new Object[]{Boolean.valueOf(z)});
}
public void setChannelSlowMode(long chatId, int seconds) {
TLRPC.TL_channels_toggleSlowMode tL_channels_toggleSlowMode = new TLRPC.TL_channels_toggleSlowMode();
tL_channels_toggleSlowMode.seconds = seconds;
tL_channels_toggleSlowMode.channel = getInputChannel(chatId);
getConnectionsManager().sendRequest(tL_channels_toggleSlowMode, new MessagesController$.ExternalSyntheticLambda385(this, chatId));
}
public void lambda$setChannelSlowMode$91(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
getMessagesController().processUpdates((TLRPC.Updates) tLObject, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda97(this, j), 1000L);
}
}
public void lambda$setChannelSlowMode$90(long j) {
loadFullChat(j, 0, true);
}
public void setBoostsToUnblockRestrictions(long chatId, int boosts) {
TLRPC.TL_channels_setBoostsToUnblockRestrictions tL_channels_setBoostsToUnblockRestrictions = new TLRPC.TL_channels_setBoostsToUnblockRestrictions();
tL_channels_setBoostsToUnblockRestrictions.boosts = boosts;
tL_channels_setBoostsToUnblockRestrictions.channel = getInputChannel(chatId);
getConnectionsManager().sendRequest(tL_channels_setBoostsToUnblockRestrictions, new MessagesController$.ExternalSyntheticLambda387(this, chatId));
}
public void lambda$setBoostsToUnblockRestrictions$93(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
getMessagesController().processUpdates((TLRPC.Updates) tLObject, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda101(this, j), 1000L);
}
}
public void lambda$setBoostsToUnblockRestrictions$92(long j) {
loadFullChat(j, 0, true);
}
public void setDefaultBannedRole(long chatId, TLRPC.TL_chatBannedRights rights, boolean isChannel, BaseFragment parentFragment) {
if (rights == null) {
return;
}
TLRPC.TL_messages_editChatDefaultBannedRights tL_messages_editChatDefaultBannedRights = new TLRPC.TL_messages_editChatDefaultBannedRights();
tL_messages_editChatDefaultBannedRights.peer = getInputPeer(-chatId);
tL_messages_editChatDefaultBannedRights.banned_rights = rights;
getConnectionsManager().sendRequest(tL_messages_editChatDefaultBannedRights, new MessagesController$.ExternalSyntheticLambda413(this, chatId, parentFragment, tL_messages_editChatDefaultBannedRights, isChannel));
}
public void lambda$setDefaultBannedRole$96(long j, BaseFragment baseFragment, TLRPC.TL_messages_editChatDefaultBannedRights tL_messages_editChatDefaultBannedRights, boolean z, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
processUpdates((TLRPC.Updates) tLObject, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda95(this, j), 1000L);
} else {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda234(this, tL_error, baseFragment, tL_messages_editChatDefaultBannedRights, z));
}
}
public void lambda$setDefaultBannedRole$94(long j) {
loadFullChat(j, 0, true);
}
public void lambda$setDefaultBannedRole$95(TLRPC.TL_error tL_error, BaseFragment baseFragment, TLRPC.TL_messages_editChatDefaultBannedRights tL_messages_editChatDefaultBannedRights, boolean z) {
AlertsCreator.processError(this.currentAccount, tL_error, baseFragment, tL_messages_editChatDefaultBannedRights, new Object[]{Boolean.valueOf(z)});
}
public void setUserAdminRole(long chatId, TLRPC$User user, TLRPC.TL_chatAdminRights rights, String rank, boolean isChannel, BaseFragment parentFragment, boolean addingNew, boolean forceAdmin, String botHash, Runnable onSuccess) {
setUserAdminRole(chatId, user, rights, rank, isChannel, parentFragment, addingNew, forceAdmin, botHash, onSuccess, null);
}
public void setUserAdminRole(long chatId, TLRPC$User user, TLRPC.TL_chatAdminRights rights, String rank, boolean isChannel, BaseFragment parentFragment, boolean addingNew, boolean forceAdmin, String botHash, Runnable onSuccess, ErrorDelegate onError) {
if (user == null || rights == null) {
return;
}
TLRPC.Chat chat = getChat(Long.valueOf(chatId));
if (ChatObject.isChannel(chat)) {
TLRPC.TL_channels_editAdmin tL_channels_editAdmin = new TLRPC.TL_channels_editAdmin();
tL_channels_editAdmin.channel = getInputChannel(chat);
tL_channels_editAdmin.user_id = getInputUser(user);
tL_channels_editAdmin.admin_rights = rights;
tL_channels_editAdmin.rank = rank;
MessagesController$.ExternalSyntheticLambda401 externalSyntheticLambda401 = new MessagesController$.ExternalSyntheticLambda401(this, chatId, onSuccess, chat, user, onError, parentFragment, tL_channels_editAdmin, isChannel);
if (!user.bot && addingNew) {
addUserToChat(chatId, user, 0, botHash, parentFragment, true, new MessagesController$.ExternalSyntheticLambda221(this, tL_channels_editAdmin, externalSyntheticLambda401), onError);
return;
} else {
getConnectionsManager().sendRequest(tL_channels_editAdmin, externalSyntheticLambda401);
return;
}
}
TLRPC.TL_messages_editChatAdmin tL_messages_editChatAdmin = new TLRPC.TL_messages_editChatAdmin();
tL_messages_editChatAdmin.chat_id = chatId;
tL_messages_editChatAdmin.user_id = getInputUser(user);
tL_messages_editChatAdmin.is_admin = forceAdmin || rights.change_info || rights.delete_messages || rights.ban_users || rights.invite_users || rights.pin_messages || rights.add_admins || rights.manage_call;
MessagesController$.ExternalSyntheticLambda403 externalSyntheticLambda403 = new MessagesController$.ExternalSyntheticLambda403(this, chatId, onSuccess, parentFragment, tL_messages_editChatAdmin, onError);
if (tL_messages_editChatAdmin.is_admin || addingNew || !TextUtils.isEmpty(botHash)) {
addUserToChat(chatId, user, 0, botHash, parentFragment, true, new MessagesController$.ExternalSyntheticLambda238(this, tL_messages_editChatAdmin, externalSyntheticLambda403), onError);
} else {
getConnectionsManager().sendRequest(tL_messages_editChatAdmin, externalSyntheticLambda403);
}
}
public void lambda$setUserAdminRole$101(long j, Runnable runnable, TLRPC.Chat chat, TLRPC$User tLRPC$User, ErrorDelegate errorDelegate, BaseFragment baseFragment, TLRPC.TL_channels_editAdmin tL_channels_editAdmin, boolean z, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
processUpdates((TLRPC.Updates) tLObject, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda127(this, j, runnable), 1000L);
} else {
if ("USER_PRIVACY_RESTRICTED".equals(tL_error.text) && ChatObject.canUserDoAdminAction(chat, 3)) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda253(this, tLRPC$User, chat, errorDelegate, tL_error));
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda229(this, tL_error, baseFragment, tL_channels_editAdmin, z));
if (errorDelegate != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda29(errorDelegate, tL_error));
}
}
}
public void lambda$setUserAdminRole$97(long j, Runnable runnable) {
loadFullChat(j, 0, true);
if (runnable != null) {
runnable.run();
}
}
public void lambda$setUserAdminRole$98(TLRPC$User tLRPC$User, TLRPC.Chat chat, ErrorDelegate errorDelegate, TLRPC.TL_error tL_error) {
BaseFragment lastFragment = LaunchActivity.getLastFragment();
if (lastFragment != null && lastFragment.getParentActivity() != null) {
LimitReachedBottomSheet limitReachedBottomSheet = new LimitReachedBottomSheet(lastFragment, lastFragment.getParentActivity(), 11, this.currentAccount, (Theme.ResourcesProvider) null);
ArrayList arrayList = new ArrayList();
arrayList.add(tLRPC$User);
limitReachedBottomSheet.setRestrictedUsers(chat, arrayList, (ArrayList) null, (ArrayList) null);
limitReachedBottomSheet.show();
}
errorDelegate.run(tL_error);
}
public void lambda$setUserAdminRole$99(TLRPC.TL_error tL_error, BaseFragment baseFragment, TLRPC.TL_channels_editAdmin tL_channels_editAdmin, boolean z) {
AlertsCreator.processError(this.currentAccount, tL_error, baseFragment, tL_channels_editAdmin, new Object[]{Boolean.valueOf(z)});
}
public void lambda$setUserAdminRole$102(TLRPC.TL_channels_editAdmin tL_channels_editAdmin, RequestDelegate requestDelegate) {
getConnectionsManager().sendRequest(tL_channels_editAdmin, requestDelegate);
}
public void lambda$setUserAdminRole$106(long j, Runnable runnable, BaseFragment baseFragment, TLRPC.TL_messages_editChatAdmin tL_messages_editChatAdmin, ErrorDelegate errorDelegate, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda126(this, j, runnable), 1000L);
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda233(this, tL_error, baseFragment, tL_messages_editChatAdmin));
if (errorDelegate != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda30(errorDelegate, tL_error));
}
}
public void lambda$setUserAdminRole$103(long j, Runnable runnable) {
loadFullChat(j, 0, true);
if (runnable != null) {
runnable.run();
}
}
public void lambda$setUserAdminRole$104(TLRPC.TL_error tL_error, BaseFragment baseFragment, TLRPC.TL_messages_editChatAdmin tL_messages_editChatAdmin) {
AlertsCreator.processError(this.currentAccount, tL_error, baseFragment, tL_messages_editChatAdmin, new Object[]{Boolean.FALSE});
}
public void lambda$setUserAdminRole$107(TLRPC.TL_messages_editChatAdmin tL_messages_editChatAdmin, RequestDelegate requestDelegate) {
getConnectionsManager().sendRequest(tL_messages_editChatAdmin, requestDelegate);
}
public void unblockPeer(long id) {
unblockPeer(id, null);
}
public void unblockPeer(long id, Runnable callback) {
TLRPC.Chat chat;
TLRPC.TL_contacts_unblock tL_contacts_unblock = new TLRPC.TL_contacts_unblock();
TLRPC$User tLRPC$User = null;
if (id > 0) {
TLRPC$User user = getUser(Long.valueOf(id));
if (user == null) {
return;
}
chat = null;
tLRPC$User = user;
} else {
chat = getChat(Long.valueOf(-id));
if (chat == null) {
return;
}
}
this.totalBlockedCount--;
this.blockePeers.delete(id);
if (tLRPC$User != null) {
tL_contacts_unblock.id = getInputPeer(tLRPC$User);
} else {
tL_contacts_unblock.id = getInputPeer(chat);
}
getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad, new Object[0]);
getConnectionsManager().sendRequest(tL_contacts_unblock, new MessagesController$.ExternalSyntheticLambda320(callback));
}
public static void lambda$unblockPeer$109(Runnable runnable, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda27(runnable));
}
public static void lambda$unblockPeer$108(Runnable runnable) {
if (runnable != null) {
runnable.run();
}
}
public void getBlockedPeers(boolean reset) {
if (!getUserConfig().isClientActivated() || this.loadingBlockedPeers) {
return;
}
this.loadingBlockedPeers = true;
TLRPC.TL_contacts_getBlocked tL_contacts_getBlocked = new TLRPC.TL_contacts_getBlocked();
tL_contacts_getBlocked.offset = reset ? 0 : this.blockePeers.size();
tL_contacts_getBlocked.limit = reset ? 20 : 100;
getConnectionsManager().sendRequest(tL_contacts_getBlocked, new MessagesController$.ExternalSyntheticLambda445(this, reset, tL_contacts_getBlocked));
}
public void lambda$getBlockedPeers$111(boolean z, TLRPC.TL_contacts_getBlocked tL_contacts_getBlocked, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda205(this, tLObject, z, tL_contacts_getBlocked));
}
public void lambda$getBlockedPeers$110(TLObject tLObject, boolean z, TLRPC.TL_contacts_getBlocked tL_contacts_getBlocked) {
if (tLObject != null) {
TLRPC.contacts_Blocked contacts_blocked = (TLRPC.contacts_Blocked) tLObject;
putUsers(contacts_blocked.users, false);
putChats(contacts_blocked.chats, false);
getMessagesStorage().putUsersAndChats(contacts_blocked.users, contacts_blocked.chats, true, true);
if (z) {
this.blockePeers.clear();
}
this.totalBlockedCount = Math.max(contacts_blocked.count, contacts_blocked.blocked.size());
this.blockedEndReached = contacts_blocked.blocked.size() < tL_contacts_getBlocked.limit;
int size = contacts_blocked.blocked.size();
for (int i = 0; i < size; i++) {
this.blockePeers.put(MessageObject.getPeerId(((TLRPC.TL_peerBlocked) contacts_blocked.blocked.get(i)).peer_id), 1);
}
this.loadingBlockedPeers = false;
getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad, new Object[0]);
if (z || this.blockedEndReached || !PlusSettings.getIgnoreBlocked()) {
return;
}
getBlockedPeers(false);
}
}
public void deleteUserPhoto(TLRPC.InputPhoto photo) {
TLRPC.Photo photo2;
long clientUserId = getUserConfig().getClientUserId();
if (photo == null) {
DialogPhotos dialogPhotos = getDialogPhotos(clientUserId);
if (dialogPhotos != null && dialogPhotos.photos.size() > 0 && (photo2 = (TLRPC.Photo) dialogPhotos.photos.get(0)) != null) {
dialogPhotos.removePhoto(photo2.id);
}
TLRPC.TL_photos_updateProfilePhoto tL_photos_updateProfilePhoto = new TLRPC.TL_photos_updateProfilePhoto();
tL_photos_updateProfilePhoto.id = new TLRPC.TL_inputPhotoEmpty();
TLRPC$User user = getUser(Long.valueOf(getUserConfig().getClientUserId()));
if (user == null) {
user = getUserConfig().getCurrentUser();
}
if (user == null) {
return;
}
if (user.photo != null) {
getMessagesStorage().clearUserPhoto(user.id, user.photo.photo_id);
}
getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged, new Object[0]);
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_ALL)});
getConnectionsManager().sendRequest(tL_photos_updateProfilePhoto, new MessagesController$.ExternalSyntheticLambda370(this, clientUserId));
return;
}
TLRPC.TL_photos_deletePhotos tL_photos_deletePhotos = new TLRPC.TL_photos_deletePhotos();
tL_photos_deletePhotos.id.add(photo);
getDialogPhotos(clientUserId).removePhoto(photo.id);
getConnectionsManager().sendRequest(tL_photos_deletePhotos, MessagesController$.ExternalSyntheticLambda451.INSTANCE);
}
public void lambda$deleteUserPhoto$113(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda198(this, tLObject, j));
}
}
public void lambda$deleteUserPhoto$112(TLObject tLObject, long j) {
TLRPC.TL_photos_photo tL_photos_photo = (TLRPC.TL_photos_photo) tLObject;
TLRPC$User user = getUser(Long.valueOf(getUserConfig().getClientUserId()));
if (user == null) {
user = getUserConfig().getCurrentUser();
putUser(user, false);
} else {
getUserConfig().setCurrentUser(user);
}
if (user == null) {
return;
}
ArrayList arrayList = new ArrayList();
arrayList.add(user);
getMessagesStorage().putUsersAndChats(arrayList, (List) null, false, true);
if (tL_photos_photo.photo instanceof TLRPC.TL_photo) {
TLRPC.TL_userProfilePhoto tL_userProfilePhoto = new TLRPC.TL_userProfilePhoto();
user.photo = tL_userProfilePhoto;
((TLRPC.UserProfilePhoto) tL_userProfilePhoto).has_video = !tL_photos_photo.photo.video_sizes.isEmpty();
TLRPC.UserProfilePhoto userProfilePhoto = user.photo;
TLRPC.Photo photo = tL_photos_photo.photo;
userProfilePhoto.photo_id = photo.id;
userProfilePhoto.photo_small = FileLoader.getClosestPhotoSizeWithSize(photo.sizes, 150).location;
user.photo.photo_big = FileLoader.getClosestPhotoSizeWithSize(tL_photos_photo.photo.sizes, 800).location;
user.photo.dc_id = tL_photos_photo.photo.dc_id;
} else {
user.photo = new TLRPC.TL_userProfilePhotoEmpty();
}
TLRPC.UserFull userFull = getUserFull(j);
userFull.profile_photo = tL_photos_photo.photo;
getMessagesStorage().updateUserInfo(userFull, false);
getUserConfig().getCurrentUser().photo = user.photo;
putUser(user, false);
getNotificationCenter().postNotificationName(NotificationCenter.mainUserInfoChanged, new Object[0]);
NotificationCenter notificationCenter = getNotificationCenter();
int i = NotificationCenter.updateInterfaces;
notificationCenter.postNotificationName(i, new Object[]{Integer.valueOf(UPDATE_MASK_ALL)});
getNotificationCenter().postNotificationName(i, new Object[]{Integer.valueOf(UPDATE_MASK_AVATAR)});
getUserConfig().saveConfig(true);
}
public void uploadAndApplyUserAvatar(TLRPC.FileLocation location) {
if (location == null) {
return;
}
this.uploadingAvatar = FileLoader.getDirectory(4) + "/" + location.volume_id + "_" + location.local_id + ".jpg";
getFileLoader().uploadFile(this.uploadingAvatar, false, true, ConnectionsManager.FileTypePhoto);
}
public void saveTheme(Theme.ThemeInfo themeInfo, Theme.ThemeAccent accent, boolean night, boolean unsave) {
TLRPC.TL_theme tL_theme = accent != null ? accent.info : themeInfo.info;
if (tL_theme != null) {
TLRPC.TL_account_saveTheme tL_account_saveTheme = new TLRPC.TL_account_saveTheme();
TLRPC.TL_inputTheme tL_inputTheme = new TLRPC.TL_inputTheme();
tL_inputTheme.id = tL_theme.id;
tL_inputTheme.access_hash = tL_theme.access_hash;
tL_account_saveTheme.theme = tL_inputTheme;
tL_account_saveTheme.unsave = unsave;
getConnectionsManager().sendRequest(tL_account_saveTheme, MessagesController$.ExternalSyntheticLambda471.INSTANCE);
getConnectionsManager().resumeNetworkMaybe();
}
if (unsave) {
return;
}
installTheme(themeInfo, accent, night);
}
public void installTheme(Theme.ThemeInfo themeInfo, Theme.ThemeAccent accent, boolean night) {
TLRPC.TL_theme tL_theme = accent != null ? accent.info : themeInfo.info;
String str = accent != null ? accent.patternSlug : themeInfo.slug;
boolean z = accent == null && themeInfo.isBlured;
boolean z2 = accent != null ? accent.patternMotion : themeInfo.isMotion;
TLRPC.TL_account_installTheme tL_account_installTheme = new TLRPC.TL_account_installTheme();
tL_account_installTheme.dark = night;
if (tL_theme != null) {
tL_account_installTheme.format = "android";
TLRPC.TL_inputTheme tL_inputTheme = new TLRPC.TL_inputTheme();
tL_inputTheme.id = tL_theme.id;
tL_inputTheme.access_hash = tL_theme.access_hash;
tL_account_installTheme.theme = tL_inputTheme;
tL_account_installTheme.flags |= 2;
}
getConnectionsManager().sendRequest(tL_account_installTheme, MessagesController$.ExternalSyntheticLambda465.INSTANCE);
if (TextUtils.isEmpty(str)) {
return;
}
TLRPC.TL_account_installWallPaper tL_account_installWallPaper = new TLRPC.TL_account_installWallPaper();
TLRPC.TL_inputWallPaperSlug tL_inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug();
tL_inputWallPaperSlug.slug = str;
tL_account_installWallPaper.wallpaper = tL_inputWallPaperSlug;
TLRPC.TL_wallPaperSettings tL_wallPaperSettings = new TLRPC.TL_wallPaperSettings();
tL_account_installWallPaper.settings = tL_wallPaperSettings;
((TLRPC.WallPaperSettings) tL_wallPaperSettings).blur = z;
((TLRPC.WallPaperSettings) tL_wallPaperSettings).motion = z2;
getConnectionsManager().sendRequest(tL_account_installWallPaper, MessagesController$.ExternalSyntheticLambda467.INSTANCE);
}
public void saveThemeToServer(Theme.ThemeInfo themeInfo, Theme.ThemeAccent accent) {
String str;
File file;
if (themeInfo == null) {
return;
}
if (accent != 0) {
str = accent.saveToFile().getAbsolutePath();
file = accent.getPathToWallpaper();
} else {
str = themeInfo.pathToFile;
file = null;
}
String str2 = str;
File file2 = file;
if (str2 == null || this.uploadingThemes.containsKey(str2)) {
return;
}
this.uploadingThemes.put(str2, accent != 0 ? accent : themeInfo);
Utilities.globalQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda154(this, str2, file2, accent, themeInfo));
}
public void lambda$saveThemeToServer$119(String str, File file, Theme.ThemeAccent themeAccent, Theme.ThemeInfo themeInfo) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda155(this, Theme.createThemePreviewImage(str, file != null ? file.getAbsolutePath() : null, themeAccent), str, themeAccent, themeInfo));
}
public void lambda$saveThemeToServer$118(String str, String str2, Theme.ThemeAccent themeAccent, Theme.ThemeInfo themeInfo) {
if (str == null) {
this.uploadingThemes.remove(str2);
return;
}
this.uploadingThemes.put(str, themeAccent != null ? themeAccent : themeInfo);
if (themeAccent == null) {
themeInfo.uploadingFile = str2;
themeInfo.uploadingThumb = str;
} else {
themeAccent.uploadingFile = str2;
themeAccent.uploadingThumb = str;
}
getFileLoader().uploadFile(str2, false, true, ConnectionsManager.FileTypeFile);
getFileLoader().uploadFile(str, false, true, ConnectionsManager.FileTypePhoto);
}
public void saveWallpaperToServer(java.io.File r8, org.telegram.ui.ActionBar.Theme.OverrideWallpaperInfo r9, boolean r10, long r11) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.saveWallpaperToServer(java.io.File, org.telegram.ui.ActionBar.Theme$OverrideWallpaperInfo, boolean, long):void");
}
public void lambda$saveWallpaperToServer$120(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
getMessagesStorage().removePendingTask(j);
}
public static TLRPC.TL_wallPaperSettings getWallpaperSetting(Theme.OverrideWallpaperInfo info) {
TLRPC.TL_wallPaperSettings tL_wallPaperSettings = new TLRPC.TL_wallPaperSettings();
((TLRPC.WallPaperSettings) tL_wallPaperSettings).blur = info.isBlurred;
((TLRPC.WallPaperSettings) tL_wallPaperSettings).motion = info.isMotion;
int i = info.color;
if (i != 0) {
((TLRPC.WallPaperSettings) tL_wallPaperSettings).background_color = i & 16777215;
int i2 = ((TLRPC.WallPaperSettings) tL_wallPaperSettings).flags | 1;
((TLRPC.WallPaperSettings) tL_wallPaperSettings).flags = i2;
((TLRPC.WallPaperSettings) tL_wallPaperSettings).intensity = (int) (info.intensity * 100.0f);
((TLRPC.WallPaperSettings) tL_wallPaperSettings).flags = i2 | 8;
} else {
float f = info.intensity;
if (f > 0.0f) {
((TLRPC.WallPaperSettings) tL_wallPaperSettings).intensity = (int) (f * 100.0f);
((TLRPC.WallPaperSettings) tL_wallPaperSettings).flags |= 8;
}
}
int i3 = info.gradientColor1;
if (i3 != 0) {
((TLRPC.WallPaperSettings) tL_wallPaperSettings).second_background_color = i3 & 16777215;
((TLRPC.WallPaperSettings) tL_wallPaperSettings).rotation = AndroidUtilities.getWallpaperRotation(info.rotation, true);
((TLRPC.WallPaperSettings) tL_wallPaperSettings).flags |= 16;
}
int i4 = info.gradientColor2;
if (i4 != 0) {
((TLRPC.WallPaperSettings) tL_wallPaperSettings).third_background_color = i4 & 16777215;
((TLRPC.WallPaperSettings) tL_wallPaperSettings).flags |= 32;
}
int i5 = info.gradientColor3;
if (i5 != 0) {
((TLRPC.WallPaperSettings) tL_wallPaperSettings).fourth_background_color = i5 & 16777215;
((TLRPC.WallPaperSettings) tL_wallPaperSettings).flags |= 64;
}
return tL_wallPaperSettings;
}
public static TLRPC.InputWallPaper getInputWallpaper(Theme.OverrideWallpaperInfo info) {
if (info.wallpaperId > 0) {
TLRPC.TL_inputWallPaper tL_inputWallPaper = new TLRPC.TL_inputWallPaper();
tL_inputWallPaper.id = info.wallpaperId;
tL_inputWallPaper.access_hash = info.accessHash;
return tL_inputWallPaper;
}
TLRPC.TL_inputWallPaperSlug tL_inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug();
tL_inputWallPaperSlug.slug = info.slug;
return tL_inputWallPaperSlug;
}
public void markDialogMessageAsDeleted(long dialogId, ArrayList<Integer> messages) {
ArrayList<MessageObject> arrayList = this.dialogMessage.get(dialogId);
if (arrayList != null) {
for (int i = 0; i < arrayList.size(); i++) {
MessageObject messageObject = arrayList.get(i);
if (messageObject != null) {
int i2 = 0;
while (true) {
if (i2 < messages.size()) {
if (messageObject.getId() == messages.get(i2).intValue()) {
messageObject.deleted = true;
break;
}
i2++;
}
}
}
}
}
}
public void deleteMessages(ArrayList<Integer> messages, ArrayList<Long> randoms, TLRPC.EncryptedChat encryptedChat, long dialogId, int topicId, boolean forAll, int mode) {
deleteMessages(messages, randoms, encryptedChat, dialogId, forAll, mode, false, 0L, null, topicId);
}
public void deleteMessages(ArrayList<Integer> messages, ArrayList<Long> randoms, TLRPC.EncryptedChat encryptedChat, long dialogId, int topicId, boolean forAll, int mode, boolean cacheOnly) {
deleteMessages(messages, randoms, encryptedChat, dialogId, forAll, mode, cacheOnly, 0L, null, topicId);
}
public void deleteMessages(ArrayList<Integer> messages, ArrayList<Long> randoms, TLRPC.EncryptedChat encryptedChat, long dialogId, boolean forAll, int mode, boolean cacheOnly, long taskId, TLObject taskRequest, int topicId) {
long j;
ArrayList arrayList;
NativeByteBuffer nativeByteBuffer;
NativeByteBuffer nativeByteBuffer2;
long createPendingTask;
TLRPC.TL_messages_deleteMessages tL_messages_deleteMessages;
NativeByteBuffer nativeByteBuffer3;
long createPendingTask2;
TLRPC.TL_channels_deleteMessages tL_channels_deleteMessages;
NativeByteBuffer nativeByteBuffer4;
long createPendingTask3;
TLRPC.TL_messages_deleteQuickReplyMessages tL_messages_deleteQuickReplyMessages;
NativeByteBuffer nativeByteBuffer5;
long createPendingTask4;
TLRPC.TL_messages_deleteScheduledMessages tL_messages_deleteScheduledMessages;
long j2;
ArrayList arrayList2;
char c;
boolean z = mode == 1;
boolean z2 = mode == 5;
if ((messages == null || messages.isEmpty()) && taskId == 0) {
return;
}
if (taskId == 0) {
if (dialogId == 0 || !DialogObject.isChatDialog(dialogId)) {
j2 = 0;
} else {
TLRPC.Chat chat = getChat(Long.valueOf(-dialogId));
j2 = ChatObject.isChannel(chat) ? chat.id : 0L;
}
if (cacheOnly) {
arrayList2 = null;
} else {
ArrayList arrayList3 = new ArrayList();
int size = messages.size();
for (int i = 0; i < size; i++) {
Integer num = messages.get(i);
if (num.intValue() > 0) {
arrayList3.add(num);
}
}
arrayList2 = arrayList3;
}
if (z) {
c = 1;
getMessagesStorage().markMessagesAsDeleted(dialogId, messages, true, false, 1, 0);
} else {
c = 1;
if (z2) {
if (mode == 5) {
QuickRepliesController.getInstance(this.currentAccount).deleteLocalMessages(messages);
}
getMessagesStorage().markMessagesAsDeleted(dialogId, messages, true, false, 5, topicId);
} else {
if (j2 == 0) {
for (int i2 = 0; i2 < messages.size(); i2++) {
MessageObject messageObject = this.dialogMessagesByIds.get(messages.get(i2).intValue());
if (messageObject != null) {
messageObject.deleted = true;
}
}
} else {
markDialogMessageAsDeleted(dialogId, messages);
}
getMessagesStorage().markMessagesAsDeleted(dialogId, messages, true, forAll, 0, topicId);
getMessagesStorage().updateDialogsWithDeletedMessages(dialogId, j2, messages, (ArrayList) null, true);
}
}
NotificationCenter notificationCenter = getNotificationCenter();
int i3 = NotificationCenter.messagesDeleted;
Object[] objArr = new Object[3];
objArr[0] = messages;
objArr[c] = Long.valueOf(j2);
objArr[2] = Boolean.valueOf(z);
notificationCenter.postNotificationName(i3, objArr);
j = j2;
arrayList = arrayList2;
} else {
j = taskRequest instanceof TLRPC.TL_channels_deleteMessages ? ((TLRPC.TL_channels_deleteMessages) taskRequest).channel.channel_id : 0L;
arrayList = null;
}
if (cacheOnly) {
return;
}
if (z) {
if (taskRequest instanceof TLRPC.TL_messages_deleteScheduledMessages) {
tL_messages_deleteScheduledMessages = (TLRPC.TL_messages_deleteScheduledMessages) taskRequest;
createPendingTask4 = taskId;
} else {
TLRPC.TL_messages_deleteScheduledMessages tL_messages_deleteScheduledMessages2 = new TLRPC.TL_messages_deleteScheduledMessages();
tL_messages_deleteScheduledMessages2.id = arrayList;
tL_messages_deleteScheduledMessages2.peer = getInputPeer(dialogId);
try {
nativeByteBuffer5 = new NativeByteBuffer(tL_messages_deleteScheduledMessages2.getObjectSize() + 12);
} catch (Exception e) {
e = e;
nativeByteBuffer5 = null;
}
try {
nativeByteBuffer5.writeInt32(24);
nativeByteBuffer5.writeInt64(dialogId);
tL_messages_deleteScheduledMessages2.serializeToStream(nativeByteBuffer5);
} catch (Exception e2) {
e = e2;
FileLog.e(e);
createPendingTask4 = getMessagesStorage().createPendingTask(nativeByteBuffer5);
tL_messages_deleteScheduledMessages = tL_messages_deleteScheduledMessages2;
getConnectionsManager().sendRequest(tL_messages_deleteScheduledMessages, new MessagesController$.ExternalSyntheticLambda383(this, createPendingTask4));
return;
}
createPendingTask4 = getMessagesStorage().createPendingTask(nativeByteBuffer5);
tL_messages_deleteScheduledMessages = tL_messages_deleteScheduledMessages2;
}
getConnectionsManager().sendRequest(tL_messages_deleteScheduledMessages, new MessagesController$.ExternalSyntheticLambda383(this, createPendingTask4));
return;
}
if (z2) {
if (taskRequest instanceof TLRPC.TL_messages_deleteQuickReplyMessages) {
tL_messages_deleteQuickReplyMessages = (TLRPC.TL_messages_deleteQuickReplyMessages) taskRequest;
createPendingTask3 = taskId;
} else {
TLRPC.TL_messages_deleteQuickReplyMessages tL_messages_deleteQuickReplyMessages2 = new TLRPC.TL_messages_deleteQuickReplyMessages();
tL_messages_deleteQuickReplyMessages2.id = arrayList;
tL_messages_deleteQuickReplyMessages2.shortcut_id = topicId;
try {
nativeByteBuffer4 = new NativeByteBuffer(tL_messages_deleteQuickReplyMessages2.getObjectSize() + 16);
} catch (Exception e3) {
e = e3;
nativeByteBuffer4 = null;
}
try {
nativeByteBuffer4.writeInt32(103);
nativeByteBuffer4.writeInt64(dialogId);
nativeByteBuffer4.writeInt32(topicId);
tL_messages_deleteQuickReplyMessages2.serializeToStream(nativeByteBuffer4);
} catch (Exception e4) {
e = e4;
FileLog.e(e);
createPendingTask3 = getMessagesStorage().createPendingTask(nativeByteBuffer4);
tL_messages_deleteQuickReplyMessages = tL_messages_deleteQuickReplyMessages2;
getConnectionsManager().sendRequest(tL_messages_deleteQuickReplyMessages, new MessagesController$.ExternalSyntheticLambda382(this, createPendingTask3));
return;
}
createPendingTask3 = getMessagesStorage().createPendingTask(nativeByteBuffer4);
tL_messages_deleteQuickReplyMessages = tL_messages_deleteQuickReplyMessages2;
}
getConnectionsManager().sendRequest(tL_messages_deleteQuickReplyMessages, new MessagesController$.ExternalSyntheticLambda382(this, createPendingTask3));
return;
}
if (j != 0) {
if (taskRequest != null) {
tL_channels_deleteMessages = (TLRPC.TL_channels_deleteMessages) taskRequest;
createPendingTask2 = taskId;
} else {
TLRPC.TL_channels_deleteMessages tL_channels_deleteMessages2 = new TLRPC.TL_channels_deleteMessages();
tL_channels_deleteMessages2.id = arrayList;
tL_channels_deleteMessages2.channel = getInputChannel(j);
try {
nativeByteBuffer3 = new NativeByteBuffer(tL_channels_deleteMessages2.getObjectSize() + 12);
} catch (Exception e5) {
e = e5;
nativeByteBuffer3 = null;
}
try {
nativeByteBuffer3.writeInt32(24);
nativeByteBuffer3.writeInt64(dialogId);
tL_channels_deleteMessages2.serializeToStream(nativeByteBuffer3);
} catch (Exception e6) {
e = e6;
FileLog.e(e);
createPendingTask2 = getMessagesStorage().createPendingTask(nativeByteBuffer3);
tL_channels_deleteMessages = tL_channels_deleteMessages2;
getConnectionsManager().sendRequest(tL_channels_deleteMessages, new MessagesController$.ExternalSyntheticLambda392(this, j, createPendingTask2));
return;
}
createPendingTask2 = getMessagesStorage().createPendingTask(nativeByteBuffer3);
tL_channels_deleteMessages = tL_channels_deleteMessages2;
}
getConnectionsManager().sendRequest(tL_channels_deleteMessages, new MessagesController$.ExternalSyntheticLambda392(this, j, createPendingTask2));
return;
}
if (randoms == null || encryptedChat == null || randoms.isEmpty()) {
nativeByteBuffer = null;
} else {
nativeByteBuffer = null;
getSecretChatHelper().sendMessagesDeleteMessage(encryptedChat, randoms, (TLRPC.Message) null);
}
if (taskRequest instanceof TLRPC.TL_messages_deleteMessages) {
tL_messages_deleteMessages = (TLRPC.TL_messages_deleteMessages) taskRequest;
createPendingTask = taskId;
} else {
TLRPC.TL_messages_deleteMessages tL_messages_deleteMessages2 = new TLRPC.TL_messages_deleteMessages();
tL_messages_deleteMessages2.id = arrayList;
tL_messages_deleteMessages2.revoke = forAll;
try {
nativeByteBuffer2 = new NativeByteBuffer(tL_messages_deleteMessages2.getObjectSize() + 12);
} catch (Exception e7) {
e = e7;
nativeByteBuffer2 = nativeByteBuffer;
}
try {
nativeByteBuffer2.writeInt32(24);
nativeByteBuffer2.writeInt64(dialogId);
tL_messages_deleteMessages2.serializeToStream(nativeByteBuffer2);
} catch (Exception e8) {
e = e8;
FileLog.e(e);
createPendingTask = getMessagesStorage().createPendingTask(nativeByteBuffer2);
tL_messages_deleteMessages = tL_messages_deleteMessages2;
getConnectionsManager().sendRequest(tL_messages_deleteMessages, new MessagesController$.ExternalSyntheticLambda372(this, createPendingTask));
}
createPendingTask = getMessagesStorage().createPendingTask(nativeByteBuffer2);
tL_messages_deleteMessages = tL_messages_deleteMessages2;
}
getConnectionsManager().sendRequest(tL_messages_deleteMessages, new MessagesController$.ExternalSyntheticLambda372(this, createPendingTask));
}
public void lambda$deleteMessages$121(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
processUpdates((TLRPC.Updates) tLObject, false);
}
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
}
public void lambda$deleteMessages$122(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
processUpdates((TLRPC.Updates) tLObject, false);
}
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
}
public void lambda$deleteMessages$123(long j, long j2, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC.TL_messages_affectedMessages tL_messages_affectedMessages = (TLRPC.TL_messages_affectedMessages) tLObject;
processNewChannelDifferenceParams(tL_messages_affectedMessages.pts, tL_messages_affectedMessages.pts_count, j);
}
if (j2 != 0) {
getMessagesStorage().removePendingTask(j2);
}
}
public void lambda$deleteMessages$124(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC.TL_messages_affectedMessages tL_messages_affectedMessages = (TLRPC.TL_messages_affectedMessages) tLObject;
processNewDifferenceParams(-1, tL_messages_affectedMessages.pts, -1, tL_messages_affectedMessages.pts_count);
}
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
}
public void unpinAllMessages(TLRPC.Chat chat, TLRPC$User user) {
if (chat == null && user == null) {
return;
}
TLRPC.TL_messages_unpinAllMessages tL_messages_unpinAllMessages = new TLRPC.TL_messages_unpinAllMessages();
tL_messages_unpinAllMessages.peer = getInputPeer(chat != null ? -chat.id : user.id);
getConnectionsManager().sendRequest(tL_messages_unpinAllMessages, new MessagesController$.ExternalSyntheticLambda427(this, chat, user));
}
public void lambda$unpinAllMessages$125(TLRPC.Chat chat, TLRPC$User tLRPC$User, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
TLRPC.TL_messages_affectedHistory tL_messages_affectedHistory = (TLRPC.TL_messages_affectedHistory) tLObject;
if (ChatObject.isChannel(chat)) {
processNewChannelDifferenceParams(tL_messages_affectedHistory.pts, tL_messages_affectedHistory.pts_count, chat.id);
} else {
processNewDifferenceParams(-1, tL_messages_affectedHistory.pts, -1, tL_messages_affectedHistory.pts_count);
}
new ArrayList();
getMessagesStorage().updatePinnedMessages(chat != null ? -chat.id : tLRPC$User.id, (ArrayList) null, false, 0, 0, false, (HashMap) null);
}
}
public void pinMessage(TLRPC.Chat chat, TLRPC$User user, int id, boolean notify) {
pinMessage(chat, user, id, false, false, notify);
}
public void pinMessage(TLRPC.Chat chat, TLRPC$User user, int id, boolean unpin, boolean oneSide, boolean notify) {
if (chat == null && user == null) {
return;
}
TLRPC.TL_messages_updatePinnedMessage tL_messages_updatePinnedMessage = new TLRPC.TL_messages_updatePinnedMessage();
tL_messages_updatePinnedMessage.peer = getInputPeer(chat != null ? -chat.id : user.id);
tL_messages_updatePinnedMessage.id = id;
tL_messages_updatePinnedMessage.unpin = unpin;
tL_messages_updatePinnedMessage.silent = !notify;
tL_messages_updatePinnedMessage.pm_oneside = oneSide;
getConnectionsManager().sendRequest(tL_messages_updatePinnedMessage, new MessagesController$.ExternalSyntheticLambda368(this, id, chat, user, unpin));
}
public void lambda$pinMessage$126(int i, TLRPC.Chat chat, TLRPC$User tLRPC$User, boolean z, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
ArrayList arrayList = new ArrayList();
arrayList.add(Integer.valueOf(i));
getMessagesStorage().updatePinnedMessages(chat != null ? -chat.id : tLRPC$User.id, arrayList, !z, -1, 0, false, (HashMap) null);
processUpdates((TLRPC.Updates) tLObject, false);
}
}
public void deleteUserChannelHistory(TLRPC.Chat currentChat, TLRPC$User fromUser, TLRPC.Chat fromChat, int offset) {
long j;
if (fromUser != null) {
j = fromUser.id;
} else {
j = fromChat != null ? fromChat.id : 0L;
}
if (offset == 0) {
getMessagesStorage().deleteUserChatHistory(-currentChat.id, j);
}
TLRPC.TL_channels_deleteParticipantHistory tL_channels_deleteParticipantHistory = new TLRPC.TL_channels_deleteParticipantHistory();
tL_channels_deleteParticipantHistory.channel = getInputChannel(currentChat);
tL_channels_deleteParticipantHistory.participant = fromUser != null ? getInputPeer(fromUser) : getInputPeer(fromChat);
getConnectionsManager().sendRequest(tL_channels_deleteParticipantHistory, new MessagesController$.ExternalSyntheticLambda428(this, currentChat, fromUser, fromChat));
}
public void lambda$deleteUserChannelHistory$127(TLRPC.Chat chat, TLRPC$User tLRPC$User, TLRPC.Chat chat2, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC.TL_messages_affectedHistory tL_messages_affectedHistory = (TLRPC.TL_messages_affectedHistory) tLObject;
int i = tL_messages_affectedHistory.offset;
if (i > 0) {
deleteUserChannelHistory(chat, tLRPC$User, chat2, i);
}
processNewChannelDifferenceParams(tL_messages_affectedHistory.pts, tL_messages_affectedHistory.pts_count, chat.id);
}
}
public ArrayList<TLRPC.Dialog> getAllDialogs() {
return this.allDialogs;
}
public void putDialogsEndReachedAfterRegistration() {
this.dialogsEndReached.put(0, true);
this.serverDialogsEndReached.put(0, true);
}
public boolean isDialogsEndReached(int folderId) {
return this.dialogsEndReached.get(folderId);
}
public boolean isLoadingDialogs(int folderId) {
return this.loadingDialogs.get(folderId);
}
public boolean isServerDialogsEndReached(int folderId) {
return this.serverDialogsEndReached.get(folderId);
}
public boolean hasHiddenArchive() {
return (!PlusSettings.removeArchiveFromList || (this.isForwarding && PlusSettings.showFoldersIfForwarding)) && SharedConfig.archiveHidden && this.dialogs_dict.get(DialogObject.makeFolderDialogId(1)) != null;
}
public ArrayList<TLRPC.Dialog> getDialogs(int folderId) {
ArrayList<TLRPC.Dialog> arrayList = this.dialogsByFolder.get(folderId);
return arrayList == null ? new ArrayList<>() : arrayList;
}
public int getAllFoldersDialogsCount() {
int i = 0;
for (int i2 = 0; i2 < this.dialogsByFolder.size(); i2++) {
SparseArray<ArrayList<TLRPC.Dialog>> sparseArray = this.dialogsByFolder;
ArrayList<TLRPC.Dialog> arrayList = sparseArray.get(sparseArray.keyAt(i2));
if (arrayList != null) {
i += arrayList.size();
}
}
return i;
}
public ArrayList<TLRPC.Dialog> getSortedDialogsAll(int sort) {
Comparator<TLRPC.Dialog> comparator;
this.isFilter = false;
ArrayList<TLRPC.Dialog> arrayList = this.dialogsByFolder.get(0);
if (arrayList == null && (arrayList = this.dialogsByFolder.get(0)) == null) {
return new ArrayList<>();
}
if (this.needSorting) {
this.needSorting = false;
if (sort == 0) {
comparator = this.dialogComparator;
} else {
comparator = sort == 1 ? PlusSettings.showUnmutedFirstIfUnread ? this.dialogComparatorUnreadUnmuted : this.dialogComparatorUnread : this.dialogComparatorUnmuted;
}
Collections.sort(arrayList, comparator);
}
return arrayList;
}
public ArrayList<TLRPC.Dialog> getSortedDialogs(ArrayList<TLRPC.Dialog> dialogs, int folderId, int type, int sort, int dialogsType) {
Comparator<TLRPC.Dialog> comparator;
this.isFilter = true;
if (this.needSorting) {
this.needSorting = false;
this.sortingDialogFilter = this.selectedDialogFilter[dialogsType != 7 ? (char) 1 : (char) 0];
this.currentTime = getConnectionsManager().getCurrentTime();
try {
if (sort == 0) {
comparator = this.dialogDateComparator2;
} else if (sort == 1) {
if (type != 20 && !PlusUtils.isUsers(this.sortingDialogFilter)) {
comparator = PlusSettings.showUnmutedFirstIfUnread ? this.dialogComparatorUnreadUnmuted : this.dialogComparatorUnread;
}
comparator = this.dialogComparatorUsersByStatus;
} else {
comparator = this.dialogComparatorUnmuted;
}
Collections.sort(dialogs, comparator);
} catch (Exception e) {
e.printStackTrace();
}
}
return dialogs;
}
public ArrayList<TLRPC.Dialog> getDialogsAllFolders() {
ArrayList<TLRPC.Dialog> arrayList = this.dialogsByFolder.get(0);
if (arrayList != null && arrayList.size() > 0) {
TLRPC.Dialog dialog = arrayList.get(0);
if (dialog instanceof TLRPC.TL_dialogFolder) {
arrayList.remove(dialog);
}
for (int i = 1; i < this.dialogsByFolder.size(); i++) {
ArrayList<TLRPC.Dialog> arrayList2 = this.dialogsByFolder.get(i);
if (arrayList2 != null && !arrayList2.isEmpty()) {
arrayList.addAll(arrayList2);
}
}
return arrayList;
}
return new ArrayList<>();
}
public int getTotalDialogsCount() {
ArrayList<TLRPC.Dialog> arrayList = this.dialogsByFolder.get(0);
if (arrayList != null) {
return 0 + arrayList.size();
}
return 0;
}
public void forceSorting() {
this.needSorting = true;
}
public boolean isForwarding(boolean forwarding) {
if (forwarding == this.isForwarding) {
return false;
}
this.isForwarding = forwarding;
return true;
}
public ArrayList<TLRPC.Dialog> getDialogsFilterByType(int type, int folderId) {
char c = type == 7 ? (char) 0 : (char) 1;
SparseArray<ArrayList<TLRPC.Dialog>>[] sparseArrayArr = this.selectedDialogFilterMoreFolder;
if (sparseArrayArr[c] == null) {
sparseArrayArr[c] = new SparseArray<>();
this.selectedDialogFilterMoreFolder[c].put(folderId, new ArrayList<>());
}
ArrayList<TLRPC.Dialog> arrayList = this.selectedDialogFilterMoreFolder[c].get(folderId);
if (arrayList != null) {
return arrayList;
}
ArrayList<TLRPC.Dialog> arrayList2 = new ArrayList<>();
this.selectedDialogFilterMoreFolder[c].put(folderId, arrayList2);
return arrayList2;
}
public void setCurrentFolderId(int folderId) {
if (folderId == this.currentFolderId) {
return;
}
this.currentFolderId = folderId;
if (folderId == 2) {
fixWrongHiddenFolder();
}
getMessagesStorage().updateDialogsFiltersCounters();
}
public ArrayList<TLRPC.Dialog> getDialogsByType(int type, int folderId) {
int i;
ArrayList<TLRPC.Dialog> arrayList;
Comparator<TLRPC.Dialog> comparator;
if (type == 0) {
return null;
}
this.isFilter = false;
switch (type) {
case 20:
i = Theme.plusSortUsers;
arrayList = this.dialogsUsersByFolder.get(folderId);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsUsersByFolder.put(folderId, arrayList);
break;
}
break;
case 21:
i = Theme.plusSortGroups;
arrayList = this.dialogsGroupsByFolder.get(folderId);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsGroupsByFolder.put(folderId, arrayList);
break;
}
break;
case 22:
i = Theme.plusSortSuperGroups;
arrayList = this.dialogsMegaGroupsByFolder.get(folderId);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsMegaGroupsByFolder.put(folderId, arrayList);
break;
}
break;
case 23:
i = Theme.plusSortGroups;
arrayList = this.dialogsGroupsAllByFolder.get(folderId);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsGroupsAllByFolder.put(folderId, arrayList);
break;
}
break;
case 24:
i = Theme.plusSortChannels;
arrayList = this.dialogsChannelsByFolder.get(folderId);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsChannelsByFolder.put(folderId, arrayList);
break;
}
break;
case 25:
i = Theme.plusSortBots;
arrayList = this.dialogsBotsByFolder.get(folderId);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsBotsByFolder.put(folderId, arrayList);
break;
}
break;
case 26:
i = Theme.plusSortFavs;
arrayList = this.dialogsFavsByFolder.get(folderId);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsFavsByFolder.put(folderId, arrayList);
break;
}
break;
case 27:
i = Theme.plusSortAdmin;
arrayList = this.dialogsAdminByFolder.get(folderId);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsAdminByFolder.put(folderId, arrayList);
break;
}
break;
case 28:
i = Theme.plusSortUnread;
arrayList = this.dialogsUnreadByFolder.get(folderId);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsUnreadByFolder.put(folderId, arrayList);
break;
}
break;
default:
i = Theme.plusSortAll;
arrayList = getDialogs(folderId);
break;
}
if (lastDialogType != type) {
lastDialogType = type;
this.needSorting = true;
}
if (this.needSorting) {
this.needSorting = false;
try {
this.currentTime = getConnectionsManager().getCurrentTime();
if (i == 0) {
comparator = this.dialogComparator;
} else {
comparator = i == 1 ? type == 20 ? this.dialogComparatorUsersByStatus : PlusSettings.showUnmutedFirstIfUnread ? this.dialogComparatorUnreadUnmuted : this.dialogComparatorUnread : this.dialogComparatorUnmuted;
}
Collections.sort(arrayList, comparator);
} catch (Exception e) {
FileLog.e(e);
}
}
return arrayList;
}
public void putAllNeededDraftDialogs() {
LongSparseArray drafts = getMediaDataController().getDrafts();
int size = drafts.size();
for (int i = 0; i < size; i++) {
TLRPC.DraftMessage draftMessage = (TLRPC.DraftMessage) ((LongSparseArray) drafts.valueAt(i)).get(0L);
if (draftMessage != null) {
putDraftDialogIfNeed(drafts.keyAt(i), draftMessage);
}
}
}
public void putDraftDialogIfNeed(long dialogId, TLRPC.DraftMessage draftMessage) {
if (this.dialogs_dict.indexOfKey(dialogId) < 0) {
MediaDataController mediaDataController = getMediaDataController();
int size = this.allDialogs.size();
if (size > 0) {
TLRPC.Dialog dialog = this.allDialogs.get(size - 1);
if (draftMessage.date < DialogObject.getLastMessageOrDraftDate(dialog, mediaDataController.getDraft(dialog.id, 0L))) {
return;
}
}
TLRPC.Dialog tL_dialog = new TLRPC.TL_dialog();
tL_dialog.id = dialogId;
tL_dialog.draft = draftMessage;
tL_dialog.folder_id = mediaDataController.getDraftFolderId(dialogId);
tL_dialog.flags = (dialogId >= 0 || !ChatObject.isChannel(getChat(Long.valueOf(-dialogId)))) ? 0 : 1;
this.dialogs_dict.put(dialogId, tL_dialog);
this.allDialogs.add(tL_dialog);
sortDialogs(null);
}
}
public void removeDraftDialogIfNeed(long dialogId) {
TLRPC.Dialog dialog = this.dialogs_dict.get(dialogId);
if (dialog == null || dialog.top_message != 0) {
return;
}
this.dialogs_dict.remove(dialog.id);
this.allDialogs.remove(dialog);
}
private void removeDialog(TLRPC.Dialog dialog) {
if (dialog == null) {
return;
}
long j = dialog.id;
if (this.dialogsServerOnly.remove(dialog) && DialogObject.isChannel(dialog)) {
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda105(this, j));
}
this.allDialogs.remove(dialog);
this.dialogsMyChannels.remove(dialog);
this.dialogsMyGroups.remove(dialog);
this.dialogsCanAddUsers.remove(dialog);
this.dialogsChannelsOnly.remove(dialog);
this.dialogsGroupsOnly.remove(dialog);
this.dialogsUsersOnly.remove(dialog);
this.dialogsForBlock.remove(dialog);
this.dialogsForward.remove(dialog);
int i = 0;
while (true) {
DialogFilter[] dialogFilterArr = this.selectedDialogFilter;
if (i >= dialogFilterArr.length) {
break;
}
if (dialogFilterArr[i] != null) {
dialogFilterArr[i].dialogs.remove(dialog);
this.selectedDialogFilter[i].dialogsForward.remove(dialog);
}
i++;
}
this.dialogsTopicsGroups.remove(dialog);
ArrayList<TLRPC.Dialog> arrayList = this.dialogsUsersByFolder.get(dialog.folder_id);
if (arrayList != null) {
arrayList.remove(dialog);
}
ArrayList<TLRPC.Dialog> arrayList2 = this.dialogsGroupsByFolder.get(dialog.folder_id);
if (arrayList2 != null) {
arrayList2.remove(dialog);
}
ArrayList<TLRPC.Dialog> arrayList3 = this.dialogsGroupsAllByFolder.get(dialog.folder_id);
if (arrayList3 != null) {
arrayList3.remove(dialog);
}
ArrayList<TLRPC.Dialog> arrayList4 = this.dialogsBotsByFolder.get(dialog.folder_id);
if (arrayList4 != null) {
arrayList4.remove(dialog);
}
ArrayList<TLRPC.Dialog> arrayList5 = this.dialogsMegaGroupsByFolder.get(dialog.folder_id);
if (arrayList5 != null) {
arrayList5.remove(dialog);
}
ArrayList<TLRPC.Dialog> arrayList6 = this.dialogsChannelsByFolder.get(dialog.folder_id);
if (arrayList6 != null) {
arrayList6.remove(dialog);
}
ArrayList<TLRPC.Dialog> arrayList7 = this.dialogsFavsByFolder.get(dialog.folder_id);
if (arrayList7 != null) {
arrayList7.remove(dialog);
}
ArrayList<TLRPC.Dialog> arrayList8 = this.dialogsUnreadByFolder.get(dialog.folder_id);
if (arrayList8 != null) {
arrayList8.remove(dialog);
}
ArrayList<TLRPC.Dialog> arrayList9 = this.dialogsHiddenByFolder.get(dialog.folder_id);
if (arrayList9 != null) {
arrayList9.remove(dialog);
}
this.dialogs_dict.remove(j);
ArrayList<TLRPC.Dialog> arrayList10 = this.dialogsByFolder.get(dialog.folder_id);
if (arrayList10 != null) {
arrayList10.remove(dialog);
}
}
public void lambda$removeDialog$128(long j) {
long j2 = -j;
this.channelsPts.delete(j2);
this.shortPollChannels.delete(j2);
this.needShortPollChannels.delete(j2);
this.shortPollOnlines.delete(j2);
this.needShortPollOnlines.delete(j2);
}
public void hidePromoDialog() {
if (this.promoDialog == null) {
return;
}
TLRPC.TL_help_hidePromoData tL_help_hidePromoData = new TLRPC.TL_help_hidePromoData();
tL_help_hidePromoData.peer = getInputPeer(this.promoDialog.id);
getConnectionsManager().sendRequest(tL_help_hidePromoData, MessagesController$.ExternalSyntheticLambda458.INSTANCE);
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda45(this));
removePromoDialog();
}
public void lambda$hidePromoDialog$130() {
this.promoDialogId = 0L;
this.proxyDialogAddress = null;
this.nextPromoInfoCheckTime = getConnectionsManager().getCurrentTime() + 3600;
getGlobalMainSettings().edit().putLong("proxy_dialog", this.promoDialogId).remove("proxyDialogAddress").putInt("nextPromoInfoCheckTime", this.nextPromoInfoCheckTime).commit();
}
public void deleteDialog(final long did, int onlyHistory) {
deleteDialog(did, onlyHistory, false);
}
public void deleteDialog(final long did, int onlyHistory, boolean revoke) {
deleteDialog(did, 1, onlyHistory, 0, revoke, null, 0L);
}
public void setDialogHistoryTTL(long did, int ttl) {
TLRPC.UserFull userFull;
TLRPC.TL_messages_setHistoryTTL tL_messages_setHistoryTTL = new TLRPC.TL_messages_setHistoryTTL();
tL_messages_setHistoryTTL.peer = getInputPeer(did);
tL_messages_setHistoryTTL.period = ttl;
getConnectionsManager().sendRequest(tL_messages_setHistoryTTL, new MessagesController$.ExternalSyntheticLambda339(this));
TLRPC.Dialog dialog = getMessagesController().dialogs_dict.get(did);
if (dialog != null) {
dialog.ttl_period = ttl;
}
getMessagesStorage().setDialogTtl(did, ttl);
TLRPC.ChatFull chatFull = null;
if (did > 0) {
userFull = getUserFull(did);
if (userFull != null) {
userFull.ttl_period = ttl;
userFull.flags |= 16384;
}
} else {
TLRPC.ChatFull chatFull2 = getChatFull(-did);
if (chatFull2 != null) {
chatFull2.ttl_period = ttl;
if (chatFull2 instanceof TLRPC.TL_channelFull) {
chatFull2.flags |= ConnectionsManager.FileTypePhoto;
} else {
chatFull2.flags |= 16384;
}
}
chatFull = chatFull2;
userFull = null;
}
if (chatFull == null) {
if (userFull != null) {
getNotificationCenter().postNotificationName(NotificationCenter.userInfoDidLoad, new Object[]{Long.valueOf(did), userFull});
}
} else {
NotificationCenter notificationCenter = getNotificationCenter();
int i = NotificationCenter.chatInfoDidLoad;
Boolean bool = Boolean.FALSE;
notificationCenter.postNotificationName(i, new Object[]{chatFull, 0, bool, bool});
}
}
public void lambda$setDialogHistoryTTL$131(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
processUpdates((TLRPC.Updates) tLObject, false);
}
}
public void setDialogsInTransaction(boolean transaction) {
this.dialogsInTransaction = transaction;
if (transaction) {
return;
}
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[]{Boolean.TRUE});
}
public void deleteDialog(long r30, int r32, int r33, int r34, boolean r35, org.telegram.tgnet.TLRPC.InputPeer r36, long r37) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.deleteDialog(long, int, int, int, boolean, org.telegram.tgnet.TLRPC$InputPeer, long):void");
}
public void lambda$deleteDialog$132(long j, int i, boolean z, TLRPC.InputPeer inputPeer, long j2, int i2) {
if (j == getUserConfig().getClientUserId()) {
getSavedMessagesController().deleteAllDialogs();
}
deleteDialog(j, 2, i, Math.max(0, i2), z, inputPeer, j2);
checkIfFolderEmpty(1);
}
public void lambda$deleteDialog$133(long j) {
getNotificationsController().removeNotificationsForDialog(j);
}
public void lambda$deleteDialog$134(long j) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda93(this, j));
}
public void lambda$deleteDialog$135(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
if (tLObject != null) {
processUpdates((TLRPC.Updates) tLObject, false);
}
}
public void lambda$deleteDialog$136(long j, long j2, int i, int i2, boolean z, TLRPC.InputPeer inputPeer, TLObject tLObject, TLRPC.TL_error tL_error) {
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
if (tL_error == null) {
TLRPC.TL_messages_affectedHistory tL_messages_affectedHistory = (TLRPC.TL_messages_affectedHistory) tLObject;
if (tL_messages_affectedHistory.offset > 0) {
deleteDialog(j2, 0, i, i2, z, inputPeer, 0L);
}
processNewDifferenceParams(-1, tL_messages_affectedHistory.pts, -1, tL_messages_affectedHistory.pts_count);
getMessagesStorage().onDeleteQueryComplete(j2);
}
}
public void deleteSavedDialog(long did) {
deleteSavedDialog(did, 0);
}
public void deleteSavedDialog(long did, int input_max_id) {
int[] iArr = {input_max_id};
MessagesController$.ExternalSyntheticLambda116 externalSyntheticLambda116 = new MessagesController$.ExternalSyntheticLambda116(this, did, input_max_id, iArr);
if (iArr[0] <= 0) {
getMessagesStorage().getSavedDialogMaxMessageId(did, new MessagesController$.ExternalSyntheticLambda315(iArr, externalSyntheticLambda116));
} else {
externalSyntheticLambda116.run();
}
}
public void lambda$deleteSavedDialog$138(long j, int i, int[] iArr) {
getMessagesStorage().deleteSavedDialog(j);
TLRPC.TL_messages_deleteSavedHistory tL_messages_deleteSavedHistory = new TLRPC.TL_messages_deleteSavedHistory();
tL_messages_deleteSavedHistory.peer = getInputPeer(j);
if (i == 0) {
SavedMessagesController.SavedDialog savedDialog = null;
int i2 = 0;
while (true) {
if (i2 >= getSavedMessagesController().allDialogs.size()) {
break;
}
if (((SavedMessagesController.SavedDialog) getSavedMessagesController().allDialogs.get(i2)).dialogId == j) {
savedDialog = (SavedMessagesController.SavedDialog) getSavedMessagesController().allDialogs.get(i2);
break;
}
i2++;
}
if (savedDialog != null) {
iArr[0] = Math.max(iArr[0], savedDialog.top_message_id);
getSavedMessagesController().deleteDialog(j);
}
tL_messages_deleteSavedHistory.max_id = iArr[0] <= 0 ? ConnectionsManager.DEFAULT_DATACENTER_ID : iArr[0];
}
getConnectionsManager().sendRequest(tL_messages_deleteSavedHistory, new MessagesController$.ExternalSyntheticLambda415(this, j, iArr), 64);
}
public void lambda$deleteSavedDialog$137(long j, int[] iArr, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC.TL_messages_affectedHistory tL_messages_affectedHistory = (TLRPC.TL_messages_affectedHistory) tLObject;
if (tL_messages_affectedHistory.offset > 0) {
deleteSavedDialog(j, iArr[0]);
}
processNewDifferenceParams(-1, tL_messages_affectedHistory.pts, -1, tL_messages_affectedHistory.pts_count);
getMessagesStorage().onDeleteQueryComplete(j);
}
}
public static void lambda$deleteSavedDialog$139(int[] iArr, Runnable runnable, int i) {
iArr[0] = i;
runnable.run();
}
public void saveGif(Object parentObject, TLRPC$Document document) {
if (parentObject == null || !MessageObject.isGifDocument(document)) {
return;
}
TLRPC.TL_messages_saveGif tL_messages_saveGif = new TLRPC.TL_messages_saveGif();
TLRPC.TL_inputDocument tL_inputDocument = new TLRPC.TL_inputDocument();
tL_messages_saveGif.id = tL_inputDocument;
((TLRPC.InputDocument) tL_inputDocument).id = document.id;
((TLRPC.InputDocument) tL_inputDocument).access_hash = document.access_hash;
byte[] bArr = document.file_reference;
((TLRPC.InputDocument) tL_inputDocument).file_reference = bArr;
if (bArr == null) {
((TLRPC.InputDocument) tL_inputDocument).file_reference = new byte[0];
}
tL_messages_saveGif.unsave = false;
getConnectionsManager().sendRequest(tL_messages_saveGif, new MessagesController$.ExternalSyntheticLambda419(this, parentObject, tL_messages_saveGif));
}
public void lambda$saveGif$140(Object obj, TLRPC.TL_messages_saveGif tL_messages_saveGif, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null || !FileRefController.isFileRefError(tL_error.text)) {
return;
}
getFileRefController().requestReference(obj, new Object[]{tL_messages_saveGif});
}
public void saveRecentSticker(Object parentObject, TLRPC$Document document, boolean asMask) {
if (parentObject == null || document == null) {
return;
}
TLRPC.TL_messages_saveRecentSticker tL_messages_saveRecentSticker = new TLRPC.TL_messages_saveRecentSticker();
TLRPC.TL_inputDocument tL_inputDocument = new TLRPC.TL_inputDocument();
tL_messages_saveRecentSticker.id = tL_inputDocument;
((TLRPC.InputDocument) tL_inputDocument).id = document.id;
((TLRPC.InputDocument) tL_inputDocument).access_hash = document.access_hash;
byte[] bArr = document.file_reference;
((TLRPC.InputDocument) tL_inputDocument).file_reference = bArr;
if (bArr == null) {
((TLRPC.InputDocument) tL_inputDocument).file_reference = new byte[0];
}
tL_messages_saveRecentSticker.unsave = false;
tL_messages_saveRecentSticker.attached = asMask;
getConnectionsManager().sendRequest(tL_messages_saveRecentSticker, new MessagesController$.ExternalSyntheticLambda420(this, parentObject, tL_messages_saveRecentSticker));
}
public void lambda$saveRecentSticker$141(Object obj, TLRPC.TL_messages_saveRecentSticker tL_messages_saveRecentSticker, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null || !FileRefController.isFileRefError(tL_error.text)) {
return;
}
getFileRefController().requestReference(obj, new Object[]{tL_messages_saveRecentSticker});
}
public void loadChannelParticipants(Long chatId) {
loadChannelParticipants(chatId, null, 32);
}
public void loadChannelParticipants(Long chatId, Utilities.Callback<TLRPC.TL_channels_channelParticipants> whenDone, int count) {
if (whenDone == null && (this.loadingFullParticipants.contains(chatId) || this.loadedFullParticipants.contains(chatId))) {
return;
}
this.loadingFullParticipants.add(chatId);
TLRPC.TL_channels_getParticipants tL_channels_getParticipants = new TLRPC.TL_channels_getParticipants();
tL_channels_getParticipants.channel = getInputChannel(chatId.longValue());
tL_channels_getParticipants.filter = new TLRPC.TL_channelParticipantsRecent();
tL_channels_getParticipants.offset = 0;
tL_channels_getParticipants.limit = count;
getConnectionsManager().sendRequest(tL_channels_getParticipants, new MessagesController$.ExternalSyntheticLambda418(this, chatId, whenDone));
}
public void lambda$loadChannelParticipants$143(Long l, Utilities.Callback callback, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda227(this, tL_error, tLObject, l, callback));
}
public void lambda$loadChannelParticipants$142(TLRPC.TL_error tL_error, TLObject tLObject, Long l, Utilities.Callback callback) {
if (tL_error == null) {
TLRPC.TL_channels_channelParticipants tL_channels_channelParticipants = (TLRPC.TL_channels_channelParticipants) tLObject;
putUsers(((TLRPC.channels_ChannelParticipants) tL_channels_channelParticipants).users, false);
putChats(((TLRPC.channels_ChannelParticipants) tL_channels_channelParticipants).chats, false);
getMessagesStorage().putUsersAndChats(((TLRPC.channels_ChannelParticipants) tL_channels_channelParticipants).users, ((TLRPC.channels_ChannelParticipants) tL_channels_channelParticipants).chats, true, true);
getMessagesStorage().updateChannelUsers(l.longValue(), ((TLRPC.channels_ChannelParticipants) tL_channels_channelParticipants).participants);
this.loadedFullParticipants.add(l);
}
this.loadingFullParticipants.remove(l);
if (callback != null) {
callback.run(tLObject instanceof TLRPC.TL_channels_channelParticipants ? (TLRPC.TL_channels_channelParticipants) tLObject : null);
}
}
public void putChatFull(TLRPC.ChatFull chatFull) {
this.fullChats.put(chatFull.id, chatFull);
getTranslateController().updateDialogFull(-chatFull.id);
}
public void processChatInfo(long chatId, TLRPC.ChatFull info, ArrayList<TLRPC$User> usersArr, boolean fromCache, boolean force, boolean byChannelUsers, ArrayList<Integer> pinnedMessages, HashMap<Integer, MessageObject> pinnedMessagesMap, int totalPinnedCount, boolean pinnedEndReached) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda277(this, fromCache, chatId, byChannelUsers, force, info, usersArr, pinnedMessages, pinnedMessagesMap, totalPinnedCount, pinnedEndReached));
}
public void lambda$processChatInfo$144(boolean z, long j, boolean z2, boolean z3, TLRPC.ChatFull chatFull, ArrayList arrayList, ArrayList arrayList2, HashMap hashMap, int i, boolean z4) {
if (z && j > 0 && !z2 && System.currentTimeMillis() - this.loadedFullChats.get(j, 0L) > 60000) {
loadFullChat(j, 0, z3);
}
if (chatFull != null) {
if (this.fullChats.get(j) == null) {
this.fullChats.put(j, chatFull);
getTranslateController().updateDialogFull(-j);
}
putUsers(arrayList, z);
if (chatFull.stickerset != null) {
getMediaDataController().getGroupStickerSetById(chatFull.stickerset);
}
if (chatFull.emojiset != null) {
getMediaDataController().getGroupStickerSetById(chatFull.emojiset);
}
getNotificationCenter().postNotificationName(NotificationCenter.chatInfoDidLoad, new Object[]{chatFull, 0, Boolean.valueOf(z2), Boolean.FALSE});
}
if (arrayList2 != null) {
getNotificationCenter().postNotificationName(NotificationCenter.pinnedInfoDidLoad, new Object[]{Long.valueOf(-j), arrayList2, hashMap, Integer.valueOf(i), Boolean.valueOf(z4)});
}
}
public void loadUserInfo(TLRPC$User user, boolean force, int classGuid) {
loadUserInfo(user, force, classGuid, 0);
}
public void loadUserInfo(TLRPC$User user, boolean force, int classGuid, int fromMessageId) {
getMessagesStorage().loadUserInfo(user, force, classGuid, fromMessageId);
}
public void updateUsernameActiveness(TLObject object, String username, boolean active) {
if (TextUtils.isEmpty(username)) {
return;
}
this.objectsByUsernames.remove(username);
if (active) {
this.objectsByUsernames.put(username.toLowerCase(), object);
}
}
public void processUserInfo(TLRPC$User user, TLRPC.UserFull info, boolean fromCache, boolean force, int classGuid, ArrayList<Integer> pinnedMessages, HashMap<Integer, MessageObject> pinnedMessagesMap, int totalPinnedCount, boolean pinnedEndReached) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda279(this, fromCache, user, classGuid, force, info, pinnedMessages, pinnedMessagesMap, totalPinnedCount, pinnedEndReached));
}
public void lambda$processUserInfo$145(boolean z, TLRPC$User tLRPC$User, int i, boolean z2, TLRPC.UserFull userFull, ArrayList arrayList, HashMap hashMap, int i2, boolean z3) {
if (z && System.currentTimeMillis() - this.loadedFullUsers.get(tLRPC$User.id, 0L) > 60000) {
loadFullUser(tLRPC$User, i, z2);
}
if (userFull != null) {
if (this.fullUsers.get(tLRPC$User.id) == null) {
this.fullUsers.put(tLRPC$User.id, userFull);
getTranslateController().updateDialogFull(tLRPC$User.id);
int indexOfKey = this.blockePeers.indexOfKey(tLRPC$User.id);
if (userFull.blocked) {
if (indexOfKey < 0) {
this.blockePeers.put(tLRPC$User.id, 1);
getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad, new Object[0]);
}
} else if (indexOfKey >= 0) {
this.blockePeers.removeAt(indexOfKey);
getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad, new Object[0]);
}
}
getNotificationCenter().postNotificationName(NotificationCenter.userInfoDidLoad, new Object[]{Long.valueOf(tLRPC$User.id), userFull});
}
if (arrayList != null) {
getNotificationCenter().postNotificationName(NotificationCenter.pinnedInfoDidLoad, new Object[]{Long.valueOf(tLRPC$User.id), arrayList, hashMap, Integer.valueOf(i2), Boolean.valueOf(z3)});
}
}
public void updateTimerProc() {
int i;
ArrayList arrayList;
int i2;
int i3;
long currentTimeMillis = System.currentTimeMillis();
int i4 = 0;
checkDeletingTask(false);
checkReadTasks();
if (getUserConfig().isClientActivated() && !getUserConfig().getCurrentUser().bot) {
if (!this.ignoreSetOnline && getConnectionsManager().getPauseTime() == 0 && ApplicationLoader.isScreenOn && !ApplicationLoader.mainInterfacePausedStageQueue) {
if (ApplicationLoader.mainInterfacePausedStageQueueTime != 0 && Math.abs(ApplicationLoader.mainInterfacePausedStageQueueTime - System.currentTimeMillis()) > 1000 && this.statusSettingState != 1 && (this.lastStatusUpdateTime == 0 || Math.abs(System.currentTimeMillis() - this.lastStatusUpdateTime) >= 55000 || this.offlineSent)) {
this.statusSettingState = 1;
if (this.statusRequest != 0) {
getConnectionsManager().cancelRequest(this.statusRequest, true);
}
TLRPC.TL_account_updateStatus tL_account_updateStatus = new TLRPC.TL_account_updateStatus();
tL_account_updateStatus.offline = false;
this.statusRequest = getConnectionsManager().sendRequest(tL_account_updateStatus, new MessagesController$.ExternalSyntheticLambda334(this));
}
} else if (this.statusSettingState != 2 && !this.offlineSent && Math.abs(System.currentTimeMillis() - getConnectionsManager().getPauseTime()) >= 2000) {
this.statusSettingState = 2;
if (this.statusRequest != 0) {
getConnectionsManager().cancelRequest(this.statusRequest, true);
}
TLRPC.TL_account_updateStatus tL_account_updateStatus2 = new TLRPC.TL_account_updateStatus();
tL_account_updateStatus2.offline = true;
this.statusRequest = getConnectionsManager().sendRequest(tL_account_updateStatus2, new MessagesController$.ExternalSyntheticLambda350(this));
}
if (this.updatesQueueChannels.size() != 0) {
for (int i5 = 0; i5 < this.updatesQueueChannels.size(); i5++) {
long keyAt = this.updatesQueueChannels.keyAt(i5);
if (Math.abs(currentTimeMillis - this.updatesStartWaitTimeChannels.valueAt(i5)) >= 1500) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("QUEUE CHANNEL " + keyAt + " UPDATES WAIT TIMEOUT - CHECK QUEUE");
}
processChannelsUpdatesQueue(keyAt, 0);
}
}
}
for (int i6 = 0; i6 < 3; i6++) {
if (getUpdatesStartTime(i6) != 0 && Math.abs(currentTimeMillis - getUpdatesStartTime(i6)) >= 1500) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d(i6 + " QUEUE UPDATES WAIT TIMEOUT - CHECK QUEUE");
}
processUpdatesQueue(i6, 0);
}
}
}
int currentTime = getConnectionsManager().getCurrentTime();
if (Math.abs(System.currentTimeMillis() - this.lastViewsCheckTime) >= 5000) {
this.lastViewsCheckTime = System.currentTimeMillis();
if (this.channelViewsToSend.size() != 0) {
int i7 = 0;
while (i7 < this.channelViewsToSend.size()) {
long keyAt2 = this.channelViewsToSend.keyAt(i7);
TLRPC.TL_messages_getMessagesViews tL_messages_getMessagesViews = new TLRPC.TL_messages_getMessagesViews();
tL_messages_getMessagesViews.peer = getInputPeer(keyAt2);
tL_messages_getMessagesViews.id = this.channelViewsToSend.valueAt(i7);
tL_messages_getMessagesViews.increment = i7 == 0;
getConnectionsManager().sendRequest(tL_messages_getMessagesViews, new MessagesController$.ExternalSyntheticLambda408(this, keyAt2, tL_messages_getMessagesViews));
i7++;
}
this.channelViewsToSend.clear();
}
if (this.pollsToCheckSize > 0) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda73(this, currentTime));
}
}
if (!this.onlinePrivacy.isEmpty()) {
ArrayList arrayList2 = null;
for (Map.Entry entry : this.onlinePrivacy.entrySet()) {
if (((Integer) entry.getValue()).intValue() < currentTime - 30) {
if (arrayList2 == null) {
arrayList2 = new ArrayList();
}
arrayList2.add((Long) entry.getKey());
}
}
if (arrayList2 != null) {
Iterator it = arrayList2.iterator();
while (it.hasNext()) {
this.onlinePrivacy.remove((Long) it.next());
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda38(this));
}
}
if (this.shortPollChannels.size() != 0) {
int i8 = 0;
while (i8 < this.shortPollChannels.size()) {
long keyAt3 = this.shortPollChannels.keyAt(i8);
if (this.shortPollChannels.valueAt(i8) < System.currentTimeMillis() / 1000) {
this.shortPollChannels.delete(keyAt3);
i8--;
if (this.needShortPollChannels.indexOfKey(keyAt3) >= 0) {
getChannelDifference(keyAt3);
}
}
i8++;
}
}
if (this.shortPollOnlines.size() != 0) {
long elapsedRealtime = SystemClock.elapsedRealtime() / 1000;
int i9 = 0;
while (i9 < this.shortPollOnlines.size()) {
long keyAt4 = this.shortPollOnlines.keyAt(i9);
if (this.shortPollOnlines.valueAt(i9) < elapsedRealtime) {
if (this.needShortPollChannels.indexOfKey(keyAt4) >= 0) {
this.shortPollOnlines.put(keyAt4, (int) (300 + elapsedRealtime));
} else {
this.shortPollOnlines.delete(keyAt4);
i9--;
}
TLRPC.TL_messages_getOnlines tL_messages_getOnlines = new TLRPC.TL_messages_getOnlines();
tL_messages_getOnlines.peer = getInputPeer(-keyAt4);
getConnectionsManager().sendRequest(tL_messages_getOnlines, new MessagesController$.ExternalSyntheticLambda373(this, keyAt4));
}
i9++;
}
}
if (this.printingUsers.isEmpty() && this.lastPrintingStringCount == this.printingUsers.size()) {
i = 1;
} else {
ArrayList arrayList3 = new ArrayList(this.printingUsers.keySet());
int i10 = 0;
boolean z = false;
while (i10 < arrayList3.size()) {
Long l = (Long) arrayList3.get(i10);
ConcurrentHashMap concurrentHashMap = (ConcurrentHashMap) this.printingUsers.get(l);
if (concurrentHashMap != null) {
ArrayList arrayList4 = new ArrayList(concurrentHashMap.keySet());
int i11 = 0;
while (i11 < arrayList4.size()) {
Integer num = (Integer) arrayList4.get(i11);
ArrayList arrayList5 = (ArrayList) concurrentHashMap.get(num);
if (arrayList5 != null) {
while (i4 < arrayList5.size()) {
PrintingUser printingUser = (PrintingUser) arrayList5.get(i4);
Long l2 = l;
ArrayList arrayList6 = arrayList3;
int i12 = i10;
if (printingUser.lastTime + (printingUser.action instanceof TLRPC.TL_sendMessageGamePlayAction ? 30000 : 5900) < currentTimeMillis) {
arrayList5.remove(printingUser);
i4--;
i3 = 1;
z = true;
} else {
i3 = 1;
}
i4 += i3;
l = l2;
arrayList3 = arrayList6;
i10 = i12;
}
}
ArrayList arrayList7 = arrayList3;
int i13 = i10;
Long l3 = l;
if (arrayList5 == null || arrayList5.isEmpty()) {
concurrentHashMap.remove(num);
arrayList4.remove(i11);
i11--;
}
i11++;
l = l3;
arrayList3 = arrayList7;
i10 = i13;
i4 = 0;
}
}
ArrayList arrayList8 = arrayList3;
int i14 = i10;
Long l4 = l;
if (concurrentHashMap == null || concurrentHashMap.isEmpty()) {
this.printingUsers.remove(l4);
arrayList = arrayList8;
arrayList.remove(i14);
i2 = i14 - 1;
} else {
arrayList = arrayList8;
i2 = i14;
}
i10 = i2 + 1;
arrayList3 = arrayList;
i4 = 0;
}
i = 1;
updatePrintingStrings();
if (z) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda66(this));
}
}
if (Theme.selectedAutoNightType == i && Math.abs(currentTimeMillis - lastThemeCheckTime) >= 60) {
AndroidUtilities.runOnUIThread(this.themeCheckRunnable);
lastThemeCheckTime = currentTimeMillis;
}
if (getUserConfig().savedPasswordHash != null && Math.abs(currentTimeMillis - lastPasswordCheckTime) >= 60) {
AndroidUtilities.runOnUIThread(this.passwordCheckRunnable);
lastPasswordCheckTime = currentTimeMillis;
}
if (this.lastPushRegisterSendTime != 0 && Math.abs(SystemClock.elapsedRealtime() - this.lastPushRegisterSendTime) >= 10800000) {
PushListenerController.sendRegistrationToServer(SharedConfig.pushType, SharedConfig.pushString);
}
getLocationController().update();
lambda$checkPromoInfo$158(false);
checkTosUpdate();
}
public void lambda$updateTimerProc$146(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
this.lastStatusUpdateTime = System.currentTimeMillis();
this.offlineSent = false;
this.statusSettingState = 0;
} else {
long j = this.lastStatusUpdateTime;
if (j != 0) {
this.lastStatusUpdateTime = j + 5000;
}
}
this.statusRequest = 0;
}
public void lambda$updateTimerProc$147(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
this.offlineSent = true;
} else {
long j = this.lastStatusUpdateTime;
if (j != 0) {
this.lastStatusUpdateTime = j + 5000;
}
}
this.statusRequest = 0;
}
public void lambda$updateTimerProc$149(long j, TLRPC.TL_messages_getMessagesViews tL_messages_getMessagesViews, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
TLRPC.TL_messages_messageViews tL_messages_messageViews = (TLRPC.TL_messages_messageViews) tLObject;
LongSparseArray longSparseArray = new LongSparseArray();
LongSparseArray longSparseArray2 = new LongSparseArray();
LongSparseArray longSparseArray3 = new LongSparseArray();
SparseIntArray sparseIntArray = (SparseIntArray) longSparseArray.get(j);
SparseIntArray sparseIntArray2 = (SparseIntArray) longSparseArray2.get(j);
SparseArray sparseArray = (SparseArray) longSparseArray3.get(j);
for (int i = 0; i < tL_messages_getMessagesViews.id.size() && i < tL_messages_messageViews.views.size(); i++) {
TLRPC.TL_messageViews tL_messageViews = (TLRPC.TL_messageViews) tL_messages_messageViews.views.get(i);
if ((1 & tL_messageViews.flags) != 0) {
if (sparseIntArray == null) {
sparseIntArray = new SparseIntArray();
longSparseArray.put(j, sparseIntArray);
}
sparseIntArray.put(((Integer) tL_messages_getMessagesViews.id.get(i)).intValue(), tL_messageViews.views);
}
if ((tL_messageViews.flags & 2) != 0) {
if (sparseIntArray2 == null) {
sparseIntArray2 = new SparseIntArray();
longSparseArray2.put(j, sparseIntArray2);
}
sparseIntArray2.put(((Integer) tL_messages_getMessagesViews.id.get(i)).intValue(), tL_messageViews.forwards);
}
if ((tL_messageViews.flags & 4) != 0) {
if (sparseArray == null) {
sparseArray = new SparseArray();
longSparseArray3.put(j, sparseArray);
}
sparseArray.put(((Integer) tL_messages_getMessagesViews.id.get(i)).intValue(), tL_messageViews.replies);
}
}
getMessagesStorage().putUsersAndChats(tL_messages_messageViews.users, tL_messages_messageViews.chats, true, true);
getMessagesStorage().putChannelViews(longSparseArray, longSparseArray2, longSparseArray3, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda241(this, tL_messages_messageViews, longSparseArray, longSparseArray2, longSparseArray3));
}
}
public void lambda$updateTimerProc$148(TLRPC.TL_messages_messageViews tL_messages_messageViews, LongSparseArray longSparseArray, LongSparseArray longSparseArray2, LongSparseArray longSparseArray3) {
putUsers(tL_messages_messageViews.users, false);
putChats(tL_messages_messageViews.chats, false);
getNotificationCenter().postNotificationName(NotificationCenter.didUpdateMessagesViews, new Object[]{longSparseArray, longSparseArray2, longSparseArray3, Boolean.FALSE});
}
public void lambda$updateTimerProc$151(int r18) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$updateTimerProc$151(int):void");
}
public void lambda$updateTimerProc$150(boolean z, TLObject tLObject, TLRPC.TL_error tL_error) {
TLRPC.Poll poll;
if (tL_error == null) {
TLRPC.Updates updates = (TLRPC.Updates) tLObject;
if (z) {
for (int i = 0; i < updates.updates.size(); i++) {
TLRPC.TL_updateMessagePoll tL_updateMessagePoll = (TLRPC$Update) updates.updates.get(i);
if ((tL_updateMessagePoll instanceof TLRPC.TL_updateMessagePoll) && (poll = tL_updateMessagePoll.poll) != null && !poll.closed) {
this.lastViewsCheckTime = System.currentTimeMillis() - 4000;
}
}
}
processUpdates(updates, false);
}
}
public void lambda$updateTimerProc$152() {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_STATUS)});
}
public void lambda$updateTimerProc$154(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
TLRPC.TL_chatOnlines tL_chatOnlines = (TLRPC.TL_chatOnlines) tLObject;
getMessagesStorage().updateChatOnlineCount(j, tL_chatOnlines.onlines);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda137(this, j, tL_chatOnlines));
}
}
public void lambda$updateTimerProc$153(long j, TLRPC.TL_chatOnlines tL_chatOnlines) {
getNotificationCenter().postNotificationName(NotificationCenter.chatOnlineCountDidLoad, new Object[]{Long.valueOf(j), Integer.valueOf(tL_chatOnlines.onlines)});
}
public void lambda$updateTimerProc$155() {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_USER_PRINT)});
}
private void checkTosUpdate() {
if (this.nextTosCheckTime > getConnectionsManager().getCurrentTime() || this.checkingTosUpdate || !getUserConfig().isClientActivated()) {
return;
}
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
this.checkingTosUpdate = true;
getConnectionsManager().sendRequest(new TLRPC.TL_help_getTermsOfServiceUpdate(), new MessagesController$.ExternalSyntheticLambda327(this));
}
}
public void lambda$checkTosUpdate$157(TLObject tLObject, TLRPC.TL_error tL_error) {
this.checkingTosUpdate = false;
if (tLObject instanceof TLRPC.TL_help_termsOfServiceUpdateEmpty) {
this.nextTosCheckTime = ((TLRPC.TL_help_termsOfServiceUpdateEmpty) tLObject).expires;
} else if (tLObject instanceof TLRPC.TL_help_termsOfServiceUpdate) {
TLRPC.TL_help_termsOfServiceUpdate tL_help_termsOfServiceUpdate = (TLRPC.TL_help_termsOfServiceUpdate) tLObject;
this.nextTosCheckTime = tL_help_termsOfServiceUpdate.expires;
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda237(this, tL_help_termsOfServiceUpdate));
} else {
this.nextTosCheckTime = getConnectionsManager().getCurrentTime() + 3600;
}
this.notificationsPreferences.edit().putInt("nextTosCheckTime", this.nextTosCheckTime).commit();
}
public void lambda$checkTosUpdate$156(TLRPC.TL_help_termsOfServiceUpdate tL_help_termsOfServiceUpdate) {
getNotificationCenter().postNotificationName(NotificationCenter.needShowAlert, new Object[]{4, tL_help_termsOfServiceUpdate.terms_of_service});
}
public void checkPromoInfo(final boolean reset) {
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda274(this, reset));
}
public ArrayList<TLRPC.Dialog> getDialogs(int type, int folderId) {
ArrayList<TLRPC.Dialog> arrayList;
switch (type) {
case 20:
arrayList = this.dialogsUsersByFolder.get(folderId);
break;
case 21:
arrayList = this.dialogsGroupsByFolder.get(folderId);
break;
case 22:
arrayList = this.dialogsMegaGroupsByFolder.get(folderId);
break;
case 23:
arrayList = this.dialogsGroupsAllByFolder.get(folderId);
break;
case 24:
arrayList = this.dialogsChannelsByFolder.get(folderId);
break;
case 25:
arrayList = this.dialogsBotsByFolder.get(folderId);
break;
case 26:
arrayList = this.dialogsFavsByFolder.get(folderId);
break;
case 27:
arrayList = this.dialogsAdminByFolder.get(folderId);
break;
case 28:
arrayList = this.dialogsUnreadByFolder.get(folderId);
break;
default:
return getDialogs(folderId);
}
return arrayList == null ? new ArrayList<>() : arrayList;
}
private long getPlusPromoDialog() {
if (PlusSettings.isPlusPromoDialogEnabled()) {
return PlusSettings.plusPromoDialogId;
}
return 0L;
}
private String getPlusPromoDialogUsername() {
return !PlusSettings.isPlusPromoDialogEnabled() ? "" : !TextUtils.isEmpty(PlusSettings.plusPromoDialogUsername) ? PlusSettings.plusPromoDialogUsername : "plusmsgr";
}
private TLObject checkPlusPromo(TLObject response) {
if (response instanceof TLRPC.TL_help_promoData) {
return response;
}
long plusPromoDialog = getPlusPromoDialog();
long j = this.plusPromoChannelDeleted;
if (j != 0 && j == plusPromoDialog) {
this.promoDialogId = 0L;
return response;
}
TLRPC.TL_help_promoData tL_help_promoData = new TLRPC.TL_help_promoData();
tL_help_promoData.peer = getPeer(plusPromoDialog);
TLRPC.Chat[] chatArr = {getChat(Long.valueOf(-plusPromoDialog))};
if (chatArr[0] == null) {
if (!TextUtils.isEmpty(getPlusPromoDialogUsername())) {
if (this.isResolvingPromo) {
return response;
}
this.isResolvingPromo = true;
UserHelper.getInstance(this.currentAccount).resolveChat(getPlusPromoDialogUsername(), plusPromoDialog, new 5(this, chatArr));
}
} else {
tL_help_promoData.chats.add(chatArr[0]);
tL_help_promoData.expires = getConnectionsManager().getCurrentTime() + 3600;
}
Bundle bundle = new Bundle();
bundle.putString("username", getPlusPromoDialogUsername());
bundle.putString("id", plusPromoDialog + "");
bundle.putString("chat", chatArr[0] == null ? "null" : chatArr[0].username);
FirebaseHelper.getInstance().sendAnalytics("checkPlusPromo", bundle);
return tL_help_promoData;
}
private void sendPromoAnalytics() {
if (this.promoDialog != null) {
Bundle bundle = new Bundle();
bundle.putString("username", getPlusPromoDialogUsername());
TLRPC.Chat chat = this.plusPromoChat;
bundle.putString("chat", chat == null ? "null" : chat.username);
bundle.putLong("channel_id", this.promoDialog.peer.channel_id);
bundle.putBoolean("hidden", this.promoDialog.hidden);
bundle.putLong("id", this.promoDialog.id);
bundle.putInt("folder_id", this.promoDialog.folder_id);
bundle.putInt("versionCode", SharedConfig.buildVersion());
bundle.putString("version", BuildVars.BUILD_VERSION_STRING);
FirebaseHelper.getInstance().sendAnalytics("sendPromoAnalytics", bundle);
}
}
public void lambda$checkPromoInfo$158(boolean reset) {
String str;
boolean z = false;
if (reset && this.checkingPromoInfo) {
this.checkingPromoInfo = false;
}
if ((reset || this.nextPromoInfoCheckTime <= getConnectionsManager().getCurrentTime()) && !this.checkingPromoInfo) {
if (this.checkingPromoInfoRequestId != 0) {
getConnectionsManager().cancelRequest(this.checkingPromoInfoRequestId, true);
this.checkingPromoInfoRequestId = 0;
}
SharedPreferences globalMainSettings = getGlobalMainSettings();
globalMainSettings.getBoolean("proxy_enabled", false);
String string = globalMainSettings.getString("proxy_ip", "");
String string2 = globalMainSettings.getString("proxy_secret", "");
if (PlusSettings.hideProxySponsor) {
this.promoDialogId = 0L;
}
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
if (this.promoDialogId != 0 && this.promoDialogType == PROMO_TYPE_PROXY && (str = this.proxyDialogAddress) != null) {
if (!str.equals(string + string2)) {
z = true;
}
}
int i = this.lastCheckPromoId + 1;
this.lastCheckPromoId = i;
this.checkingPromoInfo = true;
this.checkingPromoInfoRequestId = getConnectionsManager().sendRequest(new TLRPC.TL_help_getPromoData(), new MessagesController$.ExternalSyntheticLambda366(this, i, string, string2));
if (z) {
this.promoDialogId = 0L;
this.proxyDialogAddress = null;
this.nextPromoInfoCheckTime = getConnectionsManager().getCurrentTime() + 3600;
getGlobalMainSettings().edit().putLong("proxy_dialog", this.promoDialogId).remove("proxyDialogAddress").putInt("nextPromoInfoCheckTime", this.nextPromoInfoCheckTime).commit();
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda35(this));
}
}
}
}
public void lambda$checkPromoInfoInternal$163(int r17, java.lang.String r18, java.lang.String r19, org.telegram.tgnet.TLObject r20, org.telegram.tgnet.TLRPC.TL_error r21) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$checkPromoInfoInternal$163(int, java.lang.String, java.lang.String, org.telegram.tgnet.TLObject, org.telegram.tgnet.TLRPC$TL_error):void");
}
public void lambda$checkPromoInfoInternal$162(long j, TLRPC.TL_help_promoData tL_help_promoData, int i) {
TLRPC.Dialog dialog = this.promoDialog;
if (dialog != null && j != dialog.id) {
removePromoDialog();
}
TLRPC.Dialog dialog2 = this.dialogs_dict.get(j);
this.promoDialog = dialog2;
if (dialog2 != null) {
this.checkingPromoInfo = false;
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[]{Boolean.TRUE});
return;
}
LongSparseArray longSparseArray = new LongSparseArray();
LongSparseArray longSparseArray2 = new LongSparseArray();
for (int i2 = 0; i2 < tL_help_promoData.users.size(); i2++) {
TLRPC$User tLRPC$User = (TLRPC$User) tL_help_promoData.users.get(i2);
longSparseArray.put(tLRPC$User.id, tLRPC$User);
}
for (int i3 = 0; i3 < tL_help_promoData.chats.size(); i3++) {
TLRPC.Chat chat = (TLRPC.Chat) tL_help_promoData.chats.get(i3);
longSparseArray2.put(chat.id, chat);
}
TLRPC.TL_messages_getPeerDialogs tL_messages_getPeerDialogs = new TLRPC.TL_messages_getPeerDialogs();
TLRPC.TL_inputDialogPeer tL_inputDialogPeer = new TLRPC.TL_inputDialogPeer();
TLRPC.Peer peer = tL_help_promoData.peer;
if (peer.user_id != 0) {
TLRPC.TL_inputPeerUser tL_inputPeerUser = new TLRPC.TL_inputPeerUser();
tL_inputDialogPeer.peer = tL_inputPeerUser;
long j2 = tL_help_promoData.peer.user_id;
((TLRPC.InputPeer) tL_inputPeerUser).user_id = j2;
TLRPC$User tLRPC$User2 = (TLRPC$User) longSparseArray.get(j2);
if (tLRPC$User2 != null) {
tL_inputDialogPeer.peer.access_hash = tLRPC$User2.access_hash;
}
} else if (peer.chat_id != 0) {
TLRPC.TL_inputPeerChat tL_inputPeerChat = new TLRPC.TL_inputPeerChat();
tL_inputDialogPeer.peer = tL_inputPeerChat;
long j3 = tL_help_promoData.peer.chat_id;
((TLRPC.InputPeer) tL_inputPeerChat).chat_id = j3;
TLRPC.Chat chat2 = (TLRPC.Chat) longSparseArray2.get(j3);
if (chat2 != null) {
tL_inputDialogPeer.peer.access_hash = chat2.access_hash;
}
} else {
TLRPC.TL_inputPeerChannel tL_inputPeerChannel = new TLRPC.TL_inputPeerChannel();
tL_inputDialogPeer.peer = tL_inputPeerChannel;
long j4 = tL_help_promoData.peer.channel_id;
((TLRPC.InputPeer) tL_inputPeerChannel).channel_id = j4;
TLRPC.Chat chat3 = (TLRPC.Chat) longSparseArray2.get(j4);
if (chat3 != null) {
tL_inputDialogPeer.peer.access_hash = chat3.access_hash;
}
}
if (this.promoDialogType == PROMO_TYPE_OTHER && tL_inputDialogPeer.peer.access_hash == 0) {
this.checkingPromoInfoRequestId = 0;
this.checkingPromoInfo = false;
} else {
tL_messages_getPeerDialogs.peers.add(tL_inputDialogPeer);
this.checkingPromoInfoRequestId = getConnectionsManager().sendRequest(tL_messages_getPeerDialogs, new MessagesController$.ExternalSyntheticLambda369(this, i, tL_help_promoData, j));
}
}
public void lambda$checkPromoInfoInternal$161(int i, TLRPC.TL_help_promoData tL_help_promoData, long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (i != this.lastCheckPromoId) {
return;
}
this.checkingPromoInfoRequestId = 0;
TLRPC.TL_messages_peerDialogs tL_messages_peerDialogs = (TLRPC.TL_messages_peerDialogs) tLObject;
if (tL_messages_peerDialogs != null && !tL_messages_peerDialogs.dialogs.isEmpty()) {
getMessagesStorage().putUsersAndChats(tL_help_promoData.users, tL_help_promoData.chats, true, true);
TLRPC.TL_messages_dialogs tL_messages_dialogs = new TLRPC.TL_messages_dialogs();
((TLRPC.messages_Dialogs) tL_messages_dialogs).chats = tL_messages_peerDialogs.chats;
((TLRPC.messages_Dialogs) tL_messages_dialogs).users = tL_messages_peerDialogs.users;
((TLRPC.messages_Dialogs) tL_messages_dialogs).dialogs = tL_messages_peerDialogs.dialogs;
((TLRPC.messages_Dialogs) tL_messages_dialogs).messages = tL_messages_peerDialogs.messages;
getMessagesStorage().putDialogs(tL_messages_dialogs, 2);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda236(this, tL_help_promoData, tL_messages_peerDialogs, j));
} else {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda57(this));
}
this.checkingPromoInfo = false;
}
public void lambda$checkPromoInfoInternal$159(TLRPC.TL_help_promoData tL_help_promoData, TLRPC.TL_messages_peerDialogs tL_messages_peerDialogs, long j) {
putUsers(tL_help_promoData.users, false);
putChats(tL_help_promoData.chats, false);
putUsers(tL_messages_peerDialogs.users, false);
putChats(tL_messages_peerDialogs.chats, false);
TLRPC.Dialog dialog = this.promoDialog;
if (dialog != null) {
long j2 = dialog.id;
if (j2 < 0) {
TLRPC.Chat chat = getChat(Long.valueOf(-j2));
if (ChatObject.isNotInChat(chat) || chat.restricted) {
removeDialog(this.promoDialog);
}
} else {
removeDialog(dialog);
}
}
TLRPC.Dialog dialog2 = (TLRPC.Dialog) tL_messages_peerDialogs.dialogs.get(0);
this.promoDialog = dialog2;
dialog2.id = j;
dialog2.folder_id = 0;
long j3 = this.plusPromoChannelArchived;
if (j3 != 0 && j3 == j) {
dialog2.folder_id = 1;
}
sendPromoAnalytics();
if (DialogObject.isChannel(this.promoDialog)) {
LongSparseIntArray longSparseIntArray = this.channelsPts;
TLRPC.Dialog dialog3 = this.promoDialog;
longSparseIntArray.put(-dialog3.id, dialog3.pts);
}
Integer num = (Integer) this.dialogs_read_inbox_max.get(Long.valueOf(this.promoDialog.id));
if (num == null) {
num = r2;
}
this.dialogs_read_inbox_max.put(Long.valueOf(this.promoDialog.id), Integer.valueOf(Math.max(num.intValue(), this.promoDialog.read_inbox_max_id)));
Integer num2 = (Integer) this.dialogs_read_outbox_max.get(Long.valueOf(this.promoDialog.id));
this.dialogs_read_outbox_max.put(Long.valueOf(this.promoDialog.id), Integer.valueOf(Math.max((num2 != null ? num2 : 0).intValue(), this.promoDialog.read_outbox_max_id)));
this.dialogs_dict.put(j, this.promoDialog);
if (!tL_messages_peerDialogs.messages.isEmpty()) {
LongSparseArray longSparseArray = new LongSparseArray();
LongSparseArray longSparseArray2 = new LongSparseArray();
for (int i = 0; i < tL_messages_peerDialogs.users.size(); i++) {
TLRPC$User tLRPC$User = (TLRPC$User) tL_messages_peerDialogs.users.get(i);
longSparseArray.put(tLRPC$User.id, tLRPC$User);
}
for (int i2 = 0; i2 < tL_messages_peerDialogs.chats.size(); i2++) {
TLRPC.Chat chat2 = (TLRPC.Chat) tL_messages_peerDialogs.chats.get(i2);
longSparseArray2.put(chat2.id, chat2);
}
MessageObject messageObject = new MessageObject(this.currentAccount, (TLRPC.Message) tL_messages_peerDialogs.messages.get(0), longSparseArray, longSparseArray2, false, true);
ArrayList<MessageObject> arrayList = this.dialogMessage.get(j);
if (arrayList == null) {
arrayList = new ArrayList<>(1);
}
if (arrayList.size() > 0 && arrayList.get(0) != null && arrayList.get(0).hasValidGroupId() && arrayList.get(0).getGroupIdForUse() != messageObject.getGroupIdForUse()) {
arrayList.clear();
}
arrayList.add(messageObject);
this.dialogMessage.put(j, arrayList);
TLRPC.Dialog dialog4 = this.promoDialog;
if (dialog4.last_message_date == 0) {
dialog4.last_message_date = messageObject.messageOwner.date;
}
getTranslateController().checkDialogMessage(j);
}
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[]{Boolean.TRUE});
}
public void lambda$checkPromoInfoInternal$160() {
TLRPC.Dialog dialog = this.promoDialog;
if (dialog != null) {
long j = dialog.id;
if (j < 0) {
TLRPC.Chat chat = getChat(Long.valueOf(-j));
if (ChatObject.isNotInChat(chat) || chat.restricted) {
removeDialog(this.promoDialog);
}
} else {
removeDialog(dialog);
}
this.promoDialog = null;
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
}
public void removePromoDialog() {
TLRPC.Dialog dialog = this.promoDialog;
if (dialog == null) {
return;
}
long j = dialog.id;
if (j < 0) {
TLRPC.Chat chat = getChat(Long.valueOf(-j));
if (ChatObject.isNotInChat(chat) || chat.restricted) {
removeDialog(this.promoDialog);
}
} else {
removeDialog(dialog);
}
this.promoDialog = null;
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
public boolean isPromoDialog(long did, boolean checkLeft) {
TLRPC.Dialog dialog = this.promoDialog;
return dialog != null && dialog.id == did && (!checkLeft || this.isLeftPromoChannel);
}
private String getUserNameForTyping(TLRPC$User user) {
if (user == null) {
return "";
}
String str = user.first_name;
if (str != null && str.length() > 0) {
return user.first_name;
}
String str2 = user.last_name;
return (str2 == null || str2.length() <= 0) ? "" : user.last_name;
}
private void updatePrintingStrings() {
Iterator it;
Iterator it2;
String string;
int i;
String str;
int i2;
String formatString;
LongSparseArray longSparseArray = new LongSparseArray();
LongSparseArray longSparseArray2 = new LongSparseArray();
Iterator it3 = this.printingUsers.entrySet().iterator();
while (it3.hasNext()) {
Map.Entry entry = (Map.Entry) it3.next();
Long l = (Long) entry.getKey();
boolean isEncryptedDialog = DialogObject.isEncryptedDialog(l.longValue());
Iterator it4 = ((ConcurrentHashMap) entry.getValue()).entrySet().iterator();
while (it4.hasNext()) {
Map.Entry entry2 = (Map.Entry) it4.next();
Integer num = (Integer) entry2.getKey();
ArrayList arrayList = (ArrayList) entry2.getValue();
LongSparseArray longSparseArray3 = new LongSparseArray();
LongSparseArray longSparseArray4 = new LongSparseArray();
longSparseArray.put(l.longValue(), longSparseArray3);
longSparseArray2.put(l.longValue(), longSparseArray4);
if (PlusSettings.getIgnoreBlocked()) {
arrayList = (ArrayList) Collection.-EL.stream(arrayList).filter(new MessagesController$.ExternalSyntheticLambda309(this)).collect(Collectors.toCollection(MessagesController$.ExternalSyntheticLambda310.INSTANCE));
}
if (!arrayList.isEmpty()) {
if (l.longValue() > 0 || isEncryptedDialog || arrayList.size() == 1) {
it = it3;
it2 = it4;
PrintingUser printingUser = (PrintingUser) arrayList.get(0);
TLRPC$User user = getUser(Long.valueOf(printingUser.userId));
if (user != null) {
boolean z = l.longValue() < 0 && !isEncryptedDialog;
TLRPC.TL_sendMessageEmojiInteractionSeen tL_sendMessageEmojiInteractionSeen = printingUser.action;
if (tL_sendMessageEmojiInteractionSeen instanceof TLRPC.TL_sendMessageRecordAudioAction) {
if (z) {
string = LocaleController.formatString("IsRecordingAudio", R.string.IsRecordingAudio, getUserNameForTyping(user));
} else {
string = LocaleController.getString("RecordingAudio", R.string.RecordingAudio);
}
i = 1;
} else {
if (tL_sendMessageEmojiInteractionSeen instanceof TLRPC.TL_sendMessageRecordRoundAction) {
if (z) {
string = LocaleController.formatString("IsRecordingRound", R.string.IsRecordingRound, getUserNameForTyping(user));
} else {
string = LocaleController.getString("RecordingRound", R.string.RecordingRound);
}
} else if (!(tL_sendMessageEmojiInteractionSeen instanceof TLRPC.TL_sendMessageUploadRoundAction)) {
if (tL_sendMessageEmojiInteractionSeen instanceof TLRPC.TL_sendMessageUploadAudioAction) {
if (z) {
string = LocaleController.formatString("IsSendingAudio", R.string.IsSendingAudio, getUserNameForTyping(user));
} else {
string = LocaleController.getString("SendingAudio", R.string.SendingAudio);
}
} else if (tL_sendMessageEmojiInteractionSeen instanceof TLRPC.TL_sendMessageUploadVideoAction) {
if (z) {
string = LocaleController.formatString("IsSendingVideo", R.string.IsSendingVideo, getUserNameForTyping(user));
} else {
string = LocaleController.getString("SendingVideoStatus", R.string.SendingVideoStatus);
}
} else if (tL_sendMessageEmojiInteractionSeen instanceof TLRPC.TL_sendMessageRecordVideoAction) {
if (z) {
string = LocaleController.formatString("IsRecordingVideo", R.string.IsRecordingVideo, getUserNameForTyping(user));
} else {
string = LocaleController.getString("RecordingVideoStatus", R.string.RecordingVideoStatus);
}
} else if (tL_sendMessageEmojiInteractionSeen instanceof TLRPC.TL_sendMessageUploadDocumentAction) {
if (z) {
string = LocaleController.formatString("IsSendingFile", R.string.IsSendingFile, getUserNameForTyping(user));
} else {
string = LocaleController.getString("SendingFile", R.string.SendingFile);
}
} else if (tL_sendMessageEmojiInteractionSeen instanceof TLRPC.TL_sendMessageUploadPhotoAction) {
if (z) {
string = LocaleController.formatString("IsSendingPhoto", R.string.IsSendingPhoto, getUserNameForTyping(user));
} else {
string = LocaleController.getString("SendingPhoto", R.string.SendingPhoto);
}
} else if (tL_sendMessageEmojiInteractionSeen instanceof TLRPC.TL_sendMessageGamePlayAction) {
if (z) {
string = LocaleController.formatString("IsSendingGame", R.string.IsSendingGame, getUserNameForTyping(user));
} else {
string = LocaleController.getString("SendingGame", R.string.SendingGame);
}
i = 3;
} else {
if (tL_sendMessageEmojiInteractionSeen instanceof TLRPC.TL_sendMessageGeoLocationAction) {
if (z) {
string = LocaleController.formatString("IsSelectingLocation", R.string.IsSelectingLocation, getUserNameForTyping(user));
} else {
string = LocaleController.getString("SelectingLocation", R.string.SelectingLocation);
}
} else if (!(tL_sendMessageEmojiInteractionSeen instanceof TLRPC.TL_sendMessageChooseContactAction)) {
if (tL_sendMessageEmojiInteractionSeen instanceof TLRPC.TL_sendMessageEmojiInteractionSeen) {
String str2 = tL_sendMessageEmojiInteractionSeen.emoticon;
if (z) {
string = LocaleController.formatString("IsEnjoyngAnimations", R.string.IsEnjoyngAnimations, getUserNameForTyping(user), str2);
} else {
string = LocaleController.formatString("EnjoyngAnimations", R.string.EnjoyngAnimations, str2);
}
} else if (tL_sendMessageEmojiInteractionSeen instanceof TLRPC.TL_sendMessageChooseStickerAction) {
if (z) {
string = LocaleController.formatString("IsChoosingSticker", R.string.IsChoosingSticker, getUserNameForTyping(user));
} else {
string = LocaleController.getString("ChoosingSticker", R.string.ChoosingSticker);
}
} else if (z) {
string = LocaleController.formatString("IsTypingGroup", R.string.IsTypingGroup, getUserNameForTyping(user));
} else {
string = LocaleController.getString("Typing", R.string.Typing);
}
i = 5;
} else if (z) {
string = LocaleController.formatString("IsSelectingContact", R.string.IsSelectingContact, getUserNameForTyping(user));
} else {
string = LocaleController.getString("SelectingContact", R.string.SelectingContact);
}
i = 0;
}
i = 2;
} else if (z) {
string = LocaleController.formatString("IsSendingVideo", R.string.IsSendingVideo, getUserNameForTyping(user));
} else {
string = LocaleController.getString("SendingVideoStatus", R.string.SendingVideoStatus);
}
i = 4;
}
int i3 = i;
str = string;
i2 = i3;
}
it3 = it;
it4 = it2;
} else {
StringBuilder sb = new StringBuilder();
Iterator it5 = arrayList.iterator();
int i4 = 0;
while (true) {
if (!it5.hasNext()) {
it = it3;
it2 = it4;
break;
}
it = it3;
it2 = it4;
TLRPC$User user2 = getUser(Long.valueOf(((PrintingUser) it5.next()).userId));
if (user2 != null) {
if (sb.length() != 0) {
sb.append(", ");
}
sb.append(getUserNameForTyping(user2));
i4++;
}
if (i4 == 2) {
break;
}
it3 = it;
it4 = it2;
}
if (sb.length() != 0) {
if (i4 == 1) {
formatString = LocaleController.formatString("IsTypingGroup", R.string.IsTypingGroup, sb.toString());
} else if (arrayList.size() > 2) {
try {
formatString = String.format(LocaleController.getPluralString("AndMoreTypingGroup", arrayList.size() - 2), sb.toString(), Integer.valueOf(arrayList.size() - 2));
} catch (Exception unused) {
formatString = "LOC_ERR: AndMoreTypingGroup";
}
} else {
formatString = LocaleController.formatString("AreTypingGroup", R.string.AreTypingGroup, sb.toString());
str = formatString;
i2 = 0;
}
str = formatString;
i2 = 0;
} else {
i2 = 0;
str = null;
}
}
if (str != null) {
Paint paint = Theme.dialogs_messageNamePaint;
if (paint == null) {
paint = new Paint();
paint.setTypeface(AndroidUtilities.bold());
paint.setTextSize(AndroidUtilities.dp(14.0f));
}
longSparseArray3.put(num.intValue(), Emoji.replaceEmoji(str, paint.getFontMetricsInt(), false));
longSparseArray4.put(num.intValue(), Integer.valueOf(i2));
}
it3 = it;
it4 = it2;
}
}
}
this.lastPrintingStringCount = longSparseArray.size();
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda149(this, longSparseArray, longSparseArray2));
}
public boolean lambda$updatePrintingStrings$164(PrintingUser printingUser) {
return getMessagesController().blockePeers.indexOfKey(printingUser.userId) == -1;
}
public void lambda$updatePrintingStrings$165(LongSparseArray longSparseArray, LongSparseArray longSparseArray2) {
this.printingStrings = longSparseArray;
this.printingStringsTypes = longSparseArray2;
if (this.lastPrintingStringCount <= 0 || !Theme.plusShowTypingToast || AndroidUtilities.playingAGame) {
return;
}
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.showStatusNotifications, new Object[]{0L, Boolean.FALSE});
}
public String getTypingUserName(TLRPC$User user) {
return getUserNameForTyping(user);
}
public void lambda$sendTyping$168(int action, long dialogId, long threadMsgId) {
LongSparseArray<LongSparseArray<Boolean>> longSparseArray;
LongSparseArray<Boolean> longSparseArray2;
if (action >= 0) {
LongSparseArray<LongSparseArray<Boolean>>[] longSparseArrayArr = this.sendingTypings;
if (action >= longSparseArrayArr.length || longSparseArrayArr[action] == null || (longSparseArray2 = (longSparseArray = longSparseArrayArr[action]).get(dialogId)) == null) {
return;
}
longSparseArray2.remove(threadMsgId);
if (longSparseArray2.size() == 0) {
longSparseArray.remove(dialogId);
}
}
}
public boolean sendTyping(long dialogId, long threadMsgId, int action, int classGuid) {
return sendTyping(dialogId, threadMsgId, action, null, classGuid);
}
public boolean sendTyping(long dialogId, long threadMsgId, int action, String emojicon, int classGuid) {
TLRPC.Chat chat;
if (action < 0 || action >= this.sendingTypings.length || dialogId == 0) {
return false;
}
long clientUserId = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId();
if (dialogId == clientUserId) {
return false;
}
if (dialogId < 0) {
long j = -dialogId;
if (ChatObject.getSendAsPeerId(getChat(Long.valueOf(j)), getChatFull(j)) != clientUserId) {
return false;
}
} else {
TLRPC$User user = getUser(Long.valueOf(dialogId));
if (user != null) {
if (user.id == getUserConfig().getClientUserId()) {
return false;
}
TLRPC.UserStatus userStatus = user.status;
if (userStatus != null && userStatus.expires != -100 && !this.onlinePrivacy.containsKey(Long.valueOf(user.id))) {
if (user.status.expires <= getConnectionsManager().getCurrentTime() - 30) {
return false;
}
}
}
}
LongSparseArray<LongSparseArray<Boolean>>[] longSparseArrayArr = this.sendingTypings;
LongSparseArray<LongSparseArray<Boolean>> longSparseArray = longSparseArrayArr[action];
if (longSparseArray == null) {
longSparseArray = new LongSparseArray<>();
longSparseArrayArr[action] = longSparseArray;
}
LongSparseArray<Boolean> longSparseArray2 = longSparseArray.get(dialogId);
if (longSparseArray2 == null) {
longSparseArray2 = new LongSparseArray<>();
longSparseArray.put(dialogId, longSparseArray2);
}
if (longSparseArray2.get(threadMsgId) != null) {
return false;
}
if (!DialogObject.isEncryptedDialog(dialogId)) {
TLRPC.TL_messages_setTyping tL_messages_setTyping = new TLRPC.TL_messages_setTyping();
if (threadMsgId != 0) {
tL_messages_setTyping.top_msg_id = (int) threadMsgId;
tL_messages_setTyping.flags |= 1;
}
TLRPC.InputPeer inputPeer = getInputPeer(dialogId);
tL_messages_setTyping.peer = inputPeer;
if (((inputPeer instanceof TLRPC.TL_inputPeerChannel) && ((chat = getChat(Long.valueOf(inputPeer.channel_id))) == null || !chat.megagroup)) || tL_messages_setTyping.peer == null) {
return false;
}
if (action == 0) {
tL_messages_setTyping.action = new TLRPC.TL_sendMessageTypingAction();
} else if (action == 1) {
tL_messages_setTyping.action = new TLRPC.TL_sendMessageRecordAudioAction();
} else if (action == 2) {
tL_messages_setTyping.action = new TLRPC.TL_sendMessageCancelAction();
} else if (action == 3) {
tL_messages_setTyping.action = new TLRPC.TL_sendMessageUploadDocumentAction();
} else if (action == 4) {
tL_messages_setTyping.action = new TLRPC.TL_sendMessageUploadPhotoAction();
} else if (action == 5) {
tL_messages_setTyping.action = new TLRPC.TL_sendMessageUploadVideoAction();
} else if (action == 6) {
tL_messages_setTyping.action = new TLRPC.TL_sendMessageGamePlayAction();
} else if (action == 7) {
tL_messages_setTyping.action = new TLRPC.TL_sendMessageRecordRoundAction();
} else if (action == 8) {
tL_messages_setTyping.action = new TLRPC.TL_sendMessageUploadRoundAction();
} else if (action == 9) {
tL_messages_setTyping.action = new TLRPC.TL_sendMessageUploadAudioAction();
} else if (action == 10) {
tL_messages_setTyping.action = new TLRPC.TL_sendMessageChooseStickerAction();
} else if (action == 11) {
TLRPC.TL_sendMessageEmojiInteractionSeen tL_sendMessageEmojiInteractionSeen = new TLRPC.TL_sendMessageEmojiInteractionSeen();
tL_sendMessageEmojiInteractionSeen.emoticon = emojicon;
tL_messages_setTyping.action = tL_sendMessageEmojiInteractionSeen;
}
longSparseArray2.put(threadMsgId, Boolean.TRUE);
int sendRequest = getConnectionsManager().sendRequest(tL_messages_setTyping, new MessagesController$.ExternalSyntheticLambda363(this, action, dialogId, threadMsgId), 2);
if (classGuid != 0) {
getConnectionsManager().bindRequestToGuid(sendRequest, classGuid);
}
} else {
if (action != 0) {
return false;
}
TLRPC.EncryptedChat encryptedChat = getEncryptedChat(Integer.valueOf(DialogObject.getEncryptedChatId(dialogId)));
byte[] bArr = encryptedChat.auth_key;
if (bArr != null && bArr.length > 1 && (encryptedChat instanceof TLRPC.TL_encryptedChat)) {
TLRPC.TL_messages_setEncryptedTyping tL_messages_setEncryptedTyping = new TLRPC.TL_messages_setEncryptedTyping();
TLRPC.TL_inputEncryptedChat tL_inputEncryptedChat = new TLRPC.TL_inputEncryptedChat();
tL_messages_setEncryptedTyping.peer = tL_inputEncryptedChat;
tL_inputEncryptedChat.chat_id = encryptedChat.id;
tL_inputEncryptedChat.access_hash = encryptedChat.access_hash;
tL_messages_setEncryptedTyping.typing = true;
longSparseArray2.put(threadMsgId, Boolean.TRUE);
int sendRequest2 = getConnectionsManager().sendRequest(tL_messages_setEncryptedTyping, new MessagesController$.ExternalSyntheticLambda364(this, action, dialogId, threadMsgId), 2);
if (classGuid != 0) {
getConnectionsManager().bindRequestToGuid(sendRequest2, classGuid);
}
}
}
return true;
}
public void lambda$sendTyping$167(int i, long j, long j2, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda76(this, i, j, j2));
}
public void lambda$sendTyping$169(int i, long j, long j2, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda77(this, i, j, j2));
}
public void removeDeletedMessagesFromArray(final long dialogId, ArrayList<TLRPC.Message> messages) {
int i = 0;
int i2 = this.deletedHistory.get(dialogId, 0);
if (i2 == 0) {
return;
}
int size = messages.size();
while (i < size) {
if (messages.get(i).id <= i2) {
messages.remove(i);
i--;
size--;
}
i++;
}
}
public void setOnlyUserId(long id, long media_id) {
this.only_id = id;
this.only_media_id = media_id;
getMessagesStorage().setOnlyUserId(id, media_id);
}
public void loadMessages(long dialogId, long mergeDialogId, boolean loadInfo, int count, int max_id, int offset_date, boolean fromCache, int midDate, int classGuid, int load_type, int last_message_id, int mode, long threadMessageId, int replyFirstUnread, int loadIndex, boolean isTopic) {
loadMessages(dialogId, mergeDialogId, loadInfo, count, max_id, offset_date, fromCache, midDate, classGuid, load_type, last_message_id, mode, threadMessageId, loadIndex, threadMessageId != 0 ? replyFirstUnread : 0, 0, 0, false, 0, isTopic);
}
public void loadMessages(long dialogId, long mergeDialogId, boolean loadInfo, int count, int max_id, int offset_date, boolean fromCache, int midDate, int classGuid, int load_type, int last_message_id, int mode, long threadMessageId, int loadIndex, int first_unread, int unread_count, int last_date, boolean queryFromServer, int mentionsCount, boolean isTopic) {
loadMessagesInternal(dialogId, mergeDialogId, loadInfo, count, max_id, offset_date, fromCache, midDate, classGuid, load_type, last_message_id, mode, threadMessageId, loadIndex, first_unread, unread_count, last_date, queryFromServer, mentionsCount, true, true, isTopic, null, 0L);
}
public void loadMessagesInternal(long dialogId, long mergeDialogId, boolean loadInfo, int count, int max_id, int offset_date, boolean fromCache, int minDate, int classGuid, int load_type, int last_message_id, int mode, long threadMessageId, int loadIndex, int first_unread, int unread_count, int last_date, boolean queryFromServer, int mentionsCount, boolean loadDialog, boolean processMessages, boolean isTopic, MessageLoaderLogger loaderLogger, long hash) {
int i;
MessagesController messagesController;
TLRPC.TL_forumTopic findTopic;
if (BuildVars.LOGS_ENABLED) {
FileLog.d("load messages in chat " + dialogId + " topic_id " + threadMessageId + " count " + count + " max_id " + max_id + " cache " + fromCache + " mindate = " + minDate + " guid " + classGuid + " load_type " + load_type + " last_message_id " + last_message_id + " mode " + mode + " index " + loadIndex + " firstUnread " + first_unread + " unread_count " + unread_count + " last_date " + last_date + " queryFromServer " + queryFromServer + " isTopic " + isTopic);
}
MessageLoaderLogger messageLoaderLogger = (BuildVars.LOGS_ENABLED && loaderLogger == null && mode == 0) ? new MessageLoaderLogger(dialogId, loadIndex, count) : loaderLogger;
if ((threadMessageId == 0 || isTopic || mode == 3 || mode == 5) && mode != 2 && (fromCache || DialogObject.isEncryptedDialog(dialogId))) {
getMessagesStorage().getMessages(dialogId, mergeDialogId, loadInfo, count, max_id, offset_date, minDate, classGuid, load_type, mode, threadMessageId, loadIndex, processMessages, isTopic, messageLoaderLogger);
return;
}
if (mode == 5) {
TLRPC.TL_messages_getQuickReplyMessages tL_messages_getQuickReplyMessages = new TLRPC.TL_messages_getQuickReplyMessages();
tL_messages_getQuickReplyMessages.shortcut_id = (int) threadMessageId;
tL_messages_getQuickReplyMessages.hash = hash;
getConnectionsManager().bindRequestToGuid(getConnectionsManager().sendRequest(tL_messages_getQuickReplyMessages, new MessagesController$.ExternalSyntheticLambda394(this, dialogId, mergeDialogId, count, max_id, offset_date, classGuid, first_unread, last_message_id, unread_count, last_date, load_type, mode, threadMessageId, loadIndex, queryFromServer, mentionsCount, processMessages, isTopic)), classGuid);
return;
}
if (threadMessageId == 0) {
if (mode == 2) {
return;
}
if (mode == 1) {
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
if (getInputPeer(dialogId).channel_id != 0 && !ChatObject.hasAdminRights(getChat(Long.valueOf(-dialogId)))) {
return;
}
TLRPC.TL_messages_getScheduledHistory tL_messages_getScheduledHistory = new TLRPC.TL_messages_getScheduledHistory();
tL_messages_getScheduledHistory.peer = getInputPeer(dialogId);
tL_messages_getScheduledHistory.hash = hash;
getConnectionsManager().bindRequestToGuid(getConnectionsManager().sendRequest(tL_messages_getScheduledHistory, new MessagesController$.ExternalSyntheticLambda361(this, max_id, offset_date, dialogId, mergeDialogId, count, classGuid, first_unread, last_message_id, unread_count, last_date, load_type, mode, threadMessageId, loadIndex, queryFromServer, mentionsCount, processMessages, isTopic)), classGuid);
return;
}
return;
}
if (loadDialog && ((load_type == 3 || load_type == 2) && last_message_id == 0)) {
TLRPC.TL_messages_getPeerDialogs tL_messages_getPeerDialogs = new TLRPC.TL_messages_getPeerDialogs();
TLRPC.InputPeer inputPeer = getInputPeer(dialogId);
TLRPC.TL_inputDialogPeer tL_inputDialogPeer = new TLRPC.TL_inputDialogPeer();
tL_inputDialogPeer.peer = inputPeer;
tL_messages_getPeerDialogs.peers.add(tL_inputDialogPeer);
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
getConnectionsManager().sendRequest(tL_messages_getPeerDialogs, new MessagesController$.ExternalSyntheticLambda399(this, dialogId, mergeDialogId, loadInfo, count, max_id, offset_date, minDate, classGuid, load_type, threadMessageId, loadIndex, first_unread, last_date, queryFromServer, processMessages, isTopic, tL_messages_getPeerDialogs));
return;
}
return;
}
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
TLRPC.TL_messages_getHistory tL_messages_getHistory = new TLRPC.TL_messages_getHistory();
tL_messages_getHistory.peer = getInputPeer(dialogId);
if (load_type == 4) {
tL_messages_getHistory.add_offset = (-count) + 5;
} else if (load_type == 3) {
tL_messages_getHistory.add_offset = (-count) / 2;
} else if (load_type == 1) {
tL_messages_getHistory.add_offset = (-count) - 1;
} else if (load_type == 2 && max_id != 0) {
tL_messages_getHistory.add_offset = (-count) + 6;
} else if (dialogId < 0 && max_id != 0) {
if (ChatObject.isChannel(getChat(Long.valueOf(-dialogId)))) {
tL_messages_getHistory.add_offset = -1;
tL_messages_getHistory.limit++;
}
tL_messages_getHistory.limit = count;
tL_messages_getHistory.offset_id = max_id;
tL_messages_getHistory.offset_date = offset_date;
getConnectionsManager().bindRequestToGuid(getConnectionsManager().sendRequest(tL_messages_getHistory, new MessagesController$.ExternalSyntheticLambda388(this, dialogId, count, max_id, offset_date, mergeDialogId, classGuid, first_unread, last_message_id, unread_count, last_date, load_type, mode, threadMessageId, loadIndex, queryFromServer, mentionsCount, processMessages, isTopic, tL_messages_getHistory)), classGuid);
return;
}
tL_messages_getHistory.limit = count;
tL_messages_getHistory.offset_id = max_id;
tL_messages_getHistory.offset_date = offset_date;
getConnectionsManager().bindRequestToGuid(getConnectionsManager().sendRequest(tL_messages_getHistory, new MessagesController$.ExternalSyntheticLambda388(this, dialogId, count, max_id, offset_date, mergeDialogId, classGuid, first_unread, last_message_id, unread_count, last_date, load_type, mode, threadMessageId, loadIndex, queryFromServer, mentionsCount, processMessages, isTopic, tL_messages_getHistory)), classGuid);
return;
}
return;
}
if (mode == 3) {
TLRPC.TL_messages_getSavedHistory tL_messages_getSavedHistory = new TLRPC.TL_messages_getSavedHistory();
tL_messages_getSavedHistory.peer = getInputPeer(threadMessageId);
if (load_type == 4) {
tL_messages_getSavedHistory.add_offset = (-count) + 5;
} else if (load_type == 3) {
tL_messages_getSavedHistory.add_offset = (-count) / 2;
} else if (load_type == 1) {
tL_messages_getSavedHistory.add_offset = (-count) - 1;
} else if (load_type == 2 && max_id != 0) {
tL_messages_getSavedHistory.add_offset = (-count) + 6;
} else if (dialogId < 0 && max_id != 0 && ChatObject.isChannel(getChat(Long.valueOf(-dialogId)))) {
tL_messages_getSavedHistory.add_offset = -1;
tL_messages_getSavedHistory.limit++;
}
tL_messages_getSavedHistory.limit = count;
tL_messages_getSavedHistory.offset_id = max_id;
tL_messages_getSavedHistory.offset_date = offset_date;
getConnectionsManager().bindRequestToGuid(getConnectionsManager().sendRequest(tL_messages_getSavedHistory, new MessagesController$.ExternalSyntheticLambda389(this, dialogId, count, max_id, offset_date, mergeDialogId, classGuid, first_unread, last_message_id, unread_count, last_date, load_type, mode, threadMessageId, loadIndex, queryFromServer, mentionsCount, processMessages, isTopic, tL_messages_getSavedHistory)), classGuid);
return;
}
if (loadDialog && isTopic && load_type == 2 && last_message_id == 0 && (findTopic = this.topicsController.findTopic(-dialogId, threadMessageId)) != null) {
loadMessagesInternal(dialogId, mergeDialogId, loadInfo, count, max_id, offset_date, false, minDate, classGuid, load_type, findTopic.top_message, mode, threadMessageId, loadIndex, first_unread, findTopic.unread_count, last_date, queryFromServer, findTopic.unread_mentions_count, false, processMessages, isTopic, messageLoaderLogger, 0L);
return;
}
if (mode != 0) {
return;
}
TLRPC.TL_messages_getReplies tL_messages_getReplies = new TLRPC.TL_messages_getReplies();
tL_messages_getReplies.peer = getInputPeer(dialogId);
tL_messages_getReplies.msg_id = (int) threadMessageId;
tL_messages_getReplies.offset_date = offset_date;
if (load_type == 4) {
i = count;
tL_messages_getReplies.add_offset = (-i) + 5;
} else {
i = count;
if (load_type == 3) {
tL_messages_getReplies.add_offset = (-i) / 2;
} else if (load_type == 1) {
tL_messages_getReplies.add_offset = (-i) - 1;
} else if (load_type == 2 && max_id != 0) {
tL_messages_getReplies.add_offset = (-i) + 10;
} else if (dialogId < 0 && max_id != 0) {
messagesController = this;
if (ChatObject.isChannel(messagesController.getChat(Long.valueOf(-dialogId)))) {
tL_messages_getReplies.add_offset = -1;
tL_messages_getReplies.limit++;
}
tL_messages_getReplies.limit = i;
tL_messages_getReplies.offset_id = max_id;
tL_messages_getReplies.hash = hash;
System.currentTimeMillis();
getConnectionsManager().bindRequestToGuid(getConnectionsManager().sendRequest(tL_messages_getReplies, new MessagesController$.ExternalSyntheticLambda359(this, count, max_id, offset_date, first_unread, load_type, dialogId, mergeDialogId, classGuid, last_message_id, unread_count, last_date, mode, threadMessageId, loadIndex, queryFromServer, mentionsCount, processMessages, isTopic, tL_messages_getReplies)), classGuid);
}
}
messagesController = this;
tL_messages_getReplies.limit = i;
tL_messages_getReplies.offset_id = max_id;
tL_messages_getReplies.hash = hash;
System.currentTimeMillis();
getConnectionsManager().bindRequestToGuid(getConnectionsManager().sendRequest(tL_messages_getReplies, new MessagesController$.ExternalSyntheticLambda359(this, count, max_id, offset_date, first_unread, load_type, dialogId, mergeDialogId, classGuid, last_message_id, unread_count, last_date, mode, threadMessageId, loadIndex, queryFromServer, mentionsCount, processMessages, isTopic, tL_messages_getReplies)), classGuid);
}
public void lambda$loadMessagesInternal$170(long j, long j2, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, long j3, int i11, boolean z, int i12, boolean z2, boolean z3, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject;
if (messages_messages instanceof TLRPC.TL_messages_messagesNotModified) {
return;
}
processLoadedMessages(messages_messages, messages_messages.messages.size(), j, j2, i, i2, i3, false, i4, i5, i6, i7, i8, i9, false, i10, j3, i11, z, i12, z2, z3, null);
return;
}
if (tL_error == null || !"SHORTCUT_INVALID".equals(tL_error.text)) {
return;
}
processLoadedMessages(new TLRPC.TL_messages_messages(), 0, j, j2, i, i2, i3, false, i4, i5, i6, i7, i8, i9, false, i10, j3, i11, z, i12, z2, z3, null);
}
public void lambda$loadMessagesInternal$172(long j, int i, int i2, int i3, long j2, int i4, int i5, int i6, int i7, int i8, int i9, int i10, long j3, int i11, boolean z, int i12, boolean z2, boolean z3, TLRPC.TL_messages_getSavedHistory tL_messages_getSavedHistory, TLObject tLObject, TLRPC.TL_error tL_error) {
int i13;
if (tLObject != null) {
TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject;
removeDeletedMessagesFromArray(j, messages_messages.messages);
if (messages_messages.messages.size() > i) {
messages_messages.messages.remove(0);
}
if (i3 == 0 || messages_messages.messages.isEmpty()) {
i13 = i2;
} else {
int i14 = ((TLRPC.Message) messages_messages.messages.get(r0.size() - 1)).id;
int size = messages_messages.messages.size() - 1;
while (true) {
if (size < 0) {
break;
}
TLRPC.Message message = (TLRPC.Message) messages_messages.messages.get(size);
if (message.date > i3) {
i14 = message.id;
break;
}
size--;
}
i13 = i14;
}
processLoadedMessages(messages_messages, messages_messages.messages.size(), j, j2, i, i13, i3, false, i4, i5, i6, i7, i8, i9, false, i10, j3, i11, z, i12, z2, z3, null);
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda85(this, i4, tL_messages_getSavedHistory, tL_error));
}
public void lambda$loadMessagesInternal$171(int i, TLRPC.TL_messages_getSavedHistory tL_messages_getSavedHistory, TLRPC.TL_error tL_error) {
getNotificationCenter().postNotificationName(NotificationCenter.loadingMessagesFailed, new Object[]{Integer.valueOf(i), tL_messages_getSavedHistory, tL_error});
}
public void lambda$loadMessagesInternal$174(int i, int i2, int i3, int i4, int i5, long j, long j2, int i6, int i7, int i8, int i9, int i10, long j3, int i11, boolean z, int i12, boolean z2, boolean z3, TLRPC.TL_messages_getReplies tL_messages_getReplies, TLObject tLObject, TLRPC.TL_error tL_error) {
int i13;
int i14;
if (tLObject != null) {
TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject;
if (messages_messages.messages.size() > i) {
messages_messages.messages.remove(0);
}
if (!messages_messages.messages.isEmpty()) {
if (i3 != 0) {
int i15 = ((TLRPC.Message) messages_messages.messages.get(r0.size() - 1)).id;
int size = messages_messages.messages.size() - 1;
while (true) {
if (size < 0) {
break;
}
TLRPC.Message message = (TLRPC.Message) messages_messages.messages.get(size);
if (message.date > i3) {
i15 = message.id;
break;
}
size--;
}
i13 = i15;
i14 = 0;
processLoadedMessages(messages_messages, messages_messages.messages.size(), j, j2, i, i13, i3, false, i6, i14, i7, i8, i9, i5, false, i10, j3, i11, z, i12, z2, z3, null);
return;
}
if (i4 != 0) {
if (i5 == 2 && i2 > 0) {
for (int size2 = messages_messages.messages.size() - 1; size2 >= 0; size2--) {
TLRPC.Message message2 = (TLRPC.Message) messages_messages.messages.get(size2);
int i16 = message2.id;
if (i16 > i4 && !message2.out) {
i13 = i2;
i14 = i16;
break;
}
}
}
i13 = i2;
i14 = 0;
processLoadedMessages(messages_messages, messages_messages.messages.size(), j, j2, i, i13, i3, false, i6, i14, i7, i8, i9, i5, false, i10, j3, i11, z, i12, z2, z3, null);
return;
}
}
i13 = i2;
i14 = 0;
processLoadedMessages(messages_messages, messages_messages.messages.size(), j, j2, i, i13, i3, false, i6, i14, i7, i8, i9, i5, false, i10, j3, i11, z, i12, z2, z3, null);
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda84(this, i6, tL_messages_getReplies, tL_error));
}
public void lambda$loadMessagesInternal$173(int i, TLRPC.TL_messages_getReplies tL_messages_getReplies, TLRPC.TL_error tL_error) {
getNotificationCenter().postNotificationName(NotificationCenter.loadingMessagesFailed, new Object[]{Integer.valueOf(i), tL_messages_getReplies, tL_error});
}
public void lambda$loadMessagesInternal$175(int i, int i2, long j, long j2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, long j3, int i11, boolean z, int i12, boolean z2, boolean z3, TLObject tLObject, TLRPC.TL_error tL_error) {
int i13;
if (tLObject != null) {
TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject;
if (messages_messages instanceof TLRPC.TL_messages_messagesNotModified) {
return;
}
if (i2 == 0 || messages_messages.messages.isEmpty()) {
i13 = i;
} else {
int i14 = ((TLRPC.Message) messages_messages.messages.get(r0.size() - 1)).id;
int size = messages_messages.messages.size() - 1;
while (true) {
if (size < 0) {
break;
}
TLRPC.Message message = (TLRPC.Message) messages_messages.messages.get(size);
if (message.date > i2) {
i14 = message.id;
break;
}
size--;
}
i13 = i14;
}
processLoadedMessages(messages_messages, messages_messages.messages.size(), j, j2, i3, i13, i2, false, i4, i5, i6, i7, i8, i9, false, i10, j3, i11, z, i12, z2, z3, null);
}
}
public void lambda$loadMessagesInternal$177(long j, long j2, boolean z, int i, int i2, int i3, int i4, int i5, int i6, long j3, int i7, int i8, int i9, boolean z2, boolean z3, boolean z4, TLRPC.TL_messages_getPeerDialogs tL_messages_getPeerDialogs, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
TLRPC.TL_messages_peerDialogs tL_messages_peerDialogs = (TLRPC.TL_messages_peerDialogs) tLObject;
if (!tL_messages_peerDialogs.dialogs.isEmpty()) {
TLRPC.Dialog dialog = (TLRPC.Dialog) tL_messages_peerDialogs.dialogs.get(0);
if (dialog.top_message != 0) {
TLRPC.TL_messages_dialogs tL_messages_dialogs = new TLRPC.TL_messages_dialogs();
((TLRPC.messages_Dialogs) tL_messages_dialogs).chats = tL_messages_peerDialogs.chats;
((TLRPC.messages_Dialogs) tL_messages_dialogs).users = tL_messages_peerDialogs.users;
((TLRPC.messages_Dialogs) tL_messages_dialogs).dialogs = tL_messages_peerDialogs.dialogs;
((TLRPC.messages_Dialogs) tL_messages_dialogs).messages = tL_messages_peerDialogs.messages;
getMessagesStorage().putDialogs(tL_messages_dialogs, 2);
}
loadMessagesInternal(j, j2, z, i, i2, i3, false, i4, i5, i6, dialog.top_message, 0, j3, i7, i8, dialog.unread_count, i9, z2, dialog.unread_mentions_count, false, z3, z4, null, 0L);
}
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda83(this, i5, tL_messages_getPeerDialogs, tL_error));
}
public void lambda$loadMessagesInternal$176(int i, TLRPC.TL_messages_getPeerDialogs tL_messages_getPeerDialogs, TLRPC.TL_error tL_error) {
getNotificationCenter().postNotificationName(NotificationCenter.loadingMessagesFailed, new Object[]{Integer.valueOf(i), tL_messages_getPeerDialogs, tL_error});
}
public void lambda$loadMessagesInternal$179(long j, int i, int i2, int i3, long j2, int i4, int i5, int i6, int i7, int i8, int i9, int i10, long j3, int i11, boolean z, int i12, boolean z2, boolean z3, TLRPC.TL_messages_getHistory tL_messages_getHistory, TLObject tLObject, TLRPC.TL_error tL_error) {
int i13;
if (tLObject != null) {
TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject;
removeDeletedMessagesFromArray(j, messages_messages.messages);
if (messages_messages.messages.size() > i) {
messages_messages.messages.remove(0);
}
if (i3 == 0 || messages_messages.messages.isEmpty()) {
i13 = i2;
} else {
int i14 = ((TLRPC.Message) messages_messages.messages.get(r0.size() - 1)).id;
int size = messages_messages.messages.size() - 1;
while (true) {
if (size < 0) {
break;
}
TLRPC.Message message = (TLRPC.Message) messages_messages.messages.get(size);
if (message.date > i3) {
i14 = message.id;
break;
}
size--;
}
i13 = i14;
}
processLoadedMessages(messages_messages, messages_messages.messages.size(), j, j2, i, i13, i3, false, i4, i5, i6, i7, i8, i9, false, i10, j3, i11, z, i12, z2, z3, null);
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda82(this, i4, tL_messages_getHistory, tL_error));
}
public void lambda$loadMessagesInternal$178(int i, TLRPC.TL_messages_getHistory tL_messages_getHistory, TLRPC.TL_error tL_error) {
getNotificationCenter().postNotificationName(NotificationCenter.loadingMessagesFailed, new Object[]{Integer.valueOf(i), tL_messages_getHistory, tL_error});
}
public void getHistoryFromId(long dialogId, long mergeDialogId, int count, int max_id, int offset_date, int classGuid, int load_type, int last_message_id, int threadMessageId, int loadIndex, int first_unread, int unread_count, int last_date, boolean queryFromServer, int mentionsCount, boolean processMessages, boolean isTopic) {
TLRPC.TL_messages_search tL_messages_search = new TLRPC.TL_messages_search();
tL_messages_search.peer = getInputPeer(dialogId);
tL_messages_search.limit = count;
tL_messages_search.q = "";
tL_messages_search.from_id = getInputPeer(this.only_id);
tL_messages_search.flags |= 1;
tL_messages_search.filter = new TLRPC.TL_inputMessagesFilterEmpty();
getConnectionsManager().bindRequestToGuid(getConnectionsManager().sendRequest(tL_messages_search, new MessagesController$.ExternalSyntheticLambda360(this, max_id, offset_date, dialogId, mergeDialogId, count, classGuid, first_unread, last_message_id, unread_count, last_date, load_type, threadMessageId, loadIndex, queryFromServer, mentionsCount, processMessages, isTopic, tL_messages_search)), classGuid);
}
public void lambda$getHistoryFromId$181(int i, int i2, long j, long j2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, boolean z, int i12, boolean z2, boolean z3, TLRPC.TL_messages_search tL_messages_search, TLObject tLObject, TLRPC.TL_error tL_error) {
int i13;
if (tLObject != null) {
TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject;
if (i2 == 0 || messages_messages.messages.isEmpty()) {
i13 = i;
} else {
int i14 = ((TLRPC.Message) messages_messages.messages.get(r0.size() - 1)).id;
int size = messages_messages.messages.size() - 1;
while (true) {
if (size < 0) {
break;
}
TLRPC.Message message = (TLRPC.Message) messages_messages.messages.get(size);
if (message.date > i2) {
i14 = message.id;
break;
}
size--;
}
i13 = i14;
}
processLoadedMessages(messages_messages, messages_messages.messages.size(), j, j2, i3, i13, i2, false, i4, i5, i6, i7, i8, i9, false, 0, i10, i11, z, i12, z2, z3, null);
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda86(this, i4, tL_messages_search, tL_error));
}
public void lambda$getHistoryFromId$180(int i, TLRPC.TL_messages_search tL_messages_search, TLRPC.TL_error tL_error) {
getNotificationCenter().postNotificationName(NotificationCenter.loadingMessagesFailed, new Object[]{Integer.valueOf(i), tL_messages_search, tL_error});
}
public void reloadWebPages(final long dialogId, HashMap<String, ArrayList<MessageObject>> webpagesToReload, int mode) {
HashMap<String, ArrayList<MessageObject>> hashMap;
LongSparseArray<ArrayList<MessageObject>> longSparseArray;
boolean z = mode == 1;
boolean z2 = mode == 3;
if (z) {
hashMap = this.reloadingScheduledWebpages;
longSparseArray = this.reloadingScheduledWebpagesPending;
} else if (z2) {
hashMap = this.reloadingSavedWebpages;
longSparseArray = this.reloadingSavedWebpagesPending;
} else {
hashMap = this.reloadingWebpages;
longSparseArray = this.reloadingWebpagesPending;
}
HashMap<String, ArrayList<MessageObject>> hashMap2 = hashMap;
LongSparseArray<ArrayList<MessageObject>> longSparseArray2 = longSparseArray;
for (Map.Entry<String, ArrayList<MessageObject>> entry : webpagesToReload.entrySet()) {
String key = entry.getKey();
ArrayList<MessageObject> value = entry.getValue();
ArrayList<MessageObject> arrayList = hashMap2.get(key);
if (arrayList == null) {
arrayList = new ArrayList<>();
hashMap2.put(key, arrayList);
}
arrayList.addAll(value);
TLRPC.TL_messages_getWebPagePreview tL_messages_getWebPagePreview = new TLRPC.TL_messages_getWebPagePreview();
tL_messages_getWebPagePreview.message = key;
getConnectionsManager().sendRequest(tL_messages_getWebPagePreview, new MessagesController$.ExternalSyntheticLambda425(this, hashMap2, key, longSparseArray2, dialogId, mode));
}
}
public void lambda$reloadWebPages$183(HashMap hashMap, String str, LongSparseArray longSparseArray, long j, int i, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda175(this, hashMap, str, tLObject, longSparseArray, j, i));
}
public void lambda$reloadWebPages$182(HashMap hashMap, String str, TLObject tLObject, LongSparseArray longSparseArray, long j, int i) {
ArrayList arrayList = (ArrayList) hashMap.remove(str);
if (arrayList == null) {
return;
}
TLRPC.TL_messages_messages tL_messages_messages = new TLRPC.TL_messages_messages();
if (!(tLObject instanceof TLRPC.TL_messageMediaWebPage)) {
for (int i2 = 0; i2 < arrayList.size(); i2++) {
((MessageObject) arrayList.get(i2)).messageOwner.media.webpage = new TLRPC.TL_webPageEmpty();
((TLRPC.messages_Messages) tL_messages_messages).messages.add(((MessageObject) arrayList.get(i2)).messageOwner);
}
} else {
TLRPC.TL_messageMediaWebPage tL_messageMediaWebPage = (TLRPC.TL_messageMediaWebPage) tLObject;
TLRPC.WebPage webPage = ((TLRPC.MessageMedia) tL_messageMediaWebPage).webpage;
if ((webPage instanceof TLRPC.TL_webPage) || (webPage instanceof TLRPC.TL_webPageEmpty)) {
for (int i3 = 0; i3 < arrayList.size(); i3++) {
((MessageObject) arrayList.get(i3)).messageOwner.media.webpage = ((TLRPC.MessageMedia) tL_messageMediaWebPage).webpage;
if (i3 == 0) {
ImageLoader.saveMessageThumbs(((MessageObject) arrayList.get(i3)).messageOwner);
}
((TLRPC.messages_Messages) tL_messages_messages).messages.add(((MessageObject) arrayList.get(i3)).messageOwner);
}
} else {
longSparseArray.put(webPage.id, arrayList);
}
}
if (((TLRPC.messages_Messages) tL_messages_messages).messages.isEmpty()) {
return;
}
getMessagesStorage().putMessages(tL_messages_messages, j, -2, 0, false, i, 0L);
getNotificationCenter().postNotificationName(NotificationCenter.replaceMessagesObjects, new Object[]{Long.valueOf(j), arrayList});
}
public void processLoadedMessages(org.telegram.tgnet.TLRPC.messages_Messages r35, int r36, long r37, long r39, int r41, int r42, int r43, boolean r44, int r45, int r46, int r47, int r48, int r49, int r50, boolean r51, int r52, long r53, int r55, boolean r56, int r57, boolean r58, boolean r59, org.telegram.messenger.MessageLoaderLogger r60) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.processLoadedMessages(org.telegram.tgnet.TLRPC$messages_Messages, int, long, long, int, int, int, boolean, int, int, int, int, int, int, boolean, int, long, int, boolean, int, boolean, boolean, org.telegram.messenger.MessageLoaderLogger):void");
}
public void lambda$processLoadedMessages$184(long j, long j2, int i, int i2, boolean z, int i3, int i4, int i5, int i6, int i7, int i8, long j3, int i9, int i10, int i11, int i12, boolean z2, boolean z3, MessageLoaderLogger messageLoaderLogger, long j4) {
loadMessagesInternal(j, j2, false, i, (i2 == 2 && z) ? i3 : i4, i5, false, 0, i6, i2, i7, i8, j3, i9, i3, i10, i11, z, i12, true, z2, z3, messageLoaderLogger, j4);
}
public void lambda$processLoadedMessages$185(int i, TLRPC.messages_Messages messages_messages, boolean z, boolean z2, int i2) {
getNotificationCenter().postNotificationName(NotificationCenter.messagesDidLoadWithoutProcess, new Object[]{Integer.valueOf(i), Integer.valueOf(messages_messages.messages.size()), Boolean.valueOf(z), Boolean.valueOf(z2), Integer.valueOf(i2)});
}
public static int lambda$processLoadedMessages$186(MessageObject messageObject, MessageObject messageObject2) {
int i;
int i2;
if (messageObject.messageOwner.date == messageObject2.messageOwner.date && messageObject.getId() >= 0 && messageObject2.getId() >= 0) {
i = messageObject2.getId();
i2 = messageObject.getId();
} else {
i = messageObject2.messageOwner.date;
i2 = messageObject.messageOwner.date;
}
return i - i2;
}
public static int lambda$processLoadedMessages$187(MessageObject messageObject, MessageObject messageObject2) {
return messageObject2.getId() - messageObject.getId();
}
public void lambda$processLoadedMessages$189(TLRPC.messages_Messages messages_messages, boolean z, MessageLoaderLogger messageLoaderLogger, boolean z2, int i, boolean z3, int i2, int i3, int i4, long j, ArrayList arrayList, long j2, int i5, int i6, boolean z4, int i7, int i8, int i9, int i10, int i11, int i12, ArrayList arrayList2, HashMap hashMap) {
int i13;
int i14;
int i15;
int i16;
MessagesController messagesController;
int i17;
long j3;
putUsers(messages_messages.users, z);
putChats(messages_messages.chats, z);
if (messageLoaderLogger != null) {
messageLoaderLogger.finish();
}
if (messages_messages.animatedEmoji != null && z2) {
AnimatedEmojiDrawable.getDocumentFetcher(this.currentAccount).processDocuments(messages_messages.animatedEmoji);
}
if (i == 1) {
i15 = 0;
} else {
if (z3 && i2 == 2) {
i14 = ConnectionsManager.DEFAULT_DATACENTER_ID;
for (int i18 = 0; i18 < messages_messages.messages.size(); i18++) {
TLRPC.Message message = (TLRPC.Message) messages_messages.messages.get(i18);
if ((!message.out || message.from_scheduled) && (i16 = message.id) > i3 && i16 < i14) {
i14 = i16;
}
}
i13 = i3;
} else {
i13 = i3;
i14 = ConnectionsManager.DEFAULT_DATACENTER_ID;
}
i15 = i14 == Integer.MAX_VALUE ? i13 : i14;
}
if (i == 1 && i4 == 1) {
getNotificationCenter().postNotificationName(NotificationCenter.scheduledMessagesUpdated, new Object[]{Long.valueOf(j), Integer.valueOf(arrayList.size()), Boolean.FALSE});
}
if (!DialogObject.isEncryptedDialog(j) && i != 5) {
getMediaDataController().loadReplyMessagesForMessages(arrayList, j, i, j2, new MessagesController$.ExternalSyntheticLambda275(this, z2, i5, i6, z, z4, i7, j, i4, arrayList, i15, i8, i9, i2, i10, i11, i12, i), i5);
} else {
getNotificationCenter().postNotificationName(NotificationCenter.messagesDidLoad, new Object[]{Long.valueOf(j), Integer.valueOf(i4), arrayList, Boolean.valueOf(z), Integer.valueOf(i15), Integer.valueOf(i7), Integer.valueOf(i8), Integer.valueOf(i9), Integer.valueOf(i2), Boolean.valueOf(z4), Integer.valueOf(i5), Integer.valueOf(i10), Integer.valueOf(i11), Integer.valueOf(i12), Integer.valueOf(i)});
}
if (arrayList2.isEmpty()) {
messagesController = this;
i17 = i;
j3 = j;
} else {
messagesController = this;
i17 = i;
j3 = j;
messagesController.reloadMessages(arrayList2, j3, i17);
}
if (hashMap.isEmpty()) {
return;
}
messagesController.reloadWebPages(j3, hashMap, i17);
}
public void lambda$processLoadedMessages$188(boolean z, int i, int i2, boolean z2, boolean z3, int i3, long j, int i4, ArrayList arrayList, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12) {
if (!z) {
getNotificationCenter().postNotificationName(NotificationCenter.messagesDidLoadWithoutProcess, new Object[]{Integer.valueOf(i), Integer.valueOf(i2), Boolean.valueOf(z2), Boolean.valueOf(z3), Integer.valueOf(i3)});
} else {
getNotificationCenter().postNotificationName(NotificationCenter.messagesDidLoad, new Object[]{Long.valueOf(j), Integer.valueOf(i4), arrayList, Boolean.valueOf(z2), Integer.valueOf(i5), Integer.valueOf(i3), Integer.valueOf(i6), Integer.valueOf(i7), Integer.valueOf(i8), Boolean.valueOf(z3), Integer.valueOf(i), Integer.valueOf(i9), Integer.valueOf(i10), Integer.valueOf(i11), Integer.valueOf(i12)});
}
}
public void loadHintDialogs() {
if (!this.hintDialogs.isEmpty() || TextUtils.isEmpty(this.installReferer)) {
return;
}
TLRPC.TL_help_getRecentMeUrls tL_help_getRecentMeUrls = new TLRPC.TL_help_getRecentMeUrls();
tL_help_getRecentMeUrls.referer = this.installReferer;
getConnectionsManager().sendRequest(tL_help_getRecentMeUrls, new MessagesController$.ExternalSyntheticLambda335(this));
}
public void lambda$loadHintDialogs$191(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda193(this, tLObject));
}
}
public void lambda$loadHintDialogs$190(TLObject tLObject) {
TLRPC.TL_help_recentMeUrls tL_help_recentMeUrls = (TLRPC.TL_help_recentMeUrls) tLObject;
putUsers(tL_help_recentMeUrls.users, false);
putChats(tL_help_recentMeUrls.chats, false);
this.hintDialogs.clear();
this.hintDialogs.addAll(tL_help_recentMeUrls.urls);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
public TLRPC.TL_dialogFolder ensureFolderDialogExists(int folderId, boolean[] folderCreated) {
if (folderId == 0 || PlusSettings.removeArchiveFromList || (this.isForwarding && PlusSettings.showFoldersIfForwarding)) {
return null;
}
long makeFolderDialogId = DialogObject.makeFolderDialogId(folderId);
TLRPC.TL_dialogFolder tL_dialogFolder = (TLRPC.Dialog) this.dialogs_dict.get(makeFolderDialogId);
if (tL_dialogFolder instanceof TLRPC.TL_dialogFolder) {
if (folderCreated != null) {
folderCreated[0] = false;
}
return tL_dialogFolder;
}
if (folderCreated != null) {
folderCreated[0] = true;
}
TLRPC.Dialog tL_dialogFolder2 = new TLRPC.TL_dialogFolder();
tL_dialogFolder2.id = makeFolderDialogId;
tL_dialogFolder2.peer = new TLRPC.TL_peerUser();
TLRPC.TL_folder tL_folder = new TLRPC.TL_folder();
((TLRPC.TL_dialogFolder) tL_dialogFolder2).folder = tL_folder;
tL_folder.id = folderId;
tL_folder.title = LocaleController.getString("ArchivedChats", R.string.ArchivedChats);
tL_dialogFolder2.pinned = true;
int i = 0;
for (int i2 = 0; i2 < this.allDialogs.size(); i2++) {
TLRPC.Dialog dialog = this.allDialogs.get(i2);
if (!dialog.pinned) {
if (dialog.id != this.promoDialogId) {
break;
}
} else {
i = Math.max(dialog.pinnedNum, i);
}
}
tL_dialogFolder2.pinnedNum = i + 1;
TLRPC.TL_messages_dialogs tL_messages_dialogs = new TLRPC.TL_messages_dialogs();
((TLRPC.messages_Dialogs) tL_messages_dialogs).dialogs.add(tL_dialogFolder2);
getMessagesStorage().putDialogs(tL_messages_dialogs, 1);
this.dialogs_dict.put(makeFolderDialogId, tL_dialogFolder2);
this.allDialogs.add(0, tL_dialogFolder2);
return tL_dialogFolder2;
}
private void removeFolder(int folderId) {
long makeFolderDialogId = DialogObject.makeFolderDialogId(folderId);
TLRPC.Dialog dialog = this.dialogs_dict.get(makeFolderDialogId);
if (dialog == null) {
return;
}
this.dialogs_dict.remove(makeFolderDialogId);
this.allDialogs.remove(dialog);
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
getNotificationCenter().postNotificationName(NotificationCenter.folderBecomeEmpty, new Object[]{Integer.valueOf(folderId)});
}
public void onFolderEmpty(int folderId) {
if (getUserConfig().getDialogLoadOffsets(folderId)[0] != 2147483647L) {
loadDialogs(folderId, 0, 10, false, new MessagesController$.ExternalSyntheticLambda71(this, folderId));
} else if (folderId == 1) {
this.hasArchivedChats = false;
checkArchiveFolder();
} else {
removeFolder(folderId);
}
}
public void lambda$onFolderEmpty$192(int i) {
if (i == 1) {
this.hasArchivedChats = false;
checkArchiveFolder();
} else {
removeFolder(i);
}
}
public void checkArchiveFolder() {
if (!this.hasArchivedChats && !getStoriesController().hasHiddenStories()) {
removeFolder(1);
} else {
boolean[] zArr = {false};
ensureFolderDialogExists(1, zArr);
if (zArr[0]) {
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
}
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{0});
}
public void checkIfFolderEmpty(int folderId) {
if (folderId == 0) {
return;
}
getMessagesStorage().checkIfFolderEmpty(folderId);
}
public int addDialogToFolder(long dialogId, int folderId, int pinnedNum, long taskId) {
ArrayList<Long> arrayList = new ArrayList<>(1);
arrayList.add(Long.valueOf(dialogId));
return addDialogToFolder(arrayList, folderId, pinnedNum, null, taskId);
}
private int copyRestorePinnedDialog(int folderId, TLRPC.Dialog dialog, int pinnedNum) {
long j = dialog.id;
if (folderId <= 0) {
return (pinnedNum > 0 || this.pinnedDialogs_dict.get(j) == null) ? pinnedNum : this.pinnedDialogs_dict.get(j).pinnedNum;
}
if (!dialog.pinned) {
return pinnedNum;
}
TLRPC.Dialog tL_dialog = new TLRPC.TL_dialog();
tL_dialog.pinnedNum = dialog.pinnedNum;
tL_dialog.pinned = dialog.pinned;
tL_dialog.id = j;
this.pinnedDialogs_dict.put(j, tL_dialog);
return pinnedNum;
}
public int addDialogToFolder(java.util.ArrayList<java.lang.Long> r23, int r24, int r25, java.util.ArrayList<org.telegram.tgnet.TLRPC.TL_inputFolderPeer> r26, long r27) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.addDialogToFolder(java.util.ArrayList, int, int, java.util.ArrayList, long):int");
}
public void lambda$addDialogToFolder$193(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
processUpdates((TLRPC.Updates) tLObject, false);
}
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
}
public void loadDialogs(final int folderId, int offset, int count, boolean fromCache) {
loadDialogs(folderId, offset, count, fromCache, null);
}
public void loadDialogs(final int folderId, int offset, int count, boolean fromCache, Runnable onEmptyCallback) {
long j;
if (this.loadingDialogs.get(folderId) || this.resetingDialogs) {
return;
}
this.loadingDialogs.put(folderId, true);
NotificationCenter notificationCenter = getNotificationCenter();
int i = NotificationCenter.dialogsNeedReload;
notificationCenter.postNotificationName(i, new Object[0]);
if (BuildVars.LOGS_ENABLED) {
FileLog.d("folderId = " + folderId + " load cacheOffset = " + offset + " count = " + count + " cache = " + fromCache);
}
if (fromCache) {
getMessagesStorage().getDialogs(folderId, offset == 0 ? 0 : this.nextDialogsCacheOffset.get(folderId, 0), count, folderId == 0 && offset == 0);
return;
}
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
TLRPC.TL_messages_getDialogs tL_messages_getDialogs = new TLRPC.TL_messages_getDialogs();
tL_messages_getDialogs.limit = count;
tL_messages_getDialogs.exclude_pinned = true;
if (folderId != 0) {
tL_messages_getDialogs.flags |= 2;
tL_messages_getDialogs.folder_id = folderId;
}
long[] dialogLoadOffsets = getUserConfig().getDialogLoadOffsets(folderId);
if (dialogLoadOffsets[0] != -1) {
if (dialogLoadOffsets[0] == 2147483647L) {
this.dialogsEndReached.put(folderId, true);
this.serverDialogsEndReached.put(folderId, true);
this.loadingDialogs.put(folderId, false);
getNotificationCenter().postNotificationName(i, new Object[0]);
return;
}
int i2 = (int) dialogLoadOffsets[0];
tL_messages_getDialogs.offset_id = i2;
tL_messages_getDialogs.offset_date = (int) dialogLoadOffsets[1];
if (i2 == 0) {
tL_messages_getDialogs.offset_peer = new TLRPC.TL_inputPeerEmpty();
} else {
if (dialogLoadOffsets[4] != 0) {
TLRPC.TL_inputPeerChannel tL_inputPeerChannel = new TLRPC.TL_inputPeerChannel();
tL_messages_getDialogs.offset_peer = tL_inputPeerChannel;
((TLRPC.InputPeer) tL_inputPeerChannel).channel_id = dialogLoadOffsets[4];
} else if (dialogLoadOffsets[2] != 0) {
TLRPC.TL_inputPeerUser tL_inputPeerUser = new TLRPC.TL_inputPeerUser();
tL_messages_getDialogs.offset_peer = tL_inputPeerUser;
((TLRPC.InputPeer) tL_inputPeerUser).user_id = dialogLoadOffsets[2];
} else {
TLRPC.TL_inputPeerChat tL_inputPeerChat = new TLRPC.TL_inputPeerChat();
tL_messages_getDialogs.offset_peer = tL_inputPeerChat;
((TLRPC.InputPeer) tL_inputPeerChat).chat_id = dialogLoadOffsets[3];
}
tL_messages_getDialogs.offset_peer.access_hash = dialogLoadOffsets[5];
}
} else {
ArrayList<TLRPC.Dialog> dialogs = getDialogs(folderId);
int size = dialogs.size() - 1;
while (true) {
if (size < 0) {
r6 = false;
break;
}
TLRPC.Dialog dialog = dialogs.get(size);
if (!dialog.pinned && !DialogObject.isEncryptedDialog(dialog.id) && dialog.top_message > 0) {
ArrayList<MessageObject> arrayList = this.dialogMessage.get(dialog.id);
MessageObject messageObject = null;
if (arrayList != null) {
for (int i3 = 0; i3 < arrayList.size(); i3++) {
MessageObject messageObject2 = arrayList.get(i3);
if (messageObject2 != null && (messageObject == null || messageObject2.getId() > messageObject.getId())) {
messageObject = arrayList.get(i3);
}
}
}
if (messageObject != null && messageObject.getId() > 0) {
TLRPC.Message message = messageObject.messageOwner;
tL_messages_getDialogs.offset_date = message.date;
tL_messages_getDialogs.offset_id = message.id;
TLRPC.Peer peer = message.peer_id;
long j2 = peer.channel_id;
if (j2 == 0) {
j2 = peer.chat_id;
if (j2 == 0) {
j = peer.user_id;
tL_messages_getDialogs.offset_peer = getInputPeer(j);
}
}
j = -j2;
tL_messages_getDialogs.offset_peer = getInputPeer(j);
}
}
size--;
}
if (!r6) {
tL_messages_getDialogs.offset_peer = new TLRPC.TL_inputPeerEmpty();
}
}
if (folderId == 2) {
return;
}
getConnectionsManager().sendRequest(tL_messages_getDialogs, new MessagesController$.ExternalSyntheticLambda362(this, folderId, count, onEmptyCallback));
}
}
public void lambda$loadDialogs$194(int i, int i2, Runnable runnable, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC.messages_Dialogs messages_dialogs = (TLRPC.messages_Dialogs) tLObject;
processLoadedDialogs(messages_dialogs, null, null, i, 0, i2, 0, false, false, false);
if (runnable == null || !messages_dialogs.dialogs.isEmpty()) {
return;
}
AndroidUtilities.runOnUIThread(runnable);
}
}
public void loadGlobalNotificationsSettings() {
if (this.loadingNotificationSettings == 0 && !getUserConfig().notificationsSettingsLoaded) {
SharedPreferences notificationsSettings = getNotificationsSettings(this.currentAccount);
SharedPreferences.Editor editor = null;
if (notificationsSettings.contains("EnableGroup")) {
boolean z = notificationsSettings.getBoolean("EnableGroup", true);
SharedPreferences.Editor edit = notificationsSettings.edit();
if (!z) {
edit.putInt("EnableGroup2", ConnectionsManager.DEFAULT_DATACENTER_ID);
edit.putInt("EnableChannel2", ConnectionsManager.DEFAULT_DATACENTER_ID);
}
edit.remove("EnableGroup").commit();
editor = edit;
}
if (notificationsSettings.contains("EnableAll")) {
boolean z2 = notificationsSettings.getBoolean("EnableAll", true);
if (editor == null) {
editor = notificationsSettings.edit();
}
if (!z2) {
editor.putInt("EnableAll2", ConnectionsManager.DEFAULT_DATACENTER_ID);
}
editor.remove("EnableAll").commit();
}
if (editor != null) {
editor.commit();
}
if (getUserConfig().getCurrentUser() != null && getUserConfig().getCurrentUser().bot) {
return;
}
this.loadingNotificationSettings = 4;
for (int i = 0; i < 3; i++) {
TLRPC.TL_account_getNotifySettings tL_account_getNotifySettings = new TLRPC.TL_account_getNotifySettings();
if (i == 0) {
tL_account_getNotifySettings.peer = new TLRPC.TL_inputNotifyChats();
} else if (i == 1) {
tL_account_getNotifySettings.peer = new TLRPC.TL_inputNotifyUsers();
} else {
tL_account_getNotifySettings.peer = new TLRPC.TL_inputNotifyBroadcasts();
}
getConnectionsManager().sendRequest(tL_account_getNotifySettings, new MessagesController$.ExternalSyntheticLambda353(this, i));
}
getConnectionsManager().sendRequest(new TLRPC.TL_account_getReactionsNotifySettings(), new MessagesController$.ExternalSyntheticLambda345(this));
}
if (getUserConfig().notificationsSignUpSettingsLoaded) {
return;
}
loadSignUpNotificationsSettings();
}
public void lambda$loadGlobalNotificationsSettings$196(int i, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda196(this, tLObject, i));
}
public void lambda$loadGlobalNotificationsSettings$195(TLObject tLObject, int i) {
if (tLObject != null) {
this.loadingNotificationSettings--;
TLRPC.TL_peerNotifySettings tL_peerNotifySettings = (TLRPC.TL_peerNotifySettings) tLObject;
SharedPreferences.Editor edit = this.notificationsPreferences.edit();
if (i == 0) {
if ((((TLRPC.PeerNotifySettings) tL_peerNotifySettings).flags & 1) != 0) {
edit.putBoolean("EnablePreviewGroup", ((TLRPC.PeerNotifySettings) tL_peerNotifySettings).show_previews);
}
if ((((TLRPC.PeerNotifySettings) tL_peerNotifySettings).flags & 4) != 0) {
edit.putInt("EnableGroup2", ((TLRPC.PeerNotifySettings) tL_peerNotifySettings).mute_until);
}
} else if (i == 1) {
if ((((TLRPC.PeerNotifySettings) tL_peerNotifySettings).flags & 1) != 0) {
edit.putBoolean("EnablePreviewAll", ((TLRPC.PeerNotifySettings) tL_peerNotifySettings).show_previews);
}
if ((((TLRPC.PeerNotifySettings) tL_peerNotifySettings).flags & 64) != 0) {
edit.putBoolean("EnableAllStories", !((TLRPC.PeerNotifySettings) tL_peerNotifySettings).stories_muted);
}
if ((((TLRPC.PeerNotifySettings) tL_peerNotifySettings).flags & ConnectionsManager.RequestFlagNeedQuickAck) != 0) {
edit.putBoolean("EnableHideStoriesSenders", ((TLRPC.PeerNotifySettings) tL_peerNotifySettings).stories_hide_sender);
}
if ((((TLRPC.PeerNotifySettings) tL_peerNotifySettings).flags & 4) != 0) {
edit.putInt("EnableAll2", ((TLRPC.PeerNotifySettings) tL_peerNotifySettings).mute_until);
}
if ((((TLRPC.PeerNotifySettings) tL_peerNotifySettings).flags & 64) != 0) {
edit.putBoolean("EnableAllStories", !((TLRPC.PeerNotifySettings) tL_peerNotifySettings).stories_muted);
}
} else {
if ((((TLRPC.PeerNotifySettings) tL_peerNotifySettings).flags & 1) != 0) {
edit.putBoolean("EnablePreviewChannel", ((TLRPC.PeerNotifySettings) tL_peerNotifySettings).show_previews);
}
if ((((TLRPC.PeerNotifySettings) tL_peerNotifySettings).flags & 4) != 0) {
edit.putInt("EnableChannel2", ((TLRPC.PeerNotifySettings) tL_peerNotifySettings).mute_until);
}
}
getNotificationsController().getNotificationsSettingsFacade().applySoundSettings(((TLRPC.PeerNotifySettings) tL_peerNotifySettings).android_sound, edit, 0L, 0L, i, false);
edit.apply();
if (this.loadingNotificationSettings == 0) {
getUserConfig().notificationsSettingsLoaded = true;
getUserConfig().saveConfig(false);
}
}
}
public void lambda$loadGlobalNotificationsSettings$198(TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda195(this, tLObject));
}
public void lambda$loadGlobalNotificationsSettings$197(TLObject tLObject) {
this.loadingNotificationSettings--;
if (tLObject instanceof TLRPC.TL_reactionsNotifySettings) {
TLRPC.TL_reactionsNotifySettings tL_reactionsNotifySettings = (TLRPC.TL_reactionsNotifySettings) tLObject;
SharedPreferences.Editor edit = this.notificationsPreferences.edit();
edit.putBoolean("EnableReactionsMessages", tL_reactionsNotifySettings.messages_notify_from != null);
TLRPC.ReactionNotificationsFrom reactionNotificationsFrom = tL_reactionsNotifySettings.messages_notify_from;
if (reactionNotificationsFrom != null) {
edit.putBoolean("EnableReactionsMessagesContacts", reactionNotificationsFrom instanceof TLRPC.TL_reactionNotificationsFromContacts);
}
edit.putBoolean("EnableReactionsStories", tL_reactionsNotifySettings.stories_notify_from != null);
TLRPC.ReactionNotificationsFrom reactionNotificationsFrom2 = tL_reactionsNotifySettings.stories_notify_from;
if (reactionNotificationsFrom2 != null) {
edit.putBoolean("EnableReactionsStoriesContacts", reactionNotificationsFrom2 instanceof TLRPC.TL_reactionNotificationsFromContacts);
}
edit.putBoolean("EnableReactionsPreview", tL_reactionsNotifySettings.show_previews);
getNotificationsController().getNotificationsSettingsFacade().applySoundSettings(tL_reactionsNotifySettings.sound, edit, 0L, 0L, 4, false);
edit.apply();
}
if (this.loadingNotificationSettings == 0) {
getUserConfig().notificationsSettingsLoaded = true;
getUserConfig().saveConfig(false);
}
}
public void lambda$reloadReactionsNotifySettings$200(TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda194(this, tLObject));
}
public void reloadReactionsNotifySettings() {
getConnectionsManager().sendRequest(new TLRPC.TL_account_getReactionsNotifySettings(), new MessagesController$.ExternalSyntheticLambda352(this));
}
public void lambda$reloadReactionsNotifySettings$199(TLObject tLObject) {
if (tLObject instanceof TLRPC.TL_reactionsNotifySettings) {
TLRPC.TL_reactionsNotifySettings tL_reactionsNotifySettings = (TLRPC.TL_reactionsNotifySettings) tLObject;
SharedPreferences.Editor edit = this.notificationsPreferences.edit();
edit.putBoolean("EnableReactionsMessages", tL_reactionsNotifySettings.messages_notify_from != null);
TLRPC.ReactionNotificationsFrom reactionNotificationsFrom = tL_reactionsNotifySettings.messages_notify_from;
if (reactionNotificationsFrom != null) {
edit.putBoolean("EnableReactionsMessagesContacts", reactionNotificationsFrom instanceof TLRPC.TL_reactionNotificationsFromContacts);
}
edit.putBoolean("EnableReactionsStories", tL_reactionsNotifySettings.stories_notify_from != null);
TLRPC.ReactionNotificationsFrom reactionNotificationsFrom2 = tL_reactionsNotifySettings.stories_notify_from;
if (reactionNotificationsFrom2 != null) {
edit.putBoolean("EnableReactionsStoriesContacts", reactionNotificationsFrom2 instanceof TLRPC.TL_reactionNotificationsFromContacts);
}
edit.putBoolean("EnableReactionsPreview", tL_reactionsNotifySettings.show_previews);
getNotificationsController().getNotificationsSettingsFacade().applySoundSettings(tL_reactionsNotifySettings.sound, edit, 0L, 0L, 4, false);
edit.apply();
getNotificationCenter().postNotificationName(NotificationCenter.notificationsSettingsUpdated, new Object[0]);
}
}
public void loadSignUpNotificationsSettings() {
if (this.loadingNotificationSignUpSettings) {
return;
}
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
this.loadingNotificationSignUpSettings = true;
getConnectionsManager().sendRequest(new TLRPC.TL_account_getContactSignUpNotification(), new MessagesController$.ExternalSyntheticLambda341(this));
}
}
public void lambda$loadSignUpNotificationsSettings$202(TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda188(this, tLObject));
}
public void lambda$loadSignUpNotificationsSettings$201(TLObject tLObject) {
this.loadingNotificationSignUpSettings = false;
SharedPreferences.Editor edit = this.notificationsPreferences.edit();
boolean z = tLObject instanceof TLRPC.TL_boolFalse;
this.enableJoined = z;
edit.putBoolean("EnableContactJoined", z);
edit.commit();
getUserConfig().notificationsSignUpSettingsLoaded = true;
getUserConfig().saveConfig(false);
}
public void forceResetDialogs() {
resetDialogs(true, getMessagesStorage().getLastSeqValue(), getMessagesStorage().getLastPtsValue(), getMessagesStorage().getLastDateValue(), getMessagesStorage().getLastQtsValue());
getNotificationsController().deleteAllNotificationChannels();
}
public void loadUnknownDialog(final TLRPC.InputPeer peer, long taskId) {
NativeByteBuffer nativeByteBuffer;
if (peer == null) {
return;
}
long peerDialogId = DialogObject.getPeerDialogId(peer);
if (this.gettingUnknownDialogs.indexOfKey(peerDialogId) >= 0) {
return;
}
this.gettingUnknownDialogs.put(peerDialogId, Boolean.TRUE);
if (BuildVars.LOGS_ENABLED) {
FileLog.d("load unknown dialog " + peerDialogId);
}
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
TLRPC.TL_messages_getPeerDialogs tL_messages_getPeerDialogs = new TLRPC.TL_messages_getPeerDialogs();
TLRPC.TL_inputDialogPeer tL_inputDialogPeer = new TLRPC.TL_inputDialogPeer();
tL_inputDialogPeer.peer = peer;
tL_messages_getPeerDialogs.peers.add(tL_inputDialogPeer);
if (taskId == 0) {
NativeByteBuffer nativeByteBuffer2 = null;
try {
nativeByteBuffer = new NativeByteBuffer(peer.getObjectSize() + 4);
} catch (Exception e) {
e = e;
}
try {
nativeByteBuffer.writeInt32(15);
peer.serializeToStream(nativeByteBuffer);
} catch (Exception e2) {
e = e2;
nativeByteBuffer2 = nativeByteBuffer;
FileLog.e(e);
nativeByteBuffer = nativeByteBuffer2;
taskId = getMessagesStorage().createPendingTask(nativeByteBuffer);
getConnectionsManager().sendRequest(tL_messages_getPeerDialogs, new MessagesController$.ExternalSyntheticLambda393(this, taskId, peerDialogId));
}
taskId = getMessagesStorage().createPendingTask(nativeByteBuffer);
}
getConnectionsManager().sendRequest(tL_messages_getPeerDialogs, new MessagesController$.ExternalSyntheticLambda393(this, taskId, peerDialogId));
}
}
public void lambda$loadUnknownDialog$203(long j, long j2, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
TLRPC.TL_messages_peerDialogs tL_messages_peerDialogs = (TLRPC.TL_messages_peerDialogs) tLObject;
if (!tL_messages_peerDialogs.dialogs.isEmpty()) {
TLRPC.TL_dialog tL_dialog = (TLRPC.TL_dialog) tL_messages_peerDialogs.dialogs.get(0);
TLRPC.TL_messages_dialogs tL_messages_dialogs = new TLRPC.TL_messages_dialogs();
((TLRPC.messages_Dialogs) tL_messages_dialogs).dialogs.addAll(tL_messages_peerDialogs.dialogs);
((TLRPC.messages_Dialogs) tL_messages_dialogs).messages.addAll(tL_messages_peerDialogs.messages);
((TLRPC.messages_Dialogs) tL_messages_dialogs).users.addAll(tL_messages_peerDialogs.users);
((TLRPC.messages_Dialogs) tL_messages_dialogs).chats.addAll(tL_messages_peerDialogs.chats);
processLoadedDialogs(tL_messages_dialogs, null, null, ((TLRPC.Dialog) tL_dialog).folder_id, 0, 1, this.DIALOGS_LOAD_TYPE_UNKNOWN, false, false, false);
}
}
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
this.gettingUnknownDialogs.delete(j2);
}
private void fetchFolderInLoadedPinnedDialogs(TLRPC.TL_messages_peerDialogs res) {
TLRPC.TL_inputPeerChannel tL_inputPeerUser;
int size = res.dialogs.size();
int i = 0;
for (int i2 = 0; i2 < size; i2++) {
TLRPC.TL_dialogFolder tL_dialogFolder = (TLRPC.Dialog) res.dialogs.get(i2);
if (tL_dialogFolder instanceof TLRPC.TL_dialogFolder) {
TLRPC.TL_dialogFolder tL_dialogFolder2 = tL_dialogFolder;
long peerDialogId = DialogObject.getPeerDialogId(((TLRPC.Dialog) tL_dialogFolder).peer);
if (((TLRPC.Dialog) tL_dialogFolder2).top_message == 0 || peerDialogId == 0) {
res.dialogs.remove(tL_dialogFolder2);
} else {
int size2 = res.messages.size();
for (int i3 = 0; i3 < size2; i3++) {
TLRPC.Message message = (TLRPC.Message) res.messages.get(i3);
if (peerDialogId == MessageObject.getDialogId(message) && ((TLRPC.Dialog) tL_dialogFolder).top_message == message.id) {
TLRPC.TL_dialog tL_dialog = new TLRPC.TL_dialog();
((TLRPC.Dialog) tL_dialog).peer = ((TLRPC.Dialog) tL_dialogFolder).peer;
((TLRPC.Dialog) tL_dialog).top_message = ((TLRPC.Dialog) tL_dialogFolder).top_message;
((TLRPC.Dialog) tL_dialog).folder_id = tL_dialogFolder2.folder.id;
((TLRPC.Dialog) tL_dialog).flags |= 16;
res.dialogs.add(tL_dialog);
TLRPC.Peer peer = ((TLRPC.Dialog) tL_dialogFolder).peer;
if (peer instanceof TLRPC.TL_peerChannel) {
tL_inputPeerUser = new TLRPC.TL_inputPeerChannel();
((TLRPC.InputPeer) tL_inputPeerUser).channel_id = ((TLRPC.Dialog) tL_dialogFolder).peer.channel_id;
int size3 = res.chats.size();
while (true) {
if (i >= size3) {
break;
}
TLRPC.Chat chat = (TLRPC.Chat) res.chats.get(i);
if (chat.id == ((TLRPC.InputPeer) tL_inputPeerUser).channel_id) {
((TLRPC.InputPeer) tL_inputPeerUser).access_hash = chat.access_hash;
break;
}
i++;
}
} else if (peer instanceof TLRPC.TL_peerChat) {
tL_inputPeerUser = new TLRPC.TL_inputPeerChat();
((TLRPC.InputPeer) tL_inputPeerUser).chat_id = ((TLRPC.Dialog) tL_dialogFolder).peer.chat_id;
} else {
tL_inputPeerUser = new TLRPC.TL_inputPeerUser();
((TLRPC.InputPeer) tL_inputPeerUser).user_id = ((TLRPC.Dialog) tL_dialogFolder).peer.user_id;
int size4 = res.users.size();
while (true) {
if (i >= size4) {
break;
}
TLRPC$User tLRPC$User = (TLRPC$User) res.users.get(i);
if (tLRPC$User.id == ((TLRPC.InputPeer) tL_inputPeerUser).user_id) {
((TLRPC.InputPeer) tL_inputPeerUser).access_hash = tLRPC$User.access_hash;
break;
}
i++;
}
}
loadUnknownDialog(tL_inputPeerUser, 0L);
return;
}
}
return;
}
}
}
}
public void lambda$resetDialogs$204(int i, int i2, int i3, int i4, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
this.resetDialogsPinned = (TLRPC.TL_messages_peerDialogs) tLObject;
for (int i5 = 0; i5 < this.resetDialogsPinned.dialogs.size(); i5++) {
((TLRPC.Dialog) this.resetDialogsPinned.dialogs.get(i5)).pinned = true;
}
resetDialogs(false, i, i2, i3, i4);
}
}
public void lambda$resetDialogs$205(int i, int i2, int i3, int i4, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
this.resetDialogsAll = (TLRPC.messages_Dialogs) tLObject;
resetDialogs(false, i, i2, i3, i4);
}
}
private void resetDialogs(boolean r27, int r28, int r29, int r30, int r31) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.resetDialogs(boolean, int, int, int, int):void");
}
public void completeDialogsReset(final TLRPC.messages_Dialogs dialogsRes, int messagesCount, int seq, int newPts, int date, int qts, LongSparseArray<TLRPC.Dialog> new_dialogs_dict, LongSparseArray<ArrayList<MessageObject>> new_dialogMessage, TLRPC.Message lastMessage) {
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda74(this, newPts, date, qts, dialogsRes, new_dialogs_dict, new_dialogMessage));
}
public void lambda$completeDialogsReset$207(int i, int i2, int i3, TLRPC.messages_Dialogs messages_dialogs, LongSparseArray longSparseArray, LongSparseArray longSparseArray2) {
this.gettingDifference = false;
getMessagesStorage().setLastPtsValue(i);
getMessagesStorage().setLastDateValue(i2);
getMessagesStorage().setLastQtsValue(i3);
getDifference();
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda257(this, messages_dialogs, longSparseArray, longSparseArray2));
}
public void lambda$completeDialogsReset$206(TLRPC.messages_Dialogs messages_dialogs, LongSparseArray longSparseArray, LongSparseArray longSparseArray2) {
MediaDataController mediaDataController;
long j;
this.resetingDialogs = false;
applyDialogsNotificationsSettings(messages_dialogs.dialogs);
MediaDataController mediaDataController2 = getMediaDataController();
mediaDataController2.clearAllDrafts(false);
mediaDataController2.loadDraftsIfNeed();
putUsers(messages_dialogs.users, false);
putChats(messages_dialogs.chats, false);
for (int i = 0; i < this.allDialogs.size(); i++) {
TLRPC.Dialog dialog = this.allDialogs.get(i);
if (!DialogObject.isEncryptedDialog(dialog.id)) {
this.dialogs_dict.remove(dialog.id);
ArrayList<MessageObject> arrayList = this.dialogMessage.get(dialog.id);
this.dialogMessage.remove(dialog.id);
if (arrayList != null) {
for (int i2 = 0; i2 < arrayList.size(); i2++) {
MessageObject messageObject = arrayList.get(i2);
if (messageObject != null) {
if (messageObject.messageOwner.peer_id.channel_id == 0) {
this.dialogMessagesByIds.remove(messageObject.getId());
}
long j2 = messageObject.messageOwner.random_id;
if (j2 != 0) {
this.dialogMessagesByRandomIds.remove(j2);
}
}
}
}
}
}
int i3 = 0;
while (i3 < longSparseArray.size()) {
long keyAt = longSparseArray.keyAt(i3);
TLRPC.Dialog dialog2 = (TLRPC.Dialog) longSparseArray.valueAt(i3);
TLRPC.DraftMessage draftMessage = dialog2.draft;
if (draftMessage instanceof TLRPC.TL_draftMessage) {
mediaDataController = mediaDataController2;
j = keyAt;
mediaDataController2.saveDraft(dialog2.id, 0L, draftMessage, (TLRPC.Message) null, false);
} else {
mediaDataController = mediaDataController2;
j = keyAt;
}
this.dialogs_dict.put(j, dialog2);
ArrayList<MessageObject> arrayList2 = (ArrayList) longSparseArray2.get(dialog2.id);
this.dialogMessage.put(j, arrayList2);
if (arrayList2 != null) {
for (int i4 = 0; i4 < arrayList2.size(); i4++) {
MessageObject messageObject2 = arrayList2.get(i4);
if (messageObject2 != null && messageObject2.messageOwner.peer_id.channel_id == 0) {
this.dialogMessagesByIds.put(messageObject2.getId(), messageObject2);
this.dialogsLoadedTillDate = Math.min(this.dialogsLoadedTillDate, messageObject2.messageOwner.date);
long j3 = messageObject2.messageOwner.random_id;
if (j3 != 0) {
this.dialogMessagesByRandomIds.put(j3, messageObject2);
}
}
}
}
getTranslateController().checkDialogMessage(j);
i3++;
mediaDataController2 = mediaDataController;
}
this.allDialogs.clear();
int size = this.dialogs_dict.size();
for (int i5 = 0; i5 < size; i5++) {
TLRPC.Dialog valueAt = this.dialogs_dict.valueAt(i5);
if (this.deletingDialogs.indexOfKey(valueAt.id) < 0) {
this.allDialogs.add(valueAt);
}
}
sortDialogs(null);
this.dialogsEndReached.put(0, true);
this.serverDialogsEndReached.put(0, false);
this.dialogsEndReached.put(1, true);
this.serverDialogsEndReached.put(1, false);
int totalDialogsCount = getUserConfig().getTotalDialogsCount(0);
long[] dialogLoadOffsets = getUserConfig().getDialogLoadOffsets(0);
if (totalDialogsCount < 400 && dialogLoadOffsets[0] != -1 && dialogLoadOffsets[0] != 2147483647L) {
loadDialogs(0, 0, 100, false);
}
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
private void migrateDialogs(int offset, int offsetDate, long offsetUser, long offsetChat, long offsetChannel, long accessPeer) {
if (this.migratingDialogs || offset == -1) {
return;
}
this.migratingDialogs = true;
TLRPC.TL_messages_getDialogs tL_messages_getDialogs = new TLRPC.TL_messages_getDialogs();
tL_messages_getDialogs.exclude_pinned = true;
tL_messages_getDialogs.limit = 100;
tL_messages_getDialogs.offset_id = offset;
tL_messages_getDialogs.offset_date = offsetDate;
if (BuildVars.LOGS_ENABLED) {
FileLog.d("start migrate with id " + offset + " date " + LocaleController.getInstance().formatterStats.format(offsetDate * 1000));
}
if (offset == 0) {
tL_messages_getDialogs.offset_peer = new TLRPC.TL_inputPeerEmpty();
} else {
if (offsetChannel != 0) {
TLRPC.TL_inputPeerChannel tL_inputPeerChannel = new TLRPC.TL_inputPeerChannel();
tL_messages_getDialogs.offset_peer = tL_inputPeerChannel;
((TLRPC.InputPeer) tL_inputPeerChannel).channel_id = offsetChannel;
} else if (offsetUser != 0) {
TLRPC.TL_inputPeerUser tL_inputPeerUser = new TLRPC.TL_inputPeerUser();
tL_messages_getDialogs.offset_peer = tL_inputPeerUser;
((TLRPC.InputPeer) tL_inputPeerUser).user_id = offsetUser;
} else {
TLRPC.TL_inputPeerChat tL_inputPeerChat = new TLRPC.TL_inputPeerChat();
tL_messages_getDialogs.offset_peer = tL_inputPeerChat;
((TLRPC.InputPeer) tL_inputPeerChat).chat_id = offsetChat;
}
tL_messages_getDialogs.offset_peer.access_hash = accessPeer;
}
getConnectionsManager().sendRequest(tL_messages_getDialogs, new MessagesController$.ExternalSyntheticLambda354(this, offset));
}
public void lambda$migrateDialogs$211(int i, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
getMessagesStorage().getStorageQueue().postRunnable(new MessagesController$.ExternalSyntheticLambda256(this, (TLRPC.messages_Dialogs) tLObject, i));
} else {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda40(this));
}
}
public void lambda$migrateDialogs$209(org.telegram.tgnet.TLRPC.messages_Dialogs r36, int r37) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$migrateDialogs$209(org.telegram.tgnet.TLRPC$messages_Dialogs, int):void");
}
public void lambda$migrateDialogs$208() {
this.migratingDialogs = false;
}
public void lambda$migrateDialogs$210() {
this.migratingDialogs = false;
}
public void processLoadedDialogs(final TLRPC.messages_Dialogs dialogsRes, ArrayList<TLRPC.EncryptedChat> encChats, ArrayList<TLRPC.UserFull> fullUsers, int folderId, int offset, int count, int loadType, boolean resetEnd, boolean migrate, boolean fromCache) {
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda75(this, folderId, loadType, dialogsRes, fullUsers, resetEnd, count, encChats, offset, fromCache, migrate));
}
public void lambda$processLoadedDialogs$215(int r31, int r32, org.telegram.tgnet.TLRPC.messages_Dialogs r33, java.util.ArrayList r34, boolean r35, int r36, java.util.ArrayList r37, int r38, boolean r39, boolean r40) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$processLoadedDialogs$215(int, int, org.telegram.tgnet.TLRPC$messages_Dialogs, java.util.ArrayList, boolean, int, java.util.ArrayList, int, boolean, boolean):void");
}
public void lambda$processLoadedDialogs$212(TLRPC.messages_Dialogs messages_dialogs, ArrayList arrayList, int i, boolean z, long[] jArr, int i2) {
putUsers(messages_dialogs.users, true);
if (arrayList != null) {
for (int i3 = 0; i3 < arrayList.size(); i3++) {
long j = ((TLRPC.UserFull) arrayList.get(i3)).id;
this.fullUsers.put(j, (TLRPC.UserFull) arrayList.get(i3));
getTranslateController().updateDialogFull(j);
}
}
this.loadingDialogs.put(i, false);
if (z) {
this.dialogsEndReached.put(i, false);
this.serverDialogsEndReached.put(i, false);
} else if (jArr[0] == 2147483647L) {
this.dialogsEndReached.put(i, true);
this.serverDialogsEndReached.put(i, true);
} else {
loadDialogs(i, 0, i2, false);
}
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
public void lambda$processLoadedDialogs$213(TLRPC.Chat chat) {
checkChatInviter(chat.id, true);
}
public void lambda$processLoadedDialogs$214(org.telegram.tgnet.TLRPC.Message r28, int r29, org.telegram.tgnet.TLRPC.messages_Dialogs r30, java.util.ArrayList r31, java.util.ArrayList r32, boolean r33, int r34, androidx.collection.LongSparseArray r35, androidx.collection.LongSparseArray r36, androidx.collection.LongSparseArray r37, int r38, boolean r39, int r40, java.util.ArrayList r41) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$processLoadedDialogs$214(org.telegram.tgnet.TLRPC$Message, int, org.telegram.tgnet.TLRPC$messages_Dialogs, java.util.ArrayList, java.util.ArrayList, boolean, int, androidx.collection.LongSparseArray, androidx.collection.LongSparseArray, androidx.collection.LongSparseArray, int, boolean, int, java.util.ArrayList):void");
}
private void applyDialogNotificationsSettings(long dialogId, long topicId, TLRPC.PeerNotifySettings notify_settings) {
getNotificationsController().getNotificationsSettingsFacade().applyDialogNotificationsSettings(dialogId, topicId, notify_settings);
}
private void applyDialogsNotificationsSettings(ArrayList<TLRPC.Dialog> dialogs) {
SharedPreferences.Editor edit = getNotificationsSettings(this.currentAccount).edit();
for (int i = 0; i < dialogs.size(); i++) {
TLRPC.Dialog dialog = dialogs.get(i);
if (dialog.peer != null && (dialog.notify_settings instanceof TLRPC.TL_peerNotifySettings)) {
getNotificationsController().getNotificationsSettingsFacade().setSettingsForDialog(edit, dialog, dialog.notify_settings);
}
}
edit.apply();
}
public void reloadMentionsCountForChannel(TLRPC.InputPeer peer, long taskId) {
NativeByteBuffer nativeByteBuffer;
Exception e;
if (taskId == 0) {
try {
nativeByteBuffer = new NativeByteBuffer(peer.getObjectSize() + 4);
} catch (Exception e2) {
nativeByteBuffer = null;
e = e2;
}
try {
nativeByteBuffer.writeInt32(22);
peer.serializeToStream(nativeByteBuffer);
} catch (Exception e3) {
e = e3;
FileLog.e(e);
taskId = getMessagesStorage().createPendingTask(nativeByteBuffer);
TLRPC.TL_messages_getUnreadMentions tL_messages_getUnreadMentions = new TLRPC.TL_messages_getUnreadMentions();
tL_messages_getUnreadMentions.peer = peer;
tL_messages_getUnreadMentions.limit = 1;
getConnectionsManager().sendRequest(tL_messages_getUnreadMentions, new MessagesController$.ExternalSyntheticLambda432(this, peer, taskId));
}
taskId = getMessagesStorage().createPendingTask(nativeByteBuffer);
}
TLRPC.TL_messages_getUnreadMentions tL_messages_getUnreadMentions2 = new TLRPC.TL_messages_getUnreadMentions();
tL_messages_getUnreadMentions2.peer = peer;
tL_messages_getUnreadMentions2.limit = 1;
getConnectionsManager().sendRequest(tL_messages_getUnreadMentions2, new MessagesController$.ExternalSyntheticLambda432(this, peer, taskId));
}
public void lambda$reloadMentionsCountForChannel$216(TLRPC.InputPeer inputPeer, long j, TLObject tLObject, TLRPC.TL_error tL_error) {
TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject;
if (messages_messages != null) {
int i = messages_messages.count;
if (i == 0) {
i = messages_messages.messages.size();
}
getMessagesStorage().resetMentionsCount(-inputPeer.channel_id, 0L, i);
}
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
}
public void reloadMentionsCountForChannels(final ArrayList<Long> arrayList) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda158(this, arrayList));
}
public void lambda$reloadMentionsCountForChannels$217(ArrayList arrayList) {
for (int i = 0; i < arrayList.size(); i++) {
reloadMentionsCountForChannel(getInputPeer(-((Long) arrayList.get(i)).longValue()), 0L);
}
}
public void processDialogsUpdateRead(final LongSparseIntArray dialogsToUpdate, LongSparseIntArray dialogsMentionsToUpdate) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda185(this, dialogsToUpdate, dialogsMentionsToUpdate));
}
public void lambda$processDialogsUpdateRead$218(org.telegram.messenger.support.LongSparseIntArray r14, org.telegram.messenger.support.LongSparseIntArray r15) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$processDialogsUpdateRead$218(org.telegram.messenger.support.LongSparseIntArray, org.telegram.messenger.support.LongSparseIntArray):void");
}
public void checkLastDialogMessage(TLRPC.Dialog dialog, TLRPC.InputPeer peer, long taskId) {
AbstractSerializedData abstractSerializedData;
Exception e;
if (DialogObject.isEncryptedDialog(dialog.id) || this.checkingLastMessagesDialogs.indexOfKey(dialog.id) >= 0) {
return;
}
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
TLRPC.TL_messages_getHistory tL_messages_getHistory = new TLRPC.TL_messages_getHistory();
if (peer == null) {
peer = getInputPeer(dialog.id);
}
tL_messages_getHistory.peer = peer;
if (peer == null) {
return;
}
tL_messages_getHistory.limit = 1;
this.checkingLastMessagesDialogs.put(dialog.id, Boolean.TRUE);
if (BuildVars.LOGS_ENABLED) {
FileLog.d("checkLastDialogMessage for " + dialog.id);
}
if (taskId == 0) {
try {
abstractSerializedData = new NativeByteBuffer(tL_messages_getHistory.peer.getObjectSize() + 60);
} catch (Exception e2) {
abstractSerializedData = null;
e = e2;
}
try {
abstractSerializedData.writeInt32(14);
abstractSerializedData.writeInt64(dialog.id);
abstractSerializedData.writeInt32(dialog.top_message);
abstractSerializedData.writeInt32(dialog.read_inbox_max_id);
abstractSerializedData.writeInt32(dialog.read_outbox_max_id);
abstractSerializedData.writeInt32(dialog.unread_count);
abstractSerializedData.writeInt32(dialog.last_message_date);
abstractSerializedData.writeInt32(dialog.pts);
abstractSerializedData.writeInt32(dialog.flags);
abstractSerializedData.writeBool(dialog.pinned);
abstractSerializedData.writeInt32(dialog.pinnedNum);
abstractSerializedData.writeInt32(dialog.unread_mentions_count);
abstractSerializedData.writeBool(dialog.unread_mark);
abstractSerializedData.writeInt32(dialog.folder_id);
tL_messages_getHistory.peer.serializeToStream(abstractSerializedData);
} catch (Exception e3) {
e = e3;
FileLog.e(e);
taskId = getMessagesStorage().createPendingTask(abstractSerializedData);
getConnectionsManager().sendRequest(tL_messages_getHistory, new MessagesController$.ExternalSyntheticLambda431(this, dialog, taskId));
}
taskId = getMessagesStorage().createPendingTask(abstractSerializedData);
}
getConnectionsManager().sendRequest(tL_messages_getHistory, new MessagesController$.ExternalSyntheticLambda431(this, dialog, taskId));
}
}
public void lambda$checkLastDialogMessage$222(TLRPC.Dialog dialog, long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject;
removeDeletedMessagesFromArray(dialog.id, messages_messages.messages);
if (!messages_messages.messages.isEmpty()) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("checkLastDialogMessage for " + dialog.id + " has message");
}
TLRPC.TL_messages_dialogs tL_messages_dialogs = new TLRPC.TL_messages_dialogs();
TLRPC.Message message = (TLRPC.Message) messages_messages.messages.get(0);
TLRPC.TL_dialog tL_dialog = new TLRPC.TL_dialog();
((TLRPC.Dialog) tL_dialog).flags = dialog.flags;
((TLRPC.Dialog) tL_dialog).top_message = message.id;
((TLRPC.Dialog) tL_dialog).last_message_date = message.date;
((TLRPC.Dialog) tL_dialog).notify_settings = dialog.notify_settings;
((TLRPC.Dialog) tL_dialog).pts = dialog.pts;
((TLRPC.Dialog) tL_dialog).unread_count = dialog.unread_count;
((TLRPC.Dialog) tL_dialog).unread_mark = dialog.unread_mark;
((TLRPC.Dialog) tL_dialog).unread_mentions_count = dialog.unread_mentions_count;
((TLRPC.Dialog) tL_dialog).unread_reactions_count = dialog.unread_reactions_count;
((TLRPC.Dialog) tL_dialog).read_inbox_max_id = dialog.read_inbox_max_id;
((TLRPC.Dialog) tL_dialog).read_outbox_max_id = dialog.read_outbox_max_id;
((TLRPC.Dialog) tL_dialog).pinned = dialog.pinned;
((TLRPC.Dialog) tL_dialog).pinnedNum = dialog.pinnedNum;
((TLRPC.Dialog) tL_dialog).folder_id = dialog.folder_id;
long j2 = dialog.id;
((TLRPC.Dialog) tL_dialog).id = j2;
message.dialog_id = j2;
((TLRPC.messages_Dialogs) tL_messages_dialogs).users.addAll(messages_messages.users);
((TLRPC.messages_Dialogs) tL_messages_dialogs).chats.addAll(messages_messages.chats);
((TLRPC.messages_Dialogs) tL_messages_dialogs).dialogs.add(tL_dialog);
((TLRPC.messages_Dialogs) tL_messages_dialogs).messages.addAll(messages_messages.messages);
((TLRPC.messages_Dialogs) tL_messages_dialogs).count = 1;
processDialogsUpdate(tL_messages_dialogs, null, false);
getMessagesStorage().putMessages(messages_messages.messages, true, true, false, getDownloadController().getAutodownloadMask(), true, 0, 0L);
} else {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda216(this, dialog));
}
}
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda215(this, dialog));
}
public void lambda$checkLastDialogMessage$220(TLRPC.Dialog dialog) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("checkLastDialogMessage for " + dialog.id + " has not message");
}
if (getMediaDataController().getDraft(dialog.id, 0L) == null) {
TLRPC.Dialog dialog2 = this.dialogs_dict.get(dialog.id);
if (dialog2 == null) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("checkLastDialogMessage for " + dialog.id + " current dialog not found");
}
getMessagesStorage().isDialogHasTopMessage(dialog.id, new MessagesController$.ExternalSyntheticLambda217(this, dialog));
return;
}
if (BuildVars.LOGS_ENABLED) {
FileLog.d("checkLastDialogMessage for " + dialog.id + " current dialog top message " + dialog2.top_message);
}
if (dialog2.top_message == 0) {
deleteDialog(dialog.id, 3);
}
}
}
public void lambda$checkLastDialogMessage$219(TLRPC.Dialog dialog) {
deleteDialog(dialog.id, 3);
}
public void lambda$checkLastDialogMessage$221(TLRPC.Dialog dialog) {
this.checkingLastMessagesDialogs.delete(dialog.id);
}
public void processDialogsUpdate(final TLRPC.messages_Dialogs dialogsRes, ArrayList<TLRPC.EncryptedChat> encChats, boolean fromCache) {
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda261(this, dialogsRes, fromCache));
}
public void lambda$processDialogsUpdate$224(org.telegram.tgnet.TLRPC.messages_Dialogs r20, boolean r21) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$processDialogsUpdate$224(org.telegram.tgnet.TLRPC$messages_Dialogs, boolean):void");
}
public void lambda$processDialogsUpdate$223(org.telegram.tgnet.TLRPC.messages_Dialogs r22, androidx.collection.LongSparseArray r23, androidx.collection.LongSparseArray r24, boolean r25, org.telegram.messenger.support.LongSparseIntArray r26) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$processDialogsUpdate$223(org.telegram.tgnet.TLRPC$messages_Dialogs, androidx.collection.LongSparseArray, androidx.collection.LongSparseArray, boolean, org.telegram.messenger.support.LongSparseIntArray):void");
}
private int messagesMaxDate(ArrayList<MessageObject> messages) {
TLRPC.Message message;
int i;
int i2 = Integer.MIN_VALUE;
for (int i3 = 0; messages != null && i3 < messages.size(); i3++) {
MessageObject messageObject = messages.get(i3);
if (messageObject != null && (message = messageObject.messageOwner) != null && (i = message.date) > i2) {
i2 = i;
}
}
return i2;
}
public void addToViewsQueue(MessageObject messageObject) {
if (messageObject == null) {
return;
}
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda177(this, messageObject));
}
public void lambda$addToViewsQueue$225(MessageObject messageObject) {
long dialogId = messageObject.getDialogId();
int id = messageObject.getId();
ArrayList<Integer> arrayList = this.channelViewsToSend.get(dialogId);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.channelViewsToSend.put(dialogId, arrayList);
}
if (arrayList.contains(Integer.valueOf(id))) {
return;
}
arrayList.add(Integer.valueOf(id));
}
public void addToPollsQueue(long dialogId, ArrayList<MessageObject> visibleObjects) {
int i;
SparseArray<MessageObject> sparseArray = this.pollsToCheck.get(dialogId);
if (sparseArray == null) {
sparseArray = new SparseArray<>();
this.pollsToCheck.put(dialogId, sparseArray);
this.pollsToCheckSize++;
}
int size = sparseArray.size();
for (int i2 = 0; i2 < size; i2++) {
sparseArray.valueAt(i2).pollVisibleOnScreen = false;
}
int currentTime = getConnectionsManager().getCurrentTime();
int size2 = visibleObjects.size();
boolean z = false;
int i3 = ConnectionsManager.DEFAULT_DATACENTER_ID;
for (int i4 = 0; i4 < size2; i4++) {
MessageObject messageObject = visibleObjects.get(i4);
if (messageObject.type == 17) {
TLRPC.Poll poll = messageObject.messageOwner.media.poll;
if (!poll.closed && (i = poll.close_date) != 0) {
if (i <= currentTime) {
z = true;
} else {
i3 = Math.min(i3, i - currentTime);
}
}
int id = messageObject.getId();
MessageObject messageObject2 = sparseArray.get(id);
if (messageObject2 != null) {
messageObject2.pollVisibleOnScreen = true;
} else {
sparseArray.put(id, messageObject);
}
}
}
if (z) {
this.lastViewsCheckTime = 0L;
} else if (i3 < 5) {
this.lastViewsCheckTime = Math.min(this.lastViewsCheckTime, System.currentTimeMillis() - ((5 - i3) * 1000));
}
}
public void markMessageContentAsRead(MessageObject messageObject) {
if (messageObject.scheduled) {
return;
}
ArrayList arrayList = new ArrayList();
if (messageObject.messageOwner.mentioned) {
getMessagesStorage().markMentionMessageAsRead(-messageObject.messageOwner.peer_id.channel_id, messageObject.getId(), messageObject.getDialogId());
}
arrayList.add(Integer.valueOf(messageObject.getId()));
long dialogId = messageObject.getDialogId();
getMessagesStorage().markMessagesContentAsRead(dialogId, arrayList, 0, 0);
getNotificationCenter().postNotificationName(NotificationCenter.messagesReadContent, new Object[]{Long.valueOf(dialogId), arrayList});
if (messageObject.getId() < 0) {
markMessageAsRead(messageObject.getDialogId(), messageObject.messageOwner.random_id, Integer.MIN_VALUE);
return;
}
if (messageObject.messageOwner.peer_id.channel_id != 0) {
TLRPC.TL_channels_readMessageContents tL_channels_readMessageContents = new TLRPC.TL_channels_readMessageContents();
TLRPC.InputChannel inputChannel = getInputChannel(messageObject.messageOwner.peer_id.channel_id);
tL_channels_readMessageContents.channel = inputChannel;
if (inputChannel == null) {
return;
}
tL_channels_readMessageContents.id.add(Integer.valueOf(messageObject.getId()));
getConnectionsManager().sendRequest(tL_channels_readMessageContents, MessagesController$.ExternalSyntheticLambda464.INSTANCE);
return;
}
TLRPC.TL_messages_readMessageContents tL_messages_readMessageContents = new TLRPC.TL_messages_readMessageContents();
tL_messages_readMessageContents.id.add(Integer.valueOf(messageObject.getId()));
getConnectionsManager().sendRequest(tL_messages_readMessageContents, new MessagesController$.ExternalSyntheticLambda340(this));
}
public void lambda$markMessageContentAsRead$227(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC.TL_messages_affectedMessages tL_messages_affectedMessages = (TLRPC.TL_messages_affectedMessages) tLObject;
processNewDifferenceParams(-1, tL_messages_affectedMessages.pts, -1, tL_messages_affectedMessages.pts_count);
}
}
public void markMentionMessageAsRead(int mid, long channelId, long did) {
getMessagesStorage().markMentionMessageAsRead(-channelId, mid, did);
if (channelId != 0) {
TLRPC.TL_channels_readMessageContents tL_channels_readMessageContents = new TLRPC.TL_channels_readMessageContents();
TLRPC.InputChannel inputChannel = getInputChannel(channelId);
tL_channels_readMessageContents.channel = inputChannel;
if (inputChannel == null) {
return;
}
tL_channels_readMessageContents.id.add(Integer.valueOf(mid));
getConnectionsManager().sendRequest(tL_channels_readMessageContents, MessagesController$.ExternalSyntheticLambda457.INSTANCE);
return;
}
TLRPC.TL_messages_readMessageContents tL_messages_readMessageContents = new TLRPC.TL_messages_readMessageContents();
tL_messages_readMessageContents.id.add(Integer.valueOf(mid));
getConnectionsManager().sendRequest(tL_messages_readMessageContents, new MessagesController$.ExternalSyntheticLambda346(this));
}
public void lambda$markMentionMessageAsRead$229(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC.TL_messages_affectedMessages tL_messages_affectedMessages = (TLRPC.TL_messages_affectedMessages) tLObject;
processNewDifferenceParams(-1, tL_messages_affectedMessages.pts, -1, tL_messages_affectedMessages.pts_count);
}
}
public long createDeleteShowOnceTask(long dialogId, int mid) {
NativeByteBuffer nativeByteBuffer;
NativeByteBuffer nativeByteBuffer2 = null;
try {
nativeByteBuffer = new NativeByteBuffer(16);
} catch (Exception e) {
e = e;
}
try {
nativeByteBuffer.writeInt32(102);
nativeByteBuffer.writeInt64(dialogId);
nativeByteBuffer.writeInt32(mid);
} catch (Exception e2) {
e = e2;
nativeByteBuffer2 = nativeByteBuffer;
FileLog.e(e);
nativeByteBuffer = nativeByteBuffer2;
return getMessagesStorage().createPendingTask(nativeByteBuffer);
}
return getMessagesStorage().createPendingTask(nativeByteBuffer);
}
public void lambda$checkDeletingTask$81(long taskId, long dialogId, int mid) {
getMessagesStorage().removePendingTask(taskId);
ArrayList arrayList = new ArrayList();
arrayList.add(Integer.valueOf(mid));
getMessagesStorage().emptyMessagesMedia(dialogId, arrayList);
}
public void markMessageAsRead2(long dialogId, int mid, TLRPC.InputChannel inputChannel, int ttl, long taskId) {
markMessageAsRead2(dialogId, mid, inputChannel, ttl, taskId, true);
}
public void markMessageAsRead2(long r15, int r17, org.telegram.tgnet.TLRPC.InputChannel r18, int r19, long r20, boolean r22) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.markMessageAsRead2(long, int, org.telegram.tgnet.TLRPC$InputChannel, int, long, boolean):void");
}
public void lambda$markMessageAsRead2$230(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
}
public void lambda$markMessageAsRead2$231(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC.TL_messages_affectedMessages tL_messages_affectedMessages = (TLRPC.TL_messages_affectedMessages) tLObject;
processNewDifferenceParams(-1, tL_messages_affectedMessages.pts, -1, tL_messages_affectedMessages.pts_count);
}
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
}
public void markMessageAsRead(long dialogId, long randomId, int ttl) {
TLRPC.EncryptedChat encryptedChat;
if (randomId == 0 || dialogId == 0) {
return;
}
if ((ttl > 0 || ttl == Integer.MIN_VALUE) && DialogObject.isEncryptedDialog(dialogId) && (encryptedChat = getEncryptedChat(Integer.valueOf(DialogObject.getEncryptedChatId(dialogId)))) != null) {
ArrayList arrayList = new ArrayList();
arrayList.add(Long.valueOf(randomId));
getSecretChatHelper().sendMessagesReadMessage(encryptedChat, arrayList, (TLRPC.Message) null);
if (ttl > 0) {
int currentTime = getConnectionsManager().getCurrentTime();
getMessagesStorage().createTaskForSecretChat(encryptedChat.id, currentTime, currentTime, 0, arrayList);
}
}
}
private void completeReadTask(ReadTask task) {
TLRPC.TL_channels_readHistory tL_channels_readHistory;
if (task.replyId != 0) {
TLRPC.TL_messages_readDiscussion tL_messages_readDiscussion = new TLRPC.TL_messages_readDiscussion();
tL_messages_readDiscussion.msg_id = (int) task.replyId;
tL_messages_readDiscussion.peer = getInputPeer(task.dialogId);
tL_messages_readDiscussion.read_max_id = task.maxId;
getConnectionsManager().sendRequest(tL_messages_readDiscussion, MessagesController$.ExternalSyntheticLambda455.INSTANCE);
return;
}
if (!DialogObject.isEncryptedDialog(task.dialogId)) {
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
TLRPC.InputPeer inputPeer = getInputPeer(task.dialogId);
if (inputPeer instanceof TLRPC.TL_inputPeerChannel) {
tL_channels_readHistory = new TLRPC.TL_channels_readHistory();
tL_channels_readHistory.channel = getInputChannel(-task.dialogId);
tL_channels_readHistory.max_id = task.maxId;
} else {
TLRPC.TL_channels_readHistory tL_messages_readHistory = new TLRPC.TL_messages_readHistory();
((TLRPC.TL_messages_readHistory) tL_messages_readHistory).peer = inputPeer;
((TLRPC.TL_messages_readHistory) tL_messages_readHistory).max_id = task.maxId;
tL_channels_readHistory = tL_messages_readHistory;
}
getConnectionsManager().sendRequest(tL_channels_readHistory, new MessagesController$.ExternalSyntheticLambda351(this));
return;
}
return;
}
TLRPC.EncryptedChat encryptedChat = getEncryptedChat(Integer.valueOf(DialogObject.getEncryptedChatId(task.dialogId)));
byte[] bArr = encryptedChat.auth_key;
if (bArr == null || bArr.length <= 1 || !(encryptedChat instanceof TLRPC.TL_encryptedChat)) {
return;
}
TLRPC.TL_messages_readEncryptedHistory tL_messages_readEncryptedHistory = new TLRPC.TL_messages_readEncryptedHistory();
TLRPC.TL_inputEncryptedChat tL_inputEncryptedChat = new TLRPC.TL_inputEncryptedChat();
tL_messages_readEncryptedHistory.peer = tL_inputEncryptedChat;
tL_inputEncryptedChat.chat_id = encryptedChat.id;
tL_inputEncryptedChat.access_hash = encryptedChat.access_hash;
tL_messages_readEncryptedHistory.max_date = task.maxDate;
getConnectionsManager().sendRequest(tL_messages_readEncryptedHistory, MessagesController$.ExternalSyntheticLambda469.INSTANCE);
}
public void lambda$completeReadTask$233(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null && (tLObject instanceof TLRPC.TL_messages_affectedMessages)) {
TLRPC.TL_messages_affectedMessages tL_messages_affectedMessages = (TLRPC.TL_messages_affectedMessages) tLObject;
processNewDifferenceParams(-1, tL_messages_affectedMessages.pts, -1, tL_messages_affectedMessages.pts_count);
}
}
private void checkReadTasks() {
long elapsedRealtime = SystemClock.elapsedRealtime();
int size = this.readTasks.size();
int i = 0;
int i2 = 0;
while (i2 < size) {
ReadTask readTask = this.readTasks.get(i2);
if (readTask.sendRequestTime <= elapsedRealtime) {
completeReadTask(readTask);
this.readTasks.remove(i2);
this.readTasksMap.remove(readTask.dialogId);
i2--;
size--;
}
i2++;
}
int size2 = this.repliesReadTasks.size();
while (i < size2) {
ReadTask readTask2 = this.repliesReadTasks.get(i);
if (readTask2.sendRequestTime <= elapsedRealtime) {
completeReadTask(readTask2);
this.repliesReadTasks.remove(i);
this.threadsReadTasksMap.remove(readTask2.dialogId + "_" + readTask2.replyId);
i += -1;
size2 += -1;
}
i++;
}
}
public void markDialogAsReadNow(long dialogId, long replyId) {
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda117(this, replyId, dialogId));
}
public void lambda$markDialogAsReadNow$235(long j, long j2) {
if (j != 0) {
String str = j2 + "_" + j;
ReadTask readTask = this.threadsReadTasksMap.get(str);
if (readTask == null) {
return;
}
completeReadTask(readTask);
this.repliesReadTasks.remove(readTask);
this.threadsReadTasksMap.remove(str);
return;
}
ReadTask readTask2 = this.readTasksMap.get(j2);
if (readTask2 == null) {
return;
}
completeReadTask(readTask2);
this.readTasks.remove(readTask2);
this.readTasksMap.remove(j2);
}
public void markMentionsAsRead(long dialogId, long topicId) {
if (DialogObject.isEncryptedDialog(dialogId) || dialogId == getUserConfig().getClientUserId()) {
return;
}
TLRPC.Dialog dialog = this.dialogs_dict.get(dialogId);
if (dialog == null || dialog.unread_mentions_count > 0) {
getMessagesStorage().resetMentionsCount(dialogId, topicId, 0);
TLRPC.TL_messages_readMentions tL_messages_readMentions = new TLRPC.TL_messages_readMentions();
tL_messages_readMentions.peer = getInputPeer(dialogId);
if (topicId != 0) {
tL_messages_readMentions.top_msg_id = (int) topicId;
tL_messages_readMentions.flags |= 1;
}
getConnectionsManager().sendRequest(tL_messages_readMentions, MessagesController$.ExternalSyntheticLambda463.INSTANCE);
}
}
public void markDialogAsRead(long r16, int r18, int r19, int r20, boolean r21, long r22, int r24, boolean r25, int r26) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.markDialogAsRead(long, int, int, int, boolean, long, int, boolean, int):void");
}
public void lambda$markDialogAsRead$238(long j, int i, int i2, boolean z) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda111(this, j, i, i2, z));
}
public void lambda$markDialogAsRead$237(long j, int i, int i2, boolean z) {
TLRPC.Dialog dialog = this.dialogs_dict.get(j);
if (dialog != null) {
int i3 = dialog.unread_count;
if (i == 0 || i2 >= dialog.top_message) {
dialog.unread_count = 0;
} else {
int max = Math.max(i3 - i, 0);
dialog.unread_count = max;
if (i2 != Integer.MIN_VALUE) {
int i4 = dialog.top_message;
if (max > i4 - i2) {
dialog.unread_count = i4 - i2;
}
}
}
boolean z2 = dialog.unread_mark;
if (z2) {
dialog.unread_mark = false;
getMessagesStorage().setDialogUnread(dialog.id, false);
}
if ((i3 != 0 || z2) && dialog.unread_count == 0) {
if (!isDialogMuted(j, 0L)) {
this.unreadUnmutedDialogs--;
}
int i5 = 0;
while (true) {
DialogFilter[] dialogFilterArr = this.selectedDialogFilter;
if (i5 < dialogFilterArr.length) {
if (dialogFilterArr[i5] != null && (dialogFilterArr[i5].flags & DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0) {
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
break;
}
i5++;
} else {
break;
}
}
}
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_READ_DIALOG_MESSAGE), 1});
}
if (!z) {
getNotificationsController().processReadMessages((LongSparseIntArray) null, j, 0, i2, false);
LongSparseIntArray longSparseIntArray = new LongSparseIntArray(1);
longSparseIntArray.put(j, 0);
getNotificationsController().processDialogsUpdateRead(longSparseIntArray);
return;
}
getNotificationsController().processReadMessages((LongSparseIntArray) null, j, 0, i2, true);
LongSparseIntArray longSparseIntArray2 = new LongSparseIntArray(1);
longSparseIntArray2.put(j, -1);
getNotificationsController().processDialogsUpdateRead(longSparseIntArray2);
}
public void lambda$markDialogAsRead$240(long j, int i, boolean z, int i2, int i3) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda115(this, j, i, z, i2, i3));
}
public void lambda$markDialogAsRead$239(long j, int i, boolean z, int i2, int i3) {
getNotificationsController().processReadMessages((LongSparseIntArray) null, j, i, 0, z);
TLRPC.Dialog dialog = this.dialogs_dict.get(j);
if (dialog != null) {
int i4 = dialog.unread_count;
if (i2 == 0 || i3 <= dialog.top_message) {
dialog.unread_count = 0;
} else {
int max = Math.max(i4 - i2, 0);
dialog.unread_count = max;
if (i3 != Integer.MAX_VALUE) {
int i5 = dialog.top_message;
if (max > i3 - i5) {
dialog.unread_count = i3 - i5;
}
}
}
boolean z2 = dialog.unread_mark;
if (z2) {
dialog.unread_mark = false;
getMessagesStorage().setDialogUnread(dialog.id, false);
}
if ((i4 != 0 || z2) && dialog.unread_count == 0) {
if (!isDialogMuted(j, 0L)) {
this.unreadUnmutedDialogs--;
}
int i6 = 0;
while (true) {
DialogFilter[] dialogFilterArr = this.selectedDialogFilter;
if (i6 < dialogFilterArr.length) {
if (dialogFilterArr[i6] != null && (dialogFilterArr[i6].flags & DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0) {
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
break;
}
i6++;
} else {
break;
}
}
}
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_READ_DIALOG_MESSAGE), 1});
}
LongSparseIntArray longSparseIntArray = new LongSparseIntArray(1);
longSparseIntArray.put(j, 0);
getNotificationsController().processDialogsUpdateRead(longSparseIntArray);
}
public void lambda$markDialogAsRead$241(long j, long j2, boolean z, int i, int i2) {
ReadTask readTask;
if (j != 0) {
readTask = this.threadsReadTasksMap.get(j2 + "_" + j);
} else {
readTask = this.readTasksMap.get(j2);
}
if (readTask == null) {
readTask = new ReadTask((ReadTask-IA) null);
readTask.dialogId = j2;
readTask.replyId = j;
readTask.sendRequestTime = SystemClock.elapsedRealtime() + 5000;
if (!z) {
if (j != 0) {
this.threadsReadTasksMap.put(j2 + "_" + j, readTask);
this.repliesReadTasks.add(readTask);
} else {
this.readTasksMap.put(j2, readTask);
this.readTasks.add(readTask);
}
}
}
readTask.maxDate = i;
readTask.maxId = i2;
if (z) {
completeReadTask(readTask);
}
}
public int createChat(String str, ArrayList<Long> arrayList, String str2, int i, boolean z, Location location, String str3, int i2, BaseFragment baseFragment) {
if (i == 0 && !z) {
TLRPC.TL_messages_createChat tL_messages_createChat = new TLRPC.TL_messages_createChat();
tL_messages_createChat.title = str;
if (i2 >= 0) {
tL_messages_createChat.ttl_period = i2;
tL_messages_createChat.flags |= 1;
}
for (int i3 = 0; i3 < arrayList.size(); i3++) {
TLRPC$User user = getUser(arrayList.get(i3));
if (user != null) {
tL_messages_createChat.users.add(getInputUser(user));
}
}
return getConnectionsManager().sendRequest(tL_messages_createChat, new MessagesController$.ExternalSyntheticLambda438(this, baseFragment, tL_messages_createChat), 2);
}
if (!z && i != 2 && i != 4 && i != 5) {
return 0;
}
TLRPC.TL_channels_createChannel tL_channels_createChannel = new TLRPC.TL_channels_createChannel();
tL_channels_createChannel.title = str;
if (str2 == null) {
str2 = "";
}
tL_channels_createChannel.about = str2;
tL_channels_createChannel.for_import = z;
if (z || i == 4 || i == 5) {
tL_channels_createChannel.megagroup = true;
} else {
tL_channels_createChannel.broadcast = true;
}
tL_channels_createChannel.forum = i == 5;
if (location != null) {
TLRPC.TL_inputGeoPoint tL_inputGeoPoint = new TLRPC.TL_inputGeoPoint();
tL_channels_createChannel.geo_point = tL_inputGeoPoint;
((TLRPC.InputGeoPoint) tL_inputGeoPoint).lat = location.getLatitude();
tL_channels_createChannel.geo_point._long = location.getLongitude();
tL_channels_createChannel.address = str3;
tL_channels_createChannel.flags |= 4;
}
return getConnectionsManager().sendRequest(tL_channels_createChannel, new MessagesController$.ExternalSyntheticLambda436(this, baseFragment, tL_channels_createChannel), 2);
}
public void lambda$createChat$244(BaseFragment baseFragment, TLRPC.TL_messages_createChat tL_messages_createChat, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda232(this, tL_error, baseFragment, tL_messages_createChat));
} else if (tLObject instanceof TLRPC.TL_messages_invitedUsers) {
TLRPC.TL_messages_invitedUsers tL_messages_invitedUsers = (TLRPC.TL_messages_invitedUsers) tLObject;
processUpdates(tL_messages_invitedUsers.updates, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda239(this, tL_messages_invitedUsers));
}
}
public void lambda$createChat$242(TLRPC.TL_error tL_error, BaseFragment baseFragment, TLRPC.TL_messages_createChat tL_messages_createChat) {
AlertsCreator.processError(this.currentAccount, tL_error, baseFragment, tL_messages_createChat, new Object[0]);
getNotificationCenter().postNotificationName(NotificationCenter.chatDidFailCreate, new Object[0]);
}
public void lambda$createChat$243(TLRPC.TL_messages_invitedUsers tL_messages_invitedUsers) {
putUsers(tL_messages_invitedUsers.updates.users, false);
putChats(tL_messages_invitedUsers.updates.chats, false);
ArrayList arrayList = tL_messages_invitedUsers.updates.chats;
if (arrayList != null && !arrayList.isEmpty()) {
getNotificationCenter().postNotificationName(NotificationCenter.chatDidCreated, new Object[]{Long.valueOf(((TLRPC.Chat) tL_messages_invitedUsers.updates.chats.get(0)).id)});
AlertsCreator.checkRestrictedInviteUsers(this.currentAccount, (TLRPC.Chat) tL_messages_invitedUsers.updates.chats.get(0), tL_messages_invitedUsers);
} else {
getNotificationCenter().postNotificationName(NotificationCenter.chatDidFailCreate, new Object[0]);
}
}
public void lambda$createChat$247(BaseFragment baseFragment, TLRPC.TL_channels_createChannel tL_channels_createChannel, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda228(this, tL_error, baseFragment, tL_channels_createChannel));
return;
}
TLRPC.Updates updates = (TLRPC.Updates) tLObject;
processUpdates(updates, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda249(this, updates));
}
public void lambda$createChat$245(TLRPC.TL_error tL_error, BaseFragment baseFragment, TLRPC.TL_channels_createChannel tL_channels_createChannel) {
AlertsCreator.processError(this.currentAccount, tL_error, baseFragment, tL_channels_createChannel, new Object[0]);
getNotificationCenter().postNotificationName(NotificationCenter.chatDidFailCreate, new Object[0]);
}
public void lambda$createChat$246(TLRPC.Updates updates) {
putUsers(updates.users, false);
putChats(updates.chats, false);
ArrayList arrayList = updates.chats;
if (arrayList != null && !arrayList.isEmpty()) {
getNotificationCenter().postNotificationName(NotificationCenter.chatDidCreated, new Object[]{Long.valueOf(((TLRPC.Chat) updates.chats.get(0)).id)});
} else {
getNotificationCenter().postNotificationName(NotificationCenter.chatDidFailCreate, new Object[0]);
}
}
public void convertToMegaGroup(Context context, long chatId, BaseFragment fragment, MessagesStorage.LongCallback convertRunnable) {
convertToMegaGroup(context, chatId, fragment, convertRunnable, null);
}
public void convertToMegaGroup(Context context, long chatId, BaseFragment fragment, MessagesStorage.LongCallback convertRunnable, Runnable errorRunnable) {
TLRPC.TL_messages_migrateChat tL_messages_migrateChat = new TLRPC.TL_messages_migrateChat();
tL_messages_migrateChat.chat_id = chatId;
AlertDialog alertDialog = context != null ? new AlertDialog(context, 3) : null;
int sendRequest = getConnectionsManager().sendRequest(tL_messages_migrateChat, new MessagesController$.ExternalSyntheticLambda417(this, context, alertDialog, convertRunnable, chatId, errorRunnable, fragment, tL_messages_migrateChat));
if (alertDialog != null) {
alertDialog.setOnCancelListener(new MessagesController$.ExternalSyntheticLambda14(this, sendRequest));
try {
alertDialog.show();
} catch (Exception unused) {
}
}
}
public void lambda$convertToMegaGroup$251(Context context, AlertDialog alertDialog, MessagesStorage.LongCallback longCallback, long j, Runnable runnable, BaseFragment baseFragment, TLRPC.TL_messages_migrateChat tL_messages_migrateChat, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
if (context != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda20(context, alertDialog));
}
TLRPC.Updates updates = (TLRPC.Updates) tLObject;
processUpdates(updates, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda282(longCallback, updates, j));
return;
}
if (runnable != null) {
runnable.run();
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda181(this, longCallback, context, alertDialog, tL_error, baseFragment, tL_messages_migrateChat));
}
public static void lambda$convertToMegaGroup$248(Context context, AlertDialog alertDialog) {
if (((Activity) context).isFinishing()) {
return;
}
try {
alertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
}
public static void lambda$convertToMegaGroup$249(MessagesStorage.LongCallback longCallback, TLRPC.Updates updates, long j) {
TLRPC.Chat chat;
TLRPC.Chat chat2;
TLRPC.InputChannel inputChannel;
if (longCallback != null) {
int i = 0;
int i2 = 0;
while (true) {
chat = null;
if (i2 >= updates.chats.size()) {
chat2 = null;
break;
}
chat2 = (TLRPC.Chat) updates.chats.get(i2);
if (j == chat2.id) {
break;
} else {
i2++;
}
}
if (chat2 == null || (inputChannel = chat2.migrated_to) == null) {
return;
}
long j2 = inputChannel.channel_id;
while (true) {
if (i >= updates.chats.size()) {
break;
}
TLRPC.Chat chat3 = (TLRPC.Chat) updates.chats.get(i);
if (j2 == chat3.id) {
chat = chat3;
break;
}
i++;
}
if (chat != null) {
longCallback.run(j2);
}
}
}
public void lambda$convertToMegaGroup$250(MessagesStorage.LongCallback longCallback, Context context, AlertDialog alertDialog, TLRPC.TL_error tL_error, BaseFragment baseFragment, TLRPC.TL_messages_migrateChat tL_messages_migrateChat) {
if (longCallback != null) {
longCallback.run(0L);
}
if (context == null || ((Activity) context).isFinishing()) {
return;
}
try {
alertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
AlertsCreator.processError(this.currentAccount, tL_error, baseFragment, tL_messages_migrateChat, new Object[]{Boolean.FALSE});
}
public void lambda$convertToMegaGroup$252(int i, DialogInterface dialogInterface) {
getConnectionsManager().cancelRequest(i, true);
}
public void convertToGigaGroup(final Context context, TLRPC.Chat chat, BaseFragment fragment, MessagesStorage.BooleanCallback convertRunnable) {
TLRPC.TL_channels_convertToGigagroup tL_channels_convertToGigagroup = new TLRPC.TL_channels_convertToGigagroup();
tL_channels_convertToGigagroup.channel = getInputChannel(chat);
AlertDialog alertDialog = context != null ? new AlertDialog(context, 3) : null;
int sendRequest = getConnectionsManager().sendRequest(tL_channels_convertToGigagroup, new MessagesController$.ExternalSyntheticLambda416(this, context, alertDialog, convertRunnable, fragment, tL_channels_convertToGigagroup));
if (alertDialog != null) {
alertDialog.setOnCancelListener(new MessagesController$.ExternalSyntheticLambda13(this, sendRequest));
try {
alertDialog.showDelayed(400L);
} catch (Exception unused) {
}
}
}
public void lambda$convertToGigaGroup$256(Context context, AlertDialog alertDialog, MessagesStorage.BooleanCallback booleanCallback, BaseFragment baseFragment, TLRPC.TL_channels_convertToGigagroup tL_channels_convertToGigagroup, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
if (context != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda21(context, alertDialog));
}
processUpdates((TLRPC.Updates) tLObject, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda281(booleanCallback));
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda180(this, booleanCallback, context, alertDialog, tL_error, baseFragment, tL_channels_convertToGigagroup));
}
public static void lambda$convertToGigaGroup$253(Context context, AlertDialog alertDialog) {
if (((Activity) context).isFinishing()) {
return;
}
try {
alertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
}
public static void lambda$convertToGigaGroup$254(MessagesStorage.BooleanCallback booleanCallback) {
if (booleanCallback != null) {
booleanCallback.run(true);
}
}
public void lambda$convertToGigaGroup$255(MessagesStorage.BooleanCallback booleanCallback, Context context, AlertDialog alertDialog, TLRPC.TL_error tL_error, BaseFragment baseFragment, TLRPC.TL_channels_convertToGigagroup tL_channels_convertToGigagroup) {
if (booleanCallback != null) {
booleanCallback.run(false);
}
if (context == null || ((Activity) context).isFinishing()) {
return;
}
try {
alertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
AlertsCreator.processError(this.currentAccount, tL_error, baseFragment, tL_channels_convertToGigagroup, new Object[]{Boolean.FALSE});
}
public void lambda$convertToGigaGroup$257(int i, DialogInterface dialogInterface) {
getConnectionsManager().cancelRequest(i, true);
}
public void addUsersToChannel(long chatId, ArrayList<TLRPC.InputUser> users, BaseFragment fragment) {
if (users == null || users.isEmpty()) {
return;
}
TLRPC.TL_channels_inviteToChannel tL_channels_inviteToChannel = new TLRPC.TL_channels_inviteToChannel();
tL_channels_inviteToChannel.channel = getInputChannel(chatId);
tL_channels_inviteToChannel.users = users;
getConnectionsManager().sendRequest(tL_channels_inviteToChannel, new MessagesController$.ExternalSyntheticLambda437(this, fragment, tL_channels_inviteToChannel, chatId));
}
public void lambda$addUsersToChannel$258(TLRPC.TL_error tL_error, BaseFragment baseFragment, TLRPC.TL_channels_inviteToChannel tL_channels_inviteToChannel) {
AlertsCreator.processError(this.currentAccount, tL_error, baseFragment, tL_channels_inviteToChannel, new Object[]{Boolean.TRUE});
}
public void lambda$addUsersToChannel$260(BaseFragment baseFragment, TLRPC.TL_channels_inviteToChannel tL_channels_inviteToChannel, long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda231(this, tL_error, baseFragment, tL_channels_inviteToChannel));
} else if (tLObject instanceof TLRPC.TL_messages_invitedUsers) {
TLRPC.TL_messages_invitedUsers tL_messages_invitedUsers = (TLRPC.TL_messages_invitedUsers) tLObject;
processUpdates(tL_messages_invitedUsers.updates, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda240(this, tL_messages_invitedUsers, j));
}
}
public void lambda$addUsersToChannel$259(TLRPC.TL_messages_invitedUsers tL_messages_invitedUsers, long j) {
putUsers(tL_messages_invitedUsers.updates.users, false);
putChats(tL_messages_invitedUsers.updates.chats, false);
AlertsCreator.checkRestrictedInviteUsers(this.currentAccount, getChat(Long.valueOf(j)), tL_messages_invitedUsers);
}
public void setDefaultSendAs(long chatId, long newPeer) {
TLRPC.ChatFull chatFull = getChatFull(-chatId);
if (chatFull != null) {
chatFull.default_send_as = getPeer(newPeer);
getMessagesStorage().updateChatInfo(chatFull, false);
getNotificationCenter().postNotificationName(NotificationCenter.updateDefaultSendAsPeer, new Object[]{Long.valueOf(chatId), chatFull.default_send_as});
}
TLRPC.TL_messages_saveDefaultSendAs tL_messages_saveDefaultSendAs = new TLRPC.TL_messages_saveDefaultSendAs();
tL_messages_saveDefaultSendAs.peer = getInputPeer(chatId);
tL_messages_saveDefaultSendAs.send_as = getInputPeer(newPeer);
getConnectionsManager().sendRequest(tL_messages_saveDefaultSendAs, new MessagesController$.ExternalSyntheticLambda377(this, chatId), 64);
}
public void lambda$setDefaultSendAs$261(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject instanceof TLRPC.TL_boolTrue) {
long j2 = -j;
if (getChatFull(j2) == null) {
loadFullChat(j2, 0, true);
return;
}
return;
}
if (tL_error == null || tL_error.code != 400) {
return;
}
loadFullChat(-j, 0, true);
}
public void toggleChatNoForwards(long chatId, boolean enabled) {
TLRPC.TL_messages_toggleNoForwards tL_messages_toggleNoForwards = new TLRPC.TL_messages_toggleNoForwards();
tL_messages_toggleNoForwards.peer = getInputPeer(-chatId);
tL_messages_toggleNoForwards.enabled = enabled;
getConnectionsManager().sendRequest(tL_messages_toggleNoForwards, new MessagesController$.ExternalSyntheticLambda325(this), 64);
}
public void lambda$toggleChatNoForwards$263(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
processUpdates((TLRPC.Updates) tLObject, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda68(this));
}
}
public void lambda$toggleChatNoForwards$262() {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_CHAT)});
}
public void toggleChatJoinToSend(long chatId, boolean enabled, Runnable onSuccess, Runnable onError) {
TLRPC.TL_channels_toggleJoinToSend tL_channels_toggleJoinToSend = new TLRPC.TL_channels_toggleJoinToSend();
tL_channels_toggleJoinToSend.channel = getInputChannel(chatId);
tL_channels_toggleJoinToSend.enabled = enabled;
getConnectionsManager().sendRequest(tL_channels_toggleJoinToSend, new MessagesController$.ExternalSyntheticLambda422(this, onSuccess, onError), 64);
}
public void lambda$toggleChatJoinToSend$265(Runnable runnable, Runnable runnable2, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
processUpdates((TLRPC.Updates) tLObject, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda60(this));
if (runnable != null) {
runnable.run();
return;
}
return;
}
if (tL_error == null || "CHAT_NOT_MODIFIED".equals(tL_error.text)) {
if (runnable != null) {
runnable.run();
}
} else if (runnable2 != null) {
runnable2.run();
}
}
public void lambda$toggleChatJoinToSend$264() {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_CHAT)});
}
public void toggleChatJoinRequest(long chatId, boolean enabled, Runnable onSuccess, Runnable onError) {
TLRPC.TL_channels_toggleJoinRequest tL_channels_toggleJoinRequest = new TLRPC.TL_channels_toggleJoinRequest();
tL_channels_toggleJoinRequest.channel = getInputChannel(chatId);
tL_channels_toggleJoinRequest.enabled = enabled;
getConnectionsManager().sendRequest(tL_channels_toggleJoinRequest, new MessagesController$.ExternalSyntheticLambda421(this, onSuccess, onError), 64);
}
public void lambda$toggleChatJoinRequest$267(Runnable runnable, Runnable runnable2, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
processUpdates((TLRPC.Updates) tLObject, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda37(this));
if (runnable != null) {
runnable.run();
return;
}
return;
}
if (tL_error == null || "CHAT_NOT_MODIFIED".equals(tL_error.text)) {
if (runnable != null) {
runnable.run();
}
} else if (runnable2 != null) {
runnable2.run();
}
}
public void lambda$toggleChatJoinRequest$266() {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_CHAT)});
}
public void toggleChannelSignatures(long chatId, boolean enabled) {
TLRPC.TL_channels_toggleSignatures tL_channels_toggleSignatures = new TLRPC.TL_channels_toggleSignatures();
tL_channels_toggleSignatures.channel = getInputChannel(chatId);
tL_channels_toggleSignatures.enabled = enabled;
getConnectionsManager().sendRequest(tL_channels_toggleSignatures, new MessagesController$.ExternalSyntheticLambda336(this), 64);
}
public void lambda$toggleChannelSignatures$269(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
processUpdates((TLRPC.Updates) tLObject, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda50(this));
}
}
public void lambda$toggleChannelSignatures$268() {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_CHAT)});
}
public void toggleChannelForum(long chatId, boolean enabled) {
TLRPC.TL_channels_toggleForum tL_channels_toggleForum = new TLRPC.TL_channels_toggleForum();
tL_channels_toggleForum.channel = getInputChannel(chatId);
tL_channels_toggleForum.enabled = enabled;
getConnectionsManager().sendRequest(tL_channels_toggleForum, new MessagesController$.ExternalSyntheticLambda326(this), 64);
}
public void lambda$toggleChannelForum$271(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
processUpdates((TLRPC.Updates) tLObject, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda64(this));
}
}
public void lambda$toggleChannelForum$270() {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_CHAT)});
}
public void toggleChannelInvitesHistory(long chatId, boolean enabled) {
TLRPC.TL_channels_togglePreHistoryHidden tL_channels_togglePreHistoryHidden = new TLRPC.TL_channels_togglePreHistoryHidden();
tL_channels_togglePreHistoryHidden.channel = getInputChannel(chatId);
tL_channels_togglePreHistoryHidden.enabled = enabled;
getConnectionsManager().sendRequest(tL_channels_togglePreHistoryHidden, new MessagesController$.ExternalSyntheticLambda348(this), 64);
}
public void lambda$toggleChannelInvitesHistory$273(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
processUpdates((TLRPC.Updates) tLObject, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda62(this));
}
}
public void lambda$toggleChannelInvitesHistory$272() {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_CHAT)});
}
public void updateChatAbout(long chatId, String about, TLRPC.ChatFull info) {
TLRPC.TL_messages_editChatAbout tL_messages_editChatAbout = new TLRPC.TL_messages_editChatAbout();
tL_messages_editChatAbout.peer = getInputPeer(-chatId);
tL_messages_editChatAbout.about = about;
getConnectionsManager().sendRequest(tL_messages_editChatAbout, new MessagesController$.ExternalSyntheticLambda430(this, info, about), 64);
}
public void lambda$updateChatAbout$275(TLRPC.ChatFull chatFull, String str, TLObject tLObject, TLRPC.TL_error tL_error) {
if (!(tLObject instanceof TLRPC.TL_boolTrue) || chatFull == null) {
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda214(this, chatFull, str));
}
public void lambda$updateChatAbout$274(TLRPC.ChatFull chatFull, String str) {
chatFull.about = str;
getMessagesStorage().updateChatInfo(chatFull, false);
NotificationCenter notificationCenter = getNotificationCenter();
int i = NotificationCenter.chatInfoDidLoad;
Boolean bool = Boolean.FALSE;
notificationCenter.postNotificationName(i, new Object[]{chatFull, 0, bool, bool});
}
public void updateChannelUserName(BaseFragment fragment, long chatId, String userName, Runnable runnable, Runnable onError) {
TLRPC.TL_channels_updateUsername tL_channels_updateUsername = new TLRPC.TL_channels_updateUsername();
tL_channels_updateUsername.channel = getInputChannel(chatId);
tL_channels_updateUsername.username = userName;
getConnectionsManager().sendRequest(tL_channels_updateUsername, new MessagesController$.ExternalSyntheticLambda404(this, chatId, userName, runnable, fragment, tL_channels_updateUsername, onError), 64);
}
public void lambda$updateChannelUserName$277(long j, String str, Runnable runnable, BaseFragment baseFragment, TLRPC.TL_channels_updateUsername tL_channels_updateUsername, Runnable runnable2, TLObject tLObject, TLRPC.TL_error tL_error) {
if ((tLObject instanceof TLRPC.TL_boolTrue) || (tL_error != null && "USERNAME_NOT_MODIFIED".equals(tL_error.text))) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda128(this, j, str, runnable));
return;
}
AlertsCreator.processError(UserConfig.selectedAccount, tL_error, baseFragment, tL_channels_updateUsername, new Object[0]);
if (runnable2 != null) {
runnable2.run();
}
}
public void lambda$updateChannelUserName$276(long j, String str, Runnable runnable) {
boolean z;
TLRPC.Chat chat = getChat(Long.valueOf(j));
if (chat.usernames != null) {
for (int i = 0; i < chat.usernames.size(); i++) {
TLRPC.TL_username tL_username = (TLRPC.TL_username) chat.usernames.get(i);
if (tL_username != null && tL_username.editable) {
tL_username.username = str;
z = true;
break;
}
}
}
z = false;
if (!z) {
ArrayList arrayList = chat.usernames;
if (arrayList == null || arrayList.size() >= 1) {
if (chat.usernames == null) {
chat.usernames = new ArrayList();
}
TLRPC.TL_username tL_username2 = new TLRPC.TL_username();
tL_username2.username = str;
tL_username2.active = true;
tL_username2.editable = true;
chat.usernames.add(0, tL_username2);
} else {
chat.username = str;
}
}
ArrayList arrayList2 = new ArrayList();
arrayList2.add(chat);
getMessagesStorage().putUsersAndChats((List) null, arrayList2, true, true);
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_CHAT)});
if (runnable != null) {
runnable.run();
}
}
public void sendBotStart(final TLRPC$User user, String botHash) {
if (user == null) {
return;
}
TLRPC.TL_messages_startBot tL_messages_startBot = new TLRPC.TL_messages_startBot();
tL_messages_startBot.bot = getInputUser(user);
tL_messages_startBot.peer = getInputPeer(user.id);
tL_messages_startBot.start_param = botHash;
tL_messages_startBot.random_id = Utilities.random.nextLong();
getConnectionsManager().sendRequest(tL_messages_startBot, new MessagesController$.ExternalSyntheticLambda349(this));
}
public void lambda$sendBotStart$278(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error != null) {
return;
}
processUpdates((TLRPC.Updates) tLObject, false);
}
public boolean isJoiningChannel(long chatId) {
return this.joiningToChannels.contains(Long.valueOf(chatId));
}
public void addUserToChat(long chatId, TLRPC$User user, int forwardCount, String botHash, BaseFragment fragment, Runnable onFinishRunnable) {
addUserToChat(chatId, user, forwardCount, botHash, fragment, false, onFinishRunnable, null);
}
public void loadUsersPremiumLocked(final ArrayList<TLRPC$User> users, Utilities.Callback<ArrayList<Long>> whenDone) {
if (whenDone == null) {
return;
}
if (getUserConfig().isPremium()) {
whenDone.run((Object) null);
return;
}
TLObject tL_users_getIsPremiumRequiredToContact = new TLRPC.TL_users_getIsPremiumRequiredToContact();
MessagesController messagesController = getInstance(this.currentAccount);
Iterator<TLRPC$User> it = users.iterator();
while (it.hasNext()) {
((TLRPC.TL_users_getIsPremiumRequiredToContact) tL_users_getIsPremiumRequiredToContact).id.add(messagesController.getInputUser(it.next()));
}
ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_users_getIsPremiumRequiredToContact, new MessagesController$.ExternalSyntheticLambda321(users, whenDone));
}
public static void lambda$loadUsersPremiumLocked$280(ArrayList arrayList, Utilities.Callback callback, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda288(tLObject, arrayList, callback));
}
public static void lambda$loadUsersPremiumLocked$279(TLObject tLObject, ArrayList arrayList, Utilities.Callback callback) {
ArrayList arrayList2 = new ArrayList();
if (tLObject instanceof TLRPC.Vector) {
TLRPC.Vector vector = (TLRPC.Vector) tLObject;
for (int i = 0; i < vector.objects.size(); i++) {
if (i < arrayList.size() && (vector.objects.get(i) instanceof TLRPC.TL_boolTrue)) {
arrayList2.add(Long.valueOf(((TLRPC$User) arrayList.get(i)).id));
}
}
}
callback.run(arrayList2);
}
public void addUsersToChat(TLRPC.Chat currentChat, BaseFragment baseFragment, ArrayList<TLRPC$User> users, int fwdCount, Consumer<TLRPC$User> onAddUser, Consumer<TLRPC$User> onRestricted, Runnable onComplete) {
int size = users.size();
int[] iArr = {0};
TLRPC.TL_messages_invitedUsers tL_messages_invitedUsers = new TLRPC.TL_messages_invitedUsers();
tL_messages_invitedUsers.updates = new TLRPC.TL_updates();
long j = currentChat.id;
for (int i = 0; i < size; i++) {
TLRPC$User tLRPC$User = users.get(i);
addUserToChat(j, tLRPC$User, fwdCount, null, baseFragment, false, new MessagesController$.ExternalSyntheticLambda26(onAddUser, tLRPC$User), new MessagesController$.ExternalSyntheticLambda311(onRestricted, tLRPC$User), new MessagesController$.ExternalSyntheticLambda318(this, tL_messages_invitedUsers, iArr, size, currentChat, onComplete));
putUser(tLRPC$User, false);
}
}
public static void lambda$addUsersToChat$281(Consumer consumer, TLRPC$User tLRPC$User) {
if (consumer != null) {
consumer.accept(tLRPC$User);
}
}
public static boolean lambda$addUsersToChat$282(Consumer consumer, TLRPC$User tLRPC$User, TLRPC.TL_error tL_error) {
if (consumer != null) {
consumer.accept(tLRPC$User);
}
return tL_error == null || !"USER_PRIVACY_RESTRICTED".equals(tL_error.text);
}
public void lambda$addUsersToChat$284(TLRPC.TL_messages_invitedUsers tL_messages_invitedUsers, int[] iArr, int i, TLRPC.Chat chat, Runnable runnable, TLRPC.TL_messages_invitedUsers tL_messages_invitedUsers2) {
if (tL_messages_invitedUsers2 != null) {
tL_messages_invitedUsers.missing_invitees.addAll(tL_messages_invitedUsers2.missing_invitees);
}
iArr[0] = iArr[0] + 1;
if (iArr[0] >= i) {
if (!tL_messages_invitedUsers.missing_invitees.isEmpty()) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda212(this, chat, tL_messages_invitedUsers));
}
if (runnable != null) {
runnable.run();
}
}
}
public void lambda$addUsersToChat$283(TLRPC.Chat chat, TLRPC.TL_messages_invitedUsers tL_messages_invitedUsers) {
AlertsCreator.checkRestrictedInviteUsers(this.currentAccount, chat, tL_messages_invitedUsers);
}
public void addUserToChat(long chatId, TLRPC$User user, int forwardCount, String botHash, BaseFragment fragment, boolean ignoreIfAlreadyExists, Runnable onFinishRunnable, ErrorDelegate onError) {
addUserToChat(chatId, user, forwardCount, botHash, fragment, ignoreIfAlreadyExists, onFinishRunnable, onError, null);
}
public void addUserToChat(long chatId, TLRPC$User user, int forwardCount, String botHash, BaseFragment fragment, boolean ignoreIfAlreadyExists, Runnable onFinishRunnable, ErrorDelegate onError, Utilities.Callback<TLRPC.TL_messages_invitedUsers> processInvitedUsers) {
TLRPC.TL_messages_startBot tL_messages_addChatUser;
if (user == null) {
if (onError != null) {
onError.run((TLRPC.TL_error) null);
}
if (processInvitedUsers != null) {
processInvitedUsers.run((Object) null);
return;
}
return;
}
boolean isChannel = ChatObject.isChannel(chatId, this.currentAccount);
boolean z = isChannel && getChat(Long.valueOf(chatId)).megagroup;
TLRPC.InputUser inputUser = getInputUser(user);
if (botHash != null && (!isChannel || z)) {
tL_messages_addChatUser = new TLRPC.TL_messages_startBot();
tL_messages_addChatUser.bot = inputUser;
if (isChannel) {
tL_messages_addChatUser.peer = getInputPeer(-chatId);
} else {
TLRPC.TL_inputPeerChat tL_inputPeerChat = new TLRPC.TL_inputPeerChat();
tL_messages_addChatUser.peer = tL_inputPeerChat;
((TLRPC.InputPeer) tL_inputPeerChat).chat_id = chatId;
}
tL_messages_addChatUser.start_param = botHash;
tL_messages_addChatUser.random_id = Utilities.random.nextLong();
} else if (isChannel) {
if (inputUser instanceof TLRPC.TL_inputUserSelf) {
if (this.joiningToChannels.contains(Long.valueOf(chatId))) {
if (onError != null) {
onError.run((TLRPC.TL_error) null);
return;
}
return;
} else {
tL_messages_addChatUser = new TLRPC.TL_channels_joinChannel();
((TLRPC.TL_channels_joinChannel) tL_messages_addChatUser).channel = getInputChannel(chatId);
this.joiningToChannels.add(Long.valueOf(chatId));
}
} else {
tL_messages_addChatUser = new TLRPC.TL_channels_inviteToChannel();
((TLRPC.TL_channels_inviteToChannel) tL_messages_addChatUser).channel = getInputChannel(chatId);
((TLRPC.TL_channels_inviteToChannel) tL_messages_addChatUser).users.add(inputUser);
}
} else {
tL_messages_addChatUser = new TLRPC.TL_messages_addChatUser();
((TLRPC.TL_messages_addChatUser) tL_messages_addChatUser).chat_id = chatId;
((TLRPC.TL_messages_addChatUser) tL_messages_addChatUser).fwd_limit = forwardCount;
((TLRPC.TL_messages_addChatUser) tL_messages_addChatUser).user_id = inputUser;
}
TLRPC.TL_messages_startBot tL_messages_startBot = tL_messages_addChatUser;
getConnectionsManager().sendRequest(tL_messages_startBot, new MessagesController$.ExternalSyntheticLambda444(this, isChannel, inputUser, chatId, user, processInvitedUsers, ignoreIfAlreadyExists, onFinishRunnable, onError, fragment, tL_messages_startBot, z));
}
public void lambda$addUserToChat$294(boolean z, TLRPC.InputUser inputUser, long j, TLRPC$User tLRPC$User, Utilities.Callback callback, boolean z2, Runnable runnable, ErrorDelegate errorDelegate, BaseFragment baseFragment, TLObject tLObject, boolean z3, TLObject tLObject2, TLRPC.TL_error tL_error) {
TLRPC.Updates updates;
TLRPC.TL_messages_invitedUsers tL_messages_invitedUsers;
boolean z4;
if (z && (inputUser instanceof TLRPC.TL_inputUserSelf)) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda89(this, j));
}
if (tL_error != null) {
if ("PRIVACY_PREMIUM_REQUIRED".equals(tL_error.text)) {
TLRPC.TL_messages_invitedUsers tL_messages_invitedUsers2 = new TLRPC.TL_messages_invitedUsers();
tL_messages_invitedUsers2.updates = new TLRPC.TL_updates();
TLRPC.TL_missingInvitee tL_missingInvitee = new TLRPC.TL_missingInvitee();
tL_missingInvitee.user_id = tLRPC$User.id;
tL_missingInvitee.premium_would_allow_invite = true;
tL_missingInvitee.premium_required_for_pm = true;
tL_messages_invitedUsers2.missing_invitees.add(tL_missingInvitee);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda184(this, callback, tL_messages_invitedUsers2, j));
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda283(callback));
if ("USER_ALREADY_PARTICIPANT".equals(tL_error.text) && z2) {
if (runnable != null) {
AndroidUtilities.runOnUIThread(runnable);
return;
}
return;
} else {
if (errorDelegate != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda178(this, errorDelegate, tL_error, baseFragment, tLObject, z, z3));
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda179(this, errorDelegate, tL_error, baseFragment, tLObject, z, z3, inputUser));
return;
}
}
if (tLObject2 instanceof TLRPC.TL_messages_invitedUsers) {
tL_messages_invitedUsers = (TLRPC.TL_messages_invitedUsers) tLObject2;
updates = tL_messages_invitedUsers.updates;
} else if (tLObject2 instanceof TLRPC.Updates) {
updates = (TLRPC.Updates) tLObject2;
tL_messages_invitedUsers = null;
} else {
FileLog.e("unexpected " + tLObject2 + " in addUserToChat");
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda285(callback));
return;
}
int i = 0;
while (true) {
if (i >= updates.updates.size()) {
z4 = false;
break;
}
TLRPC.TL_updateNewChannelMessage tL_updateNewChannelMessage = (TLRPC$Update) updates.updates.get(i);
if ((tL_updateNewChannelMessage instanceof TLRPC.TL_updateNewChannelMessage) && (tL_updateNewChannelMessage.message.action instanceof TLRPC.TL_messageActionChatAddUser)) {
z4 = true;
break;
}
i++;
}
processUpdates(updates, false);
if (tL_messages_invitedUsers != null && !tL_messages_invitedUsers.missing_invitees.isEmpty()) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda250(this, updates, callback, tL_messages_invitedUsers, j));
return;
}
if (z) {
if (!z4 && (inputUser instanceof TLRPC.TL_inputUserSelf)) {
generateJoinMessage(j, true);
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda96(this, j), 1000L);
}
if (z && (inputUser instanceof TLRPC.TL_inputUserSelf)) {
long j2 = -j;
getMessagesStorage().updateDialogsWithDeletedMessages(j2, j, new ArrayList(), (ArrayList) null, true);
if (this.plusPromoChannelDeleted == j2) {
this.plusPromoChannelDeleted = 0L;
this.mainPreferences.edit().remove("plusPromoChannelDeleted").apply();
}
if (this.plusPromoChannelArchived == j2) {
this.plusPromoChannelArchived = 0L;
this.mainPreferences.edit().remove("plusPromoChannelArchived").apply();
}
}
if (runnable != null) {
AndroidUtilities.runOnUIThread(runnable);
}
if (callback != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda284(callback));
}
}
public void lambda$addUserToChat$285(long j) {
this.joiningToChannels.remove(Long.valueOf(j));
}
public void lambda$addUserToChat$286(Utilities.Callback callback, TLRPC.TL_messages_invitedUsers tL_messages_invitedUsers, long j) {
if (callback != null) {
callback.run(tL_messages_invitedUsers);
} else {
AlertsCreator.checkRestrictedInviteUsers(this.currentAccount, getChat(Long.valueOf(j)), tL_messages_invitedUsers);
}
}
public static void lambda$addUserToChat$287(Utilities.Callback callback) {
if (callback != null) {
callback.run((Object) null);
}
}
public void lambda$addUserToChat$288(ErrorDelegate errorDelegate, TLRPC.TL_error tL_error, BaseFragment baseFragment, TLObject tLObject, boolean z, boolean z2) {
if (errorDelegate.run(tL_error)) {
int i = this.currentAccount;
Object[] objArr = new Object[1];
objArr[0] = Boolean.valueOf(z && !z2);
AlertsCreator.processError(i, tL_error, baseFragment, tLObject, objArr);
}
}
public void lambda$addUserToChat$289(ErrorDelegate errorDelegate, TLRPC.TL_error tL_error, BaseFragment baseFragment, TLObject tLObject, boolean z, boolean z2, TLRPC.InputUser inputUser) {
if (errorDelegate == null) {
int i = this.currentAccount;
Object[] objArr = new Object[1];
objArr[0] = Boolean.valueOf(z && !z2);
AlertsCreator.processError(i, tL_error, baseFragment, tLObject, objArr);
}
if (z && (inputUser instanceof TLRPC.TL_inputUserSelf)) {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_CHAT)});
}
}
public static void lambda$addUserToChat$290(Utilities.Callback callback) {
if (callback != null) {
callback.run((Object) null);
}
}
public void lambda$addUserToChat$291(TLRPC.Updates updates, Utilities.Callback callback, TLRPC.TL_messages_invitedUsers tL_messages_invitedUsers, long j) {
putUsers(updates.users, false);
putChats(updates.chats, false);
if (callback != null) {
callback.run(tL_messages_invitedUsers);
} else {
AlertsCreator.checkRestrictedInviteUsers(this.currentAccount, getChat(Long.valueOf(j)), tL_messages_invitedUsers);
}
}
public void lambda$addUserToChat$292(long j) {
loadFullChat(j, 0, true);
}
public void deleteParticipantFromChat(long chatId, TLRPC$User user) {
deleteParticipantFromChat(chatId, user, (TLRPC.Chat) null, false, false);
}
public void deleteParticipantFromChat(long chatId, TLRPC.InputPeer peer) {
deleteParticipantFromChat(chatId, peer, false, false);
}
public void deleteParticipantFromChat(long chatId, TLRPC.InputPeer peer, boolean forceDelete, boolean revoke) {
deleteParticipantFromChat(chatId, peer, forceDelete, revoke, (Runnable) null);
}
public void deleteParticipantFromChat(long chatId, TLRPC.InputPeer peer, boolean forceDelete, boolean revoke, Runnable whenDone) {
TLRPC.TL_channels_deleteChannel tL_channels_deleteChannel;
TLRPC.TL_channels_deleteChannel tL_channels_leaveChannel;
if (peer == null) {
return;
}
TLRPC.Chat chat = getChat(Long.valueOf(chatId));
boolean z = (peer instanceof TLRPC.TL_inputPeerUser) && UserObject.isUserSelf(getMessagesController().getUser(Long.valueOf(peer.user_id)));
boolean isChannel = ChatObject.isChannel(chat);
if (isChannel) {
if (z) {
if (chat.creator && forceDelete) {
tL_channels_leaveChannel = new TLRPC.TL_channels_deleteChannel();
tL_channels_leaveChannel.channel = getInputChannel(chat);
} else {
tL_channels_leaveChannel = new TLRPC.TL_channels_leaveChannel();
((TLRPC.TL_channels_leaveChannel) tL_channels_leaveChannel).channel = getInputChannel(chat);
}
tL_channels_deleteChannel = tL_channels_leaveChannel;
} else {
tL_channels_deleteChannel = new TLRPC.TL_channels_editBanned();
((TLRPC.TL_channels_editBanned) tL_channels_deleteChannel).channel = getInputChannel(chat);
((TLRPC.TL_channels_editBanned) tL_channels_deleteChannel).participant = peer;
TLRPC.TL_chatBannedRights tL_chatBannedRights = new TLRPC.TL_chatBannedRights();
((TLRPC.TL_channels_editBanned) tL_channels_deleteChannel).banned_rights = tL_chatBannedRights;
tL_chatBannedRights.view_messages = true;
tL_chatBannedRights.send_media = true;
tL_chatBannedRights.send_messages = true;
tL_chatBannedRights.send_stickers = true;
tL_chatBannedRights.send_gifs = true;
tL_chatBannedRights.send_games = true;
tL_chatBannedRights.send_inline = true;
tL_chatBannedRights.embed_links = true;
tL_chatBannedRights.pin_messages = true;
tL_chatBannedRights.send_polls = true;
tL_chatBannedRights.invite_users = true;
tL_chatBannedRights.change_info = true;
}
} else if (forceDelete) {
TLRPC.TL_messages_deleteChat tL_messages_deleteChat = new TLRPC.TL_messages_deleteChat();
tL_messages_deleteChat.chat_id = chatId;
getConnectionsManager().sendRequest(tL_messages_deleteChat, MessagesController$.ExternalSyntheticLambda449.INSTANCE);
return;
} else {
TLRPC.TL_channels_deleteChannel tL_messages_deleteChatUser = new TLRPC.TL_messages_deleteChatUser();
((TLRPC.TL_messages_deleteChatUser) tL_messages_deleteChatUser).chat_id = chatId;
((TLRPC.TL_messages_deleteChatUser) tL_messages_deleteChatUser).user_id = getInputUser(peer);
((TLRPC.TL_messages_deleteChatUser) tL_messages_deleteChatUser).revoke_history = true;
tL_channels_deleteChannel = tL_messages_deleteChatUser;
}
if (z) {
deleteDialog(-chatId, 0, revoke);
}
getConnectionsManager().sendRequest(tL_channels_deleteChannel, new MessagesController$.ExternalSyntheticLambda447(this, isChannel, z, chatId, whenDone), 64);
}
public void lambda$deleteParticipantFromChat$297(boolean z, boolean z2, long j, Runnable runnable, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error != null) {
return;
}
processUpdates((TLRPC.Updates) tLObject, false);
if (z && !z2) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda104(this, j), 1000L);
}
if (runnable != null) {
AndroidUtilities.runOnUIThread(runnable);
}
}
public void lambda$deleteParticipantFromChat$296(long j) {
loadFullChat(j, 0, true);
}
public void deleteParticipantFromChat(long chatId, TLRPC$User user, TLRPC.Chat chat, boolean forceDelete, boolean revoke) {
TLRPC.InputPeer inputPeer;
TLRPC.TL_channels_deleteChannel tL_messages_deleteChatUser;
if (user == null && chat == null) {
return;
}
if (user != null) {
inputPeer = getInputPeer(user);
} else {
inputPeer = getInputPeer(chat);
}
TLRPC.Chat chat2 = getChat(Long.valueOf(chatId));
boolean isChannel = ChatObject.isChannel(chat2);
if (isChannel) {
if (UserObject.isUserSelf(user)) {
if (chat2.creator && forceDelete) {
tL_messages_deleteChatUser = new TLRPC.TL_channels_deleteChannel();
tL_messages_deleteChatUser.channel = getInputChannel(chat2);
} else {
tL_messages_deleteChatUser = new TLRPC.TL_channels_leaveChannel();
((TLRPC.TL_channels_leaveChannel) tL_messages_deleteChatUser).channel = getInputChannel(chat2);
}
} else {
TLRPC.TL_channels_deleteChannel tL_channels_editBanned = new TLRPC.TL_channels_editBanned();
((TLRPC.TL_channels_editBanned) tL_channels_editBanned).channel = getInputChannel(chat2);
((TLRPC.TL_channels_editBanned) tL_channels_editBanned).participant = inputPeer;
TLRPC.TL_chatBannedRights tL_chatBannedRights = new TLRPC.TL_chatBannedRights();
((TLRPC.TL_channels_editBanned) tL_channels_editBanned).banned_rights = tL_chatBannedRights;
tL_chatBannedRights.view_messages = true;
tL_chatBannedRights.send_media = true;
tL_chatBannedRights.send_messages = true;
tL_chatBannedRights.send_stickers = true;
tL_chatBannedRights.send_gifs = true;
tL_chatBannedRights.send_games = true;
tL_chatBannedRights.send_inline = true;
tL_chatBannedRights.embed_links = true;
tL_chatBannedRights.pin_messages = true;
tL_chatBannedRights.send_polls = true;
tL_chatBannedRights.invite_users = true;
tL_chatBannedRights.change_info = true;
tL_messages_deleteChatUser = tL_channels_editBanned;
}
} else if (forceDelete) {
TLRPC.TL_messages_deleteChat tL_messages_deleteChat = new TLRPC.TL_messages_deleteChat();
tL_messages_deleteChat.chat_id = chatId;
getConnectionsManager().sendRequest(tL_messages_deleteChat, MessagesController$.ExternalSyntheticLambda459.INSTANCE);
return;
} else {
tL_messages_deleteChatUser = new TLRPC.TL_messages_deleteChatUser();
((TLRPC.TL_messages_deleteChatUser) tL_messages_deleteChatUser).chat_id = chatId;
((TLRPC.TL_messages_deleteChatUser) tL_messages_deleteChatUser).user_id = getInputUser(user);
((TLRPC.TL_messages_deleteChatUser) tL_messages_deleteChatUser).revoke_history = true;
}
if (UserObject.isUserSelf(user)) {
deleteDialog(-chatId, 0, revoke);
}
getConnectionsManager().sendRequest(tL_messages_deleteChatUser, new MessagesController$.ExternalSyntheticLambda446(this, isChannel, user, chatId), 64);
}
public void lambda$deleteParticipantFromChat$300(boolean z, TLRPC$User tLRPC$User, long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error != null) {
return;
}
processUpdates((TLRPC.Updates) tLObject, false);
if (!z || UserObject.isUserSelf(tLRPC$User)) {
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda92(this, j), 1000L);
}
public void lambda$deleteParticipantFromChat$299(long j) {
loadFullChat(j, 0, true);
}
public void deleteUserWithoutDeleteChat(final long chat_id, final TLRPC$User user, final TLRPC.ChatFull info) {
boolean z;
if (user == null) {
return;
}
TLRPC.TL_channels_leaveChannel tL_channels_leaveChannel = null;
if (chat_id > 0) {
TLRPC.InputUser inputUser = getInputUser(user);
TLRPC.Chat chat = getChat(Long.valueOf(chat_id));
if (ChatObject.isChannel(chat)) {
if (inputUser instanceof TLRPC.TL_inputUserSelf) {
tL_channels_leaveChannel = new TLRPC.TL_channels_leaveChannel();
tL_channels_leaveChannel.channel = getInputChannel(chat);
}
} else {
tL_channels_leaveChannel = new TLRPC.TL_messages_deleteChatUser();
((TLRPC.TL_messages_deleteChatUser) tL_channels_leaveChannel).chat_id = chat_id;
((TLRPC.TL_messages_deleteChatUser) tL_channels_leaveChannel).user_id = getInputUser(user);
}
getConnectionsManager().sendRequest(tL_channels_leaveChannel, new MessagesController$.ExternalSyntheticLambda344(this), 64);
return;
}
if (info instanceof TLRPC.TL_chatFull) {
TLRPC.Chat chat2 = getChat(Long.valueOf(chat_id));
chat2.participants_count--;
ArrayList arrayList = new ArrayList();
arrayList.add(chat2);
getMessagesStorage().putUsersAndChats((List) null, arrayList, true, true);
int i = 0;
while (true) {
if (i >= info.participants.participants.size()) {
z = false;
break;
} else {
if (((TLRPC.ChatParticipant) info.participants.participants.get(i)).user_id == user.id) {
info.participants.participants.remove(i);
z = true;
break;
}
i++;
}
}
if (z) {
getMessagesStorage().updateChatInfo(info, true);
getNotificationCenter().postNotificationName(NotificationCenter.chatInfoDidLoad, new Object[]{info, 0, Boolean.FALSE, null});
}
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_CHAT_MEMBERS)});
}
}
public void lambda$deleteUserWithoutDeleteChat$301(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error != null) {
return;
}
processUpdates((TLRPC.Updates) tLObject, false);
}
public void changeChatTitle(long chatId, String title) {
TLRPC.TL_channels_editTitle tL_messages_editChatTitle;
if (ChatObject.isChannel(chatId, this.currentAccount)) {
tL_messages_editChatTitle = new TLRPC.TL_channels_editTitle();
tL_messages_editChatTitle.channel = getInputChannel(chatId);
tL_messages_editChatTitle.title = title;
} else {
tL_messages_editChatTitle = new TLRPC.TL_messages_editChatTitle();
((TLRPC.TL_messages_editChatTitle) tL_messages_editChatTitle).chat_id = chatId;
((TLRPC.TL_messages_editChatTitle) tL_messages_editChatTitle).title = title;
}
getConnectionsManager().sendRequest(tL_messages_editChatTitle, new MessagesController$.ExternalSyntheticLambda347(this), 64);
}
public void lambda$changeChatTitle$302(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error != null) {
return;
}
processUpdates((TLRPC.Updates) tLObject, false);
}
public void changeChatAvatar(long chatId, TLRPC.TL_inputChatPhoto oldPhoto, TLRPC.InputFile inputPhoto, TLRPC.InputFile inputVideo, TLRPC.VideoSize emojiMarkup, double videoStartTimestamp, String videoPath, TLRPC.FileLocation smallSize, TLRPC.FileLocation bigSize, Runnable callback) {
MessagesController messagesController;
TLRPC.TL_inputChatPhoto tL_inputChatPhoto;
TLRPC.TL_channels_editPhoto tL_messages_editChatPhoto;
if (oldPhoto != null) {
messagesController = this;
tL_inputChatPhoto = oldPhoto;
} else if (inputPhoto != null || inputVideo != null || emojiMarkup != null) {
TLRPC.TL_inputChatPhoto tL_inputChatUploadedPhoto = new TLRPC.TL_inputChatUploadedPhoto();
if (inputPhoto != null) {
((TLRPC.TL_inputChatUploadedPhoto) tL_inputChatUploadedPhoto).file = inputPhoto;
((TLRPC.TL_inputChatUploadedPhoto) tL_inputChatUploadedPhoto).flags |= 1;
}
if (inputVideo != null) {
((TLRPC.TL_inputChatUploadedPhoto) tL_inputChatUploadedPhoto).video = inputVideo;
int i = ((TLRPC.TL_inputChatUploadedPhoto) tL_inputChatUploadedPhoto).flags | 2;
((TLRPC.TL_inputChatUploadedPhoto) tL_inputChatUploadedPhoto).flags = i;
((TLRPC.TL_inputChatUploadedPhoto) tL_inputChatUploadedPhoto).video_start_ts = videoStartTimestamp;
((TLRPC.TL_inputChatUploadedPhoto) tL_inputChatUploadedPhoto).flags = i | 4;
}
if (emojiMarkup != null) {
((TLRPC.TL_inputChatUploadedPhoto) tL_inputChatUploadedPhoto).video_emoji_markup = emojiMarkup;
((TLRPC.TL_inputChatUploadedPhoto) tL_inputChatUploadedPhoto).flags |= 8;
}
messagesController = this;
tL_inputChatPhoto = tL_inputChatUploadedPhoto;
} else {
tL_inputChatPhoto = new TLRPC.TL_inputChatPhotoEmpty();
messagesController = this;
}
if (ChatObject.isChannel(chatId, messagesController.currentAccount)) {
tL_messages_editChatPhoto = new TLRPC.TL_channels_editPhoto();
tL_messages_editChatPhoto.channel = getInputChannel(chatId);
tL_messages_editChatPhoto.photo = tL_inputChatPhoto;
} else {
tL_messages_editChatPhoto = new TLRPC.TL_messages_editChatPhoto();
((TLRPC.TL_messages_editChatPhoto) tL_messages_editChatPhoto).chat_id = chatId;
((TLRPC.TL_messages_editChatPhoto) tL_messages_editChatPhoto).photo = tL_inputChatPhoto;
}
getConnectionsManager().sendRequest(tL_messages_editChatPhoto, new MessagesController$.ExternalSyntheticLambda433(this, oldPhoto, smallSize, bigSize, videoPath, chatId, callback), 64);
}
public void lambda$changeChatAvatar$304(TLRPC.TL_inputChatPhoto tL_inputChatPhoto, TLRPC.FileLocation fileLocation, TLRPC.FileLocation fileLocation2, String str, long j, Runnable runnable, TLObject tLObject, TLRPC.TL_error tL_error) {
TLRPC.Photo photo;
if (tL_error != null) {
return;
}
TLRPC.Updates updates = (TLRPC.Updates) tLObject;
if (tL_inputChatPhoto == null) {
int size = updates.updates.size();
int i = 0;
while (true) {
if (i >= size) {
photo = null;
break;
}
TLRPC.TL_updateNewChannelMessage tL_updateNewChannelMessage = (TLRPC$Update) updates.updates.get(i);
if (tL_updateNewChannelMessage instanceof TLRPC.TL_updateNewChannelMessage) {
TLRPC.MessageAction messageAction = tL_updateNewChannelMessage.message.action;
if (messageAction instanceof TLRPC.TL_messageActionChatEditPhoto) {
photo = messageAction.photo;
if (photo instanceof TLRPC.TL_photo) {
break;
}
} else {
continue;
}
i++;
} else {
if (tL_updateNewChannelMessage instanceof TLRPC.TL_updateNewMessage) {
TLRPC.MessageAction messageAction2 = ((TLRPC.TL_updateNewMessage) tL_updateNewChannelMessage).message.action;
if (messageAction2 instanceof TLRPC.TL_messageActionChatEditPhoto) {
photo = messageAction2.photo;
if (photo instanceof TLRPC.TL_photo) {
break;
}
} else {
continue;
}
} else {
continue;
}
i++;
}
}
if (photo != null) {
TLRPC.PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(photo.sizes, 150);
TLRPC.VideoSize videoSize = photo.video_sizes.isEmpty() ? null : (TLRPC.VideoSize) photo.video_sizes.get(0);
if (closestPhotoSizeWithSize != null && fileLocation != null) {
getFileLoader().getPathToAttach(fileLocation, true).renameTo(getFileLoader().getPathToAttach(closestPhotoSizeWithSize, true));
ImageLoader.getInstance().replaceImageInCache(fileLocation.volume_id + "_" + fileLocation.local_id + "@50_50", closestPhotoSizeWithSize.location.volume_id + "_" + closestPhotoSizeWithSize.location.local_id + "@50_50", ImageLocation.getForPhoto(closestPhotoSizeWithSize, photo), true);
}
TLRPC.PhotoSize closestPhotoSizeWithSize2 = FileLoader.getClosestPhotoSizeWithSize(photo.sizes, 800);
if (closestPhotoSizeWithSize2 != null && fileLocation2 != null) {
getFileLoader().getPathToAttach(fileLocation2, true).renameTo(getFileLoader().getPathToAttach(closestPhotoSizeWithSize2, true));
}
if (videoSize != null && str != null) {
new File(str).renameTo(getFileLoader().getPathToAttach(videoSize, "mp4", true));
}
getDialogPhotos(-j).addPhotoAtStart(photo);
}
}
processUpdates(updates, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda152(this, runnable));
}
public void lambda$changeChatAvatar$303(Runnable runnable) {
if (runnable != null) {
runnable.run();
}
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_AVATAR)});
getNotificationCenter().postNotificationName(NotificationCenter.reloadDialogPhotos, new Object[0]);
}
public void unregistedPush() {
if (getUserConfig().registeredForPush && SharedConfig.pushString.length() == 0) {
TLRPC.TL_account_unregisterDevice tL_account_unregisterDevice = new TLRPC.TL_account_unregisterDevice();
tL_account_unregisterDevice.token = SharedConfig.pushString;
tL_account_unregisterDevice.token_type = SharedConfig.pushType;
for (int i = 0; i < UserConfig.MAX_ACCOUNT_COUNT; i++) {
UserConfig userConfig = UserConfig.getInstance(i);
if (i != this.currentAccount && userConfig.isClientActivated()) {
tL_account_unregisterDevice.other_uids.add(Long.valueOf(userConfig.getClientUserId()));
}
}
getConnectionsManager().sendRequest(tL_account_unregisterDevice, MessagesController$.ExternalSyntheticLambda450.INSTANCE);
}
}
public void performLogout(int type) {
boolean z = true;
if (type == 1) {
unregistedPush();
getConnectionsManager().sendRequest(new TLRPC.TL_auth_logOut(), new MessagesController$.ExternalSyntheticLambda333(this));
} else {
getConnectionsManager().cleanup(type == 2);
}
getUserConfig().clearConfig();
SharedPrefsHelper.cleanupAccount(this.currentAccount);
ArrayList observers = getNotificationCenter().getObservers(NotificationCenter.appDidLogout);
if (observers != null) {
int size = observers.size();
int i = 0;
while (true) {
if (i >= size) {
break;
}
if (observers.get(i) instanceof LaunchActivity) {
z = false;
break;
}
i++;
}
}
if (z && UserConfig.selectedAccount == this.currentAccount) {
int i2 = 0;
while (true) {
if (i2 >= UserConfig.MAX_ACCOUNT_COUNT) {
i2 = -1;
break;
} else if (UserConfig.getInstance(i2).isClientActivated()) {
break;
} else {
i2++;
}
}
if (i2 != -1) {
UserConfig.selectedAccount = i2;
UserConfig.getInstance(0).saveConfig(false);
LaunchActivity.clearFragments();
}
}
getNotificationCenter().postNotificationName(NotificationCenter.appDidLogout, new Object[0]);
getMessagesStorage().cleanup(false);
cleanup();
getContactsController().deleteUnknownAppAccounts();
}
public void lambda$performLogout$307(TLObject tLObject, TLRPC.TL_error tL_error) {
getConnectionsManager().cleanup(false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda287(tLObject));
}
public static void lambda$performLogout$306(TLObject tLObject) {
if (tLObject instanceof TLRPC.TL_auth_loggedOut) {
TLRPC.TL_auth_loggedOut tL_auth_loggedOut = (TLRPC.TL_auth_loggedOut) tLObject;
if (tL_auth_loggedOut.future_auth_token != null) {
AuthTokensHelper.addLogOutToken(tL_auth_loggedOut);
}
}
}
public void cleanupDatabase(int type) {
getMessagesStorage().cleanup(false);
cleanup();
}
public void generateUpdateMessage() {
if (this.gettingAppChangelog) {
return;
}
this.gettingAppChangelog = true;
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("userconfing", 0);
boolean z = sharedPreferences.getBoolean("firstChangelogShown", false);
String str = SharedConfig.lastUpdateVersion;
if (str != null) {
if (str.equals(BuildVars.BUILD_VERSION_STRING) && z) {
return;
}
if (!z) {
sharedPreferences.edit().putBoolean("firstChangelogShown", true).apply();
}
TLRPC.TL_help_getAppChangelog tL_help_getAppChangelog = new TLRPC.TL_help_getAppChangelog();
tL_help_getAppChangelog.prev_app_version = SharedConfig.lastUpdateVersion;
getConnectionsManager().sendRequest(tL_help_getAppChangelog, new MessagesController$.ExternalSyntheticLambda342(this));
}
}
public void lambda$generateUpdateMessage$308(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
SharedConfig.lastUpdateVersion = BuildVars.BUILD_VERSION_STRING;
SharedConfig.saveConfig();
}
if (tLObject instanceof TLRPC.Updates) {
TLRPC.TL_updateServiceNotification tL_updateServiceNotification = new TLRPC.TL_updateServiceNotification();
tL_updateServiceNotification.message = LocaleController.getString("updatePlusText", R.string.updatePlusText);
tL_updateServiceNotification.media = new TLRPC.TL_messageMediaEmpty();
tL_updateServiceNotification.type = "update";
tL_updateServiceNotification.popup = false;
tL_updateServiceNotification.flags |= 2;
tL_updateServiceNotification.inbox_date = ConnectionsManager.getInstance(this.currentAccount).getCurrentTime();
ArrayList<TLRPC$Update> arrayList = new ArrayList<>();
arrayList.add(tL_updateServiceNotification);
processUpdateArray(arrayList, null, null, false, 0);
}
}
public void registerForPush(int pushType, String regid) {
if (TextUtils.isEmpty(regid) || this.registeringForPush || getUserConfig().getClientUserId() == 0) {
return;
}
if (getUserConfig().registeredForPush && regid.equals(SharedConfig.pushString)) {
return;
}
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
this.registeringForPush = true;
this.lastPushRegisterSendTime = SystemClock.elapsedRealtime();
if (SharedConfig.pushAuthKey == null) {
SharedConfig.pushAuthKey = new byte[256];
Utilities.random.nextBytes(SharedConfig.pushAuthKey);
SharedConfig.saveConfig();
}
TLRPC.TL_account_registerDevice tL_account_registerDevice = new TLRPC.TL_account_registerDevice();
tL_account_registerDevice.token_type = pushType;
tL_account_registerDevice.token = regid;
tL_account_registerDevice.no_muted = false;
tL_account_registerDevice.secret = SharedConfig.pushAuthKey;
for (int i = 0; i < UserConfig.MAX_ACCOUNT_COUNT; i++) {
UserConfig userConfig = UserConfig.getInstance(i);
if (i != this.currentAccount && userConfig.isClientActivated()) {
long clientUserId = userConfig.getClientUserId();
tL_account_registerDevice.other_uids.add(Long.valueOf(clientUserId));
if (BuildVars.LOGS_ENABLED) {
FileLog.d("add other uid = " + clientUserId + " for account " + this.currentAccount);
}
}
}
getConnectionsManager().sendRequest(tL_account_registerDevice, new MessagesController$.ExternalSyntheticLambda365(this, pushType, regid));
}
}
public void lambda$registerForPush$310(int i, String str, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject instanceof TLRPC.TL_boolTrue) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("account " + this.currentAccount + " registered for push, push type: " + i);
}
getUserConfig().registeredForPush = true;
SharedConfig.pushString = str;
SharedConfig.pushType = i;
getUserConfig().saveConfig(false);
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda56(this));
}
public void lambda$registerForPush$309() {
this.registeringForPush = false;
}
public void loadCurrentState() {
if (this.updatingState) {
return;
}
this.updatingState = true;
getConnectionsManager().sendRequest(new TLRPC.TL_updates_getState(), new MessagesController$.ExternalSyntheticLambda331(this));
}
public void lambda$loadCurrentState$311(TLObject tLObject, TLRPC.TL_error tL_error) {
this.updatingState = false;
if (tL_error == null) {
TLRPC.TL_updates_state tL_updates_state = (TLRPC.TL_updates_state) tLObject;
getMessagesStorage().setLastDateValue(tL_updates_state.date);
getMessagesStorage().setLastPtsValue(tL_updates_state.pts);
getMessagesStorage().setLastSeqValue(tL_updates_state.seq);
getMessagesStorage().setLastQtsValue(tL_updates_state.qts);
for (int i = 0; i < 3; i++) {
processUpdatesQueue(i, 2);
}
getMessagesStorage().saveDiffParams(getMessagesStorage().getLastSeqValue(), getMessagesStorage().getLastPtsValue(), getMessagesStorage().getLastDateValue(), getMessagesStorage().getLastQtsValue());
return;
}
if (tL_error.code != 401) {
loadCurrentState();
}
}
private int getUpdateSeq(TLRPC.Updates updates) {
if (updates instanceof TLRPC.TL_updatesCombined) {
return updates.seq_start;
}
return updates.seq;
}
private void setUpdatesStartTime(int type, long time) {
if (type == 0) {
this.updatesStartWaitTimeSeq = time;
} else if (type == 1) {
this.updatesStartWaitTimePts = time;
} else if (type == 2) {
this.updatesStartWaitTimeQts = time;
}
}
public long getUpdatesStartTime(int type) {
if (type == 0) {
return this.updatesStartWaitTimeSeq;
}
if (type == 1) {
return this.updatesStartWaitTimePts;
}
if (type == 2) {
return this.updatesStartWaitTimeQts;
}
return 0L;
}
private int isValidUpdate(TLRPC.Updates updates, int type) {
if (type == 0) {
int updateSeq = getUpdateSeq(updates);
if (getMessagesStorage().getLastSeqValue() + 1 == updateSeq || getMessagesStorage().getLastSeqValue() == updateSeq) {
return 0;
}
return getMessagesStorage().getLastSeqValue() < updateSeq ? 1 : 2;
}
if (type == 1) {
if (updates.pts <= getMessagesStorage().getLastPtsValue()) {
return 2;
}
return getMessagesStorage().getLastPtsValue() + updates.pts_count == updates.pts ? 0 : 1;
}
if (type != 2) {
return 0;
}
if (updates.pts <= getMessagesStorage().getLastQtsValue()) {
return 2;
}
return getMessagesStorage().getLastQtsValue() + updates.updates.size() == updates.pts ? 0 : 1;
}
private void processChannelsUpdatesQueue(long channelId, int state) {
char c;
ArrayList<TLRPC.Updates> arrayList = this.updatesQueueChannels.get(channelId);
if (arrayList == null) {
return;
}
int i = this.channelsPts.get(channelId);
if (arrayList.isEmpty() || i == 0) {
this.updatesQueueChannels.remove(channelId);
return;
}
Collections.sort(arrayList, MessagesController$.ExternalSyntheticLambda307.INSTANCE);
if (state == 2) {
this.channelsPts.put(channelId, arrayList.get(0).pts);
}
boolean z = false;
while (arrayList.size() > 0) {
TLRPC.Updates updates = arrayList.get(0);
int i2 = updates.pts;
if (i2 <= i) {
c = 2;
} else {
c = updates.pts_count + i == i2 ? (char) 0 : (char) 1;
}
if (c == 0) {
processUpdates(updates, true);
arrayList.remove(0);
z = true;
} else {
if (c == 1) {
long j = this.updatesStartWaitTimeChannels.get(channelId);
if (j != 0 && (z || Math.abs(System.currentTimeMillis() - j) <= 1500)) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("HOLE IN CHANNEL " + channelId + " UPDATES QUEUE - will wait more time");
}
if (z) {
this.updatesStartWaitTimeChannels.put(channelId, System.currentTimeMillis());
return;
}
return;
}
if (BuildVars.LOGS_ENABLED) {
FileLog.d("HOLE IN CHANNEL " + channelId + " UPDATES QUEUE - getChannelDifference ");
}
this.updatesStartWaitTimeChannels.delete(channelId);
this.updatesQueueChannels.remove(channelId);
getChannelDifference(channelId);
return;
}
arrayList.remove(0);
}
}
this.updatesQueueChannels.remove(channelId);
this.updatesStartWaitTimeChannels.delete(channelId);
if (BuildVars.LOGS_ENABLED) {
FileLog.d("UPDATES CHANNEL " + channelId + " QUEUE PROCEED - OK");
}
}
public static int lambda$processChannelsUpdatesQueue$312(TLRPC.Updates updates, TLRPC.Updates updates2) {
return AndroidUtilities.compare(updates.pts, updates2.pts);
}
private void processUpdatesQueue(int type, int state) {
ArrayList<TLRPC.Updates> arrayList;
if (type == 0) {
arrayList = this.updatesQueueSeq;
Collections.sort(arrayList, new MessagesController$.ExternalSyntheticLambda300(this));
} else if (type == 1) {
arrayList = this.updatesQueuePts;
Collections.sort(arrayList, MessagesController$.ExternalSyntheticLambda306.INSTANCE);
} else if (type == 2) {
arrayList = this.updatesQueueQts;
Collections.sort(arrayList, MessagesController$.ExternalSyntheticLambda305.INSTANCE);
} else {
arrayList = null;
}
if (arrayList != null && !arrayList.isEmpty()) {
if (state == 2) {
TLRPC.Updates updates = arrayList.get(0);
if (type == 0) {
getMessagesStorage().setLastSeqValue(getUpdateSeq(updates));
} else if (type == 1) {
getMessagesStorage().setLastPtsValue(updates.pts);
} else {
getMessagesStorage().setLastQtsValue(updates.pts);
}
}
boolean z = false;
while (arrayList.size() > 0) {
TLRPC.Updates updates2 = arrayList.get(0);
int isValidUpdate = isValidUpdate(updates2, type);
if (isValidUpdate == 0) {
processUpdates(updates2, true);
arrayList.remove(0);
z = true;
} else {
if (isValidUpdate == 1) {
if (getUpdatesStartTime(type) != 0 && (z || Math.abs(System.currentTimeMillis() - getUpdatesStartTime(type)) <= 1500)) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("HOLE IN UPDATES QUEUE - will wait more time");
}
if (z) {
setUpdatesStartTime(type, System.currentTimeMillis());
return;
}
return;
}
if (BuildVars.LOGS_ENABLED) {
FileLog.d("HOLE IN UPDATES QUEUE - getDifference");
}
setUpdatesStartTime(type, 0L);
arrayList.clear();
getDifference();
return;
}
arrayList.remove(0);
}
}
arrayList.clear();
if (BuildVars.LOGS_ENABLED) {
FileLog.d("UPDATES QUEUE PROCEED - OK");
}
}
setUpdatesStartTime(type, 0L);
}
public int lambda$processUpdatesQueue$313(TLRPC.Updates updates, TLRPC.Updates updates2) {
return AndroidUtilities.compare(getUpdateSeq(updates), getUpdateSeq(updates2));
}
public static int lambda$processUpdatesQueue$314(TLRPC.Updates updates, TLRPC.Updates updates2) {
return AndroidUtilities.compare(updates.pts, updates2.pts);
}
public static int lambda$processUpdatesQueue$315(TLRPC.Updates updates, TLRPC.Updates updates2) {
return AndroidUtilities.compare(updates.pts, updates2.pts);
}
public void loadUnknownChannel(final TLRPC.Chat channel, long taskId) {
NativeByteBuffer nativeByteBuffer;
Exception e;
if (!(channel instanceof TLRPC.TL_channel) || this.gettingUnknownChannels.indexOfKey(channel.id) >= 0) {
return;
}
if (channel.access_hash == 0) {
if (taskId != 0) {
getMessagesStorage().removePendingTask(taskId);
return;
}
return;
}
TLRPC.TL_inputPeerChannel tL_inputPeerChannel = new TLRPC.TL_inputPeerChannel();
long j = channel.id;
((TLRPC.InputPeer) tL_inputPeerChannel).channel_id = j;
((TLRPC.InputPeer) tL_inputPeerChannel).access_hash = channel.access_hash;
this.gettingUnknownChannels.put(j, Boolean.TRUE);
if (getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) {
TLRPC.TL_messages_getPeerDialogs tL_messages_getPeerDialogs = new TLRPC.TL_messages_getPeerDialogs();
TLRPC.TL_inputDialogPeer tL_inputDialogPeer = new TLRPC.TL_inputDialogPeer();
tL_inputDialogPeer.peer = tL_inputPeerChannel;
tL_messages_getPeerDialogs.peers.add(tL_inputDialogPeer);
if (taskId == 0) {
try {
nativeByteBuffer = new NativeByteBuffer(channel.getObjectSize() + 4);
} catch (Exception e2) {
nativeByteBuffer = null;
e = e2;
}
try {
nativeByteBuffer.writeInt32(0);
channel.serializeToStream(nativeByteBuffer);
} catch (Exception e3) {
e = e3;
FileLog.e(e);
taskId = getMessagesStorage().createPendingTask(nativeByteBuffer);
getConnectionsManager().sendRequest(tL_messages_getPeerDialogs, new MessagesController$.ExternalSyntheticLambda407(this, taskId, channel));
}
taskId = getMessagesStorage().createPendingTask(nativeByteBuffer);
}
getConnectionsManager().sendRequest(tL_messages_getPeerDialogs, new MessagesController$.ExternalSyntheticLambda407(this, taskId, channel));
}
}
public void lambda$loadUnknownChannel$316(long j, TLRPC.Chat chat, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
TLRPC.TL_messages_peerDialogs tL_messages_peerDialogs = (TLRPC.TL_messages_peerDialogs) tLObject;
if (!tL_messages_peerDialogs.dialogs.isEmpty() && !tL_messages_peerDialogs.chats.isEmpty()) {
TLRPC.TL_dialog tL_dialog = (TLRPC.TL_dialog) tL_messages_peerDialogs.dialogs.get(0);
TLRPC.TL_messages_dialogs tL_messages_dialogs = new TLRPC.TL_messages_dialogs();
((TLRPC.messages_Dialogs) tL_messages_dialogs).dialogs.addAll(tL_messages_peerDialogs.dialogs);
((TLRPC.messages_Dialogs) tL_messages_dialogs).messages.addAll(tL_messages_peerDialogs.messages);
((TLRPC.messages_Dialogs) tL_messages_dialogs).users.addAll(tL_messages_peerDialogs.users);
((TLRPC.messages_Dialogs) tL_messages_dialogs).chats.addAll(tL_messages_peerDialogs.chats);
processLoadedDialogs(tL_messages_dialogs, null, null, ((TLRPC.Dialog) tL_dialog).folder_id, 0, 1, this.DIALOGS_LOAD_TYPE_CHANNEL, false, false, false);
}
}
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
this.gettingUnknownChannels.delete(chat.id);
}
public void startShortPoll(TLRPC.Chat chat, int guid, boolean stop) {
startShortPoll(chat, guid, stop, null);
}
public void startShortPoll(TLRPC.Chat chat, int guid, boolean stop, Consumer<Boolean> needPollConsumer) {
if (chat == null) {
return;
}
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda213(this, chat, stop, guid, needPollConsumer));
}
public void lambda$startShortPoll$319(TLRPC.Chat chat, boolean z, int i, Consumer consumer) {
ArrayList<Integer> arrayList = this.needShortPollChannels.get(chat.id);
ArrayList<Integer> arrayList2 = this.needShortPollOnlines.get(chat.id);
if (z) {
if (arrayList != null) {
arrayList.remove(Integer.valueOf(i));
}
if (arrayList == null || arrayList.isEmpty()) {
this.needShortPollChannels.delete(chat.id);
}
if (chat.megagroup) {
if (arrayList2 != null) {
arrayList2.remove(Integer.valueOf(i));
}
if (arrayList2 == null || arrayList2.isEmpty()) {
this.needShortPollOnlines.delete(chat.id);
return;
}
return;
}
return;
}
if (arrayList == null) {
arrayList = new ArrayList<>();
this.needShortPollChannels.put(chat.id, arrayList);
}
if (!arrayList.contains(Integer.valueOf(i))) {
arrayList.add(Integer.valueOf(i));
}
if (this.shortPollChannels.indexOfKey(chat.id) < 0) {
if (consumer != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda22(consumer));
}
getChannelDifference(chat.id, 3, 0L, null);
} else if (consumer != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda23(consumer));
}
if (chat.megagroup) {
if (arrayList2 == null) {
arrayList2 = new ArrayList<>();
this.needShortPollOnlines.put(chat.id, arrayList2);
}
if (!arrayList2.contains(Integer.valueOf(i))) {
arrayList2.add(Integer.valueOf(i));
}
if (this.shortPollOnlines.indexOfKey(chat.id) < 0) {
this.shortPollOnlines.put(chat.id, 0);
}
}
}
public static void lambda$startShortPoll$317(Consumer consumer) {
consumer.accept(Boolean.TRUE);
}
public static void lambda$startShortPoll$318(Consumer consumer) {
consumer.accept(Boolean.FALSE);
}
private void getChannelDifference(long channelId) {
getChannelDifference(channelId, 0, 0L, null);
}
public static boolean isSupportUser(TLRPC$User user) {
if (user != null) {
if (!user.support) {
long j = user.id;
if (j == 777000 || j == 333000 || j == 4240000 || j == 4244000 || j == 4245000 || j == 4246000 || j == 410000 || j == 420000 || j == 431000 || j == 431415000 || j == 434000 || j == 4243000 || j == 439000 || j == 449000 || j == 450000 || j == 452000 || j == 454000 || j == 4254000 || j == 455000 || j == 460000 || j == 470000 || j == 479000 || j == 796000 || j == 482000 || j == 490000 || j == 496000 || j == 497000 || j == 498000 || j == 4298000) {
}
}
return true;
}
return false;
}
public void getChannelDifference(long r17, int r19, long r20, org.telegram.tgnet.TLRPC.InputChannel r22) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.getChannelDifference(long, int, long, org.telegram.tgnet.TLRPC$InputChannel):void");
}
public void lambda$getChannelDifference$320(long j) {
NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.onReceivedChannelDifference, new Object[]{Long.valueOf(j)});
}
public void lambda$getChannelDifference$321(long j) {
NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.onReceivedChannelDifference, new Object[]{Long.valueOf(j)});
}
public void lambda$getChannelDifference$322(long j) {
NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.onReceivedChannelDifference, new Object[]{Long.valueOf(j)});
}
public void lambda$getChannelDifference$323(long j) {
NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.onReceivedChannelDifference, new Object[]{Long.valueOf(j)});
}
public void lambda$getChannelDifference$335(long j, int i, long j2, TLObject tLObject, TLRPC.TL_error tL_error) {
TLRPC.Chat chat;
if (tLObject == null) {
if (tL_error != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda226(this, tL_error, j));
this.gettingDifferenceChannels.delete(j);
if (j2 != 0) {
getMessagesStorage().removePendingTask(j2);
return;
}
return;
}
return;
}
TLRPC.updates_ChannelDifference updates_channeldifference = (TLRPC.updates_ChannelDifference) tLObject;
LongSparseArray longSparseArray = new LongSparseArray();
int i2 = 0;
for (int i3 = 0; i3 < updates_channeldifference.users.size(); i3++) {
TLRPC$User tLRPC$User = (TLRPC$User) updates_channeldifference.users.get(i3);
longSparseArray.put(tLRPC$User.id, tLRPC$User);
}
int i4 = 0;
while (true) {
if (i4 >= updates_channeldifference.chats.size()) {
chat = null;
break;
}
chat = (TLRPC.Chat) updates_channeldifference.chats.get(i4);
if (chat.id == j) {
break;
} else {
i4++;
}
}
ArrayList arrayList = new ArrayList();
if (!updates_channeldifference.other_updates.isEmpty()) {
while (i2 < updates_channeldifference.other_updates.size()) {
TLRPC.TL_updateMessageID tL_updateMessageID = (TLRPC$Update) updates_channeldifference.other_updates.get(i2);
if (tL_updateMessageID instanceof TLRPC.TL_updateMessageID) {
arrayList.add(tL_updateMessageID);
updates_channeldifference.other_updates.remove(i2);
i2--;
}
i2++;
}
}
getMessagesStorage().putUsersAndChats(updates_channeldifference.users, updates_channeldifference.chats, true, true);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda265(this, updates_channeldifference));
getMessagesStorage().getStorageQueue().postRunnable(new MessagesController$.ExternalSyntheticLambda169(this, arrayList, j, updates_channeldifference, chat, longSparseArray, i, j2));
}
public void lambda$getChannelDifference$324(TLRPC.updates_ChannelDifference updates_channeldifference) {
putUsers(updates_channeldifference.users, false);
putChats(updates_channeldifference.chats, false);
}
public void lambda$getChannelDifference$333(ArrayList arrayList, long j, TLRPC.updates_ChannelDifference updates_channeldifference, TLRPC.Chat chat, LongSparseArray longSparseArray, int i, long j2) {
if (!arrayList.isEmpty()) {
SparseArray sparseArray = new SparseArray();
Iterator it = arrayList.iterator();
while (it.hasNext()) {
TLRPC.TL_updateMessageID tL_updateMessageID = (TLRPC.TL_updateMessageID) it.next();
long[] updateMessageStateAndId = getMessagesStorage().updateMessageStateAndId(tL_updateMessageID.random_id, -j, (Integer) null, tL_updateMessageID.id, 0, false, -1, 0);
if (updateMessageStateAndId != null) {
sparseArray.put(tL_updateMessageID.id, updateMessageStateAndId);
}
}
if (sparseArray.size() != 0) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda142(this, sparseArray));
}
}
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda266(this, updates_channeldifference, j, chat, longSparseArray, i, j2));
}
public void lambda$getChannelDifference$325(SparseArray sparseArray) {
for (int i = 0; i < sparseArray.size(); i++) {
int keyAt = sparseArray.keyAt(i);
long[] jArr = (long[]) sparseArray.valueAt(i);
getSendMessagesHelper().processSentMessage((int) jArr[1]);
NotificationCenter notificationCenter = getNotificationCenter();
int i2 = NotificationCenter.messageReceivedByServer;
Boolean bool = Boolean.FALSE;
notificationCenter.postNotificationName(i2, new Object[]{Integer.valueOf((int) jArr[1]), Integer.valueOf(keyAt), null, Long.valueOf(jArr[0]), 0L, -1, bool});
getNotificationCenter().postNotificationName(NotificationCenter.messageReceivedByServer2, new Object[]{Integer.valueOf((int) jArr[1]), Integer.valueOf(keyAt), null, Long.valueOf(jArr[0]), 0L, -1, bool});
}
}
public void lambda$getChannelDifference$332(org.telegram.tgnet.TLRPC.updates_ChannelDifference r23, long r24, org.telegram.tgnet.TLRPC.Chat r26, androidx.collection.LongSparseArray r27, int r28, long r29) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$getChannelDifference$332(org.telegram.tgnet.TLRPC$updates_ChannelDifference, long, org.telegram.tgnet.TLRPC$Chat, androidx.collection.LongSparseArray, int, long):void");
}
public void lambda$getChannelDifference$326(LongSparseArray longSparseArray) {
for (int i = 0; i < longSparseArray.size(); i++) {
updateInterfaceWithMessages(longSparseArray.keyAt(i), (ArrayList) longSparseArray.valueAt(i), 0);
}
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
public void lambda$getChannelDifference$328(ArrayList arrayList, TLRPC.updates_ChannelDifference updates_channeldifference) {
if (!arrayList.isEmpty()) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda156(this, arrayList));
}
getMessagesStorage().putMessages(updates_channeldifference.new_messages, true, false, false, getDownloadController().getAutodownloadMask(), 0, 0L);
}
public void lambda$getChannelDifference$327(ArrayList arrayList) {
getNotificationsController().processNewMessages(arrayList, true, false, (CountDownLatch) null);
}
public void lambda$getChannelDifference$330(long j) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda98(this, j));
}
public void lambda$getChannelDifference$329(long j) {
NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.onReceivedChannelDifference, new Object[]{Long.valueOf(j)});
}
public void lambda$getChannelDifference$331(long j) {
NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.onReceivedChannelDifference, new Object[]{Long.valueOf(j)});
}
public void lambda$getChannelDifference$334(TLRPC.TL_error tL_error, long j) {
checkChannelError(tL_error.text, j);
NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.onReceivedChannelDifference, new Object[]{Long.valueOf(j)});
}
private void checkChannelError(String text, long channelId) {
text.hashCode();
switch (text) {
case "USER_BANNED_IN_CHANNEL":
getNotificationCenter().postNotificationName(NotificationCenter.chatInfoCantLoad, new Object[]{Long.valueOf(channelId), 2});
break;
case "CHANNEL_PRIVATE":
getNotificationCenter().postNotificationName(NotificationCenter.chatInfoCantLoad, new Object[]{Long.valueOf(channelId), 0});
break;
case "CHANNEL_PUBLIC_GROUP_NA":
getNotificationCenter().postNotificationName(NotificationCenter.chatInfoCantLoad, new Object[]{Long.valueOf(channelId), 1});
break;
}
}
public void getDifference() {
getDifference(getMessagesStorage().getLastPtsValue(), getMessagesStorage().getLastDateValue(), getMessagesStorage().getLastQtsValue(), false);
}
public void getDifference(int pts, int date, int qts, boolean slice) {
registerForPush(SharedConfig.pushType, SharedConfig.pushString);
if (getMessagesStorage().getLastPtsValue() == 0) {
loadCurrentState();
return;
}
if (slice || !this.gettingDifference) {
this.gettingDifference = true;
TLRPC.TL_updates_getDifference tL_updates_getDifference = new TLRPC.TL_updates_getDifference();
tL_updates_getDifference.pts = pts;
tL_updates_getDifference.date = date;
tL_updates_getDifference.qts = qts;
if (this.getDifferenceFirstSync) {
tL_updates_getDifference.flags |= 1;
if (ApplicationLoader.isConnectedOrConnectingToWiFi()) {
tL_updates_getDifference.pts_total_limit = 5000;
} else {
tL_updates_getDifference.pts_total_limit = 1000;
}
this.getDifferenceFirstSync = false;
}
if (tL_updates_getDifference.date == 0) {
tL_updates_getDifference.date = getConnectionsManager().getCurrentTime();
}
if (BuildVars.LOGS_ENABLED) {
FileLog.d("start getDifference with date = " + date + " pts = " + pts + " qts = " + qts);
FileLog.d("getDifference: isUpdating = true");
}
getConnectionsManager().setIsUpdating(true);
getConnectionsManager().sendRequest(tL_updates_getDifference, new MessagesController$.ExternalSyntheticLambda356(this, date, qts));
}
}
public void lambda$getDifference$345(int i, int i2, TLObject tLObject, TLRPC.TL_error tL_error) {
int i3 = 0;
if (tL_error == null) {
TLRPC.updates_Difference updates_difference = (TLRPC.updates_Difference) tLObject;
if (updates_difference instanceof TLRPC.TL_updates_differenceTooLong) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda268(this, updates_difference, i, i2));
return;
}
if (updates_difference instanceof TLRPC.TL_updates_differenceSlice) {
TLRPC.TL_updates_state tL_updates_state = updates_difference.intermediate_state;
getDifference(tL_updates_state.pts, tL_updates_state.date, tL_updates_state.qts, true);
}
LongSparseArray longSparseArray = new LongSparseArray();
LongSparseArray longSparseArray2 = new LongSparseArray();
for (int i4 = 0; i4 < updates_difference.users.size(); i4++) {
TLRPC$User tLRPC$User = (TLRPC$User) updates_difference.users.get(i4);
longSparseArray.put(tLRPC$User.id, tLRPC$User);
}
for (int i5 = 0; i5 < updates_difference.chats.size(); i5++) {
TLRPC.Chat chat = (TLRPC.Chat) updates_difference.chats.get(i5);
longSparseArray2.put(chat.id, chat);
}
ArrayList arrayList = new ArrayList();
if (!updates_difference.other_updates.isEmpty()) {
while (i3 < updates_difference.other_updates.size()) {
TLRPC.TL_updateMessageID tL_updateMessageID = (TLRPC$Update) updates_difference.other_updates.get(i3);
if (tL_updateMessageID instanceof TLRPC.TL_updateMessageID) {
arrayList.add(tL_updateMessageID);
updates_difference.other_updates.remove(i3);
} else {
if (getUpdateType(tL_updateMessageID) == 2) {
long updateChannelId = getUpdateChannelId(tL_updateMessageID);
int i6 = this.channelsPts.get(updateChannelId);
if (i6 == 0 && (i6 = getMessagesStorage().getChannelPtsSync(updateChannelId)) != 0) {
this.channelsPts.put(updateChannelId, i6);
}
if (i6 != 0 && getUpdatePts(tL_updateMessageID) <= i6) {
updates_difference.other_updates.remove(i3);
}
}
i3++;
}
i3--;
i3++;
}
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda267(this, updates_difference));
getMessagesStorage().getStorageQueue().postRunnable(new MessagesController$.ExternalSyntheticLambda270(this, updates_difference, arrayList, longSparseArray, longSparseArray2));
return;
}
this.gettingDifference = false;
getConnectionsManager().setIsUpdating(false);
FileLog.d("received: isUpdating = false");
}
public void lambda$getDifference$336(TLRPC.updates_Difference updates_difference, int i, int i2) {
this.loadedFullUsers.clear();
this.loadedFullChats.clear();
resetDialogs(true, getMessagesStorage().getLastSeqValue(), updates_difference.pts, i, i2);
getStoriesController().cleanup();
}
public void lambda$getDifference$337(TLRPC.updates_Difference updates_difference) {
this.loadedFullUsers.clear();
this.loadedFullChats.clear();
putUsers(updates_difference.users, false);
putChats(updates_difference.chats, false);
}
public void lambda$getDifference$344(TLRPC.updates_Difference updates_difference, ArrayList arrayList, LongSparseArray longSparseArray, LongSparseArray longSparseArray2) {
getMessagesStorage().putUsersAndChats(updates_difference.users, updates_difference.chats, true, false);
if (!arrayList.isEmpty()) {
SparseArray sparseArray = new SparseArray();
for (int i = 0; i < arrayList.size(); i++) {
TLRPC.TL_updateMessageID tL_updateMessageID = (TLRPC.TL_updateMessageID) arrayList.get(i);
long[] updateMessageStateAndId = getMessagesStorage().updateMessageStateAndId(tL_updateMessageID.random_id, 0L, (Integer) null, tL_updateMessageID.id, 0, false, -1, 0);
if (updateMessageStateAndId != null) {
sparseArray.put(tL_updateMessageID.id, updateMessageStateAndId);
}
}
if (sparseArray.size() != 0) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda141(this, sparseArray));
}
}
Utilities.stageQueue.postRunnable(new MessagesController$.ExternalSyntheticLambda269(this, updates_difference, longSparseArray, longSparseArray2));
}
public void lambda$getDifference$338(SparseArray sparseArray) {
for (int i = 0; i < sparseArray.size(); i++) {
int keyAt = sparseArray.keyAt(i);
long[] jArr = (long[]) sparseArray.valueAt(i);
getSendMessagesHelper().processSentMessage((int) jArr[1]);
NotificationCenter notificationCenter = getNotificationCenter();
int i2 = NotificationCenter.messageReceivedByServer;
Boolean bool = Boolean.FALSE;
notificationCenter.postNotificationName(i2, new Object[]{Integer.valueOf((int) jArr[1]), Integer.valueOf(keyAt), null, Long.valueOf(jArr[0]), 0L, -1, bool});
getNotificationCenter().postNotificationName(NotificationCenter.messageReceivedByServer2, new Object[]{Integer.valueOf((int) jArr[1]), Integer.valueOf(keyAt), null, Long.valueOf(jArr[0]), 0L, -1, bool});
}
}
public void lambda$getDifference$343(org.telegram.tgnet.TLRPC.updates_Difference r19, androidx.collection.LongSparseArray r20, androidx.collection.LongSparseArray r21) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$getDifference$343(org.telegram.tgnet.TLRPC$updates_Difference, androidx.collection.LongSparseArray, androidx.collection.LongSparseArray):void");
}
public void lambda$getDifference$342(ArrayList arrayList, TLRPC.updates_Difference updates_difference, LongSparseArray longSparseArray) {
if (!arrayList.isEmpty()) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda173(this, arrayList, updates_difference));
}
getMessagesStorage().putMessages(updates_difference.new_messages, true, false, false, getDownloadController().getAutodownloadMask(), 0, 0L);
for (int i = 0; i < longSparseArray.size(); i++) {
long keyAt = longSparseArray.keyAt(i);
ArrayList arrayList2 = (ArrayList) longSparseArray.valueAt(i);
getMediaDataController().loadReplyMessagesForMessages(arrayList2, keyAt, 0, 0L, new MessagesController$.ExternalSyntheticLambda130(this, keyAt, arrayList2), 0);
}
}
public void lambda$getDifference$339(ArrayList arrayList, TLRPC.updates_Difference updates_difference) {
getNotificationsController().processNewMessages(arrayList, !(updates_difference instanceof TLRPC.TL_updates_differenceSlice), false, (CountDownLatch) null);
}
public void lambda$getDifference$341(long j, ArrayList arrayList) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda131(this, j, arrayList));
}
public void lambda$getDifference$340(long j, ArrayList arrayList) {
updateInterfaceWithMessages(j, arrayList, 0);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
public void markDialogAsUnread(long dialogId, TLRPC.InputPeer peer, long taskId) {
NativeByteBuffer nativeByteBuffer;
TLRPC.Dialog dialog = this.dialogs_dict.get(dialogId);
NativeByteBuffer nativeByteBuffer2 = null;
if (dialog != null) {
dialog.unread_mark = true;
if (dialog.unread_count == 0 && !isDialogMuted(dialogId, 0L)) {
this.unreadUnmutedDialogs++;
}
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_READ_DIALOG_MESSAGE)});
getMessagesStorage().setDialogUnread(dialogId, true);
int i = 0;
while (true) {
DialogFilter[] dialogFilterArr = this.selectedDialogFilter;
if (i < dialogFilterArr.length) {
if (dialogFilterArr[i] != null && (dialogFilterArr[i].flags & DIALOG_FILTER_FLAG_EXCLUDE_READ) != 0) {
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
break;
}
i++;
} else {
break;
}
}
}
if (DialogObject.isEncryptedDialog(dialogId)) {
return;
}
TLRPC.TL_messages_markDialogUnread tL_messages_markDialogUnread = new TLRPC.TL_messages_markDialogUnread();
tL_messages_markDialogUnread.unread = true;
if (peer == null) {
peer = getInputPeer(dialogId);
}
if (peer instanceof TLRPC.TL_inputPeerEmpty) {
return;
}
TLRPC.TL_inputDialogPeer tL_inputDialogPeer = new TLRPC.TL_inputDialogPeer();
tL_inputDialogPeer.peer = peer;
tL_messages_markDialogUnread.peer = tL_inputDialogPeer;
if (taskId == 0) {
try {
nativeByteBuffer = new NativeByteBuffer(peer.getObjectSize() + 12);
} catch (Exception e) {
e = e;
}
try {
nativeByteBuffer.writeInt32(9);
nativeByteBuffer.writeInt64(dialogId);
peer.serializeToStream(nativeByteBuffer);
} catch (Exception e2) {
e = e2;
nativeByteBuffer2 = nativeByteBuffer;
FileLog.e(e);
nativeByteBuffer = nativeByteBuffer2;
taskId = getMessagesStorage().createPendingTask(nativeByteBuffer);
getConnectionsManager().sendRequest(tL_messages_markDialogUnread, new MessagesController$.ExternalSyntheticLambda371(this, taskId));
}
taskId = getMessagesStorage().createPendingTask(nativeByteBuffer);
}
getConnectionsManager().sendRequest(tL_messages_markDialogUnread, new MessagesController$.ExternalSyntheticLambda371(this, taskId));
}
public void lambda$markDialogAsUnread$346(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
}
public void loadUnreadDialogs() {
if (this.loadingUnreadDialogs || getUserConfig().unreadDialogsLoaded) {
return;
}
this.loadingUnreadDialogs = true;
getConnectionsManager().sendRequest(new TLRPC.TL_messages_getDialogUnreadMarks(), new MessagesController$.ExternalSyntheticLambda337(this));
}
public void lambda$loadUnreadDialogs$348(TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda192(this, tLObject));
}
public void lambda$loadUnreadDialogs$347(TLObject tLObject) {
if (tLObject != null) {
TLRPC.Vector vector = (TLRPC.Vector) tLObject;
int size = vector.objects.size();
for (int i = 0; i < size; i++) {
TLRPC.TL_dialogPeer tL_dialogPeer = (TLRPC.DialogPeer) vector.objects.get(i);
if (tL_dialogPeer instanceof TLRPC.TL_dialogPeer) {
TLRPC.Peer peer = tL_dialogPeer.peer;
long j = peer.user_id;
if (j == 0) {
long j2 = peer.chat_id;
j = j2 != 0 ? -j2 : -peer.channel_id;
}
getMessagesStorage().setDialogUnread(j, true);
TLRPC.Dialog dialog = this.dialogs_dict.get(j);
if (dialog != null && !dialog.unread_mark) {
dialog.unread_mark = true;
if (dialog.unread_count == 0 && !isDialogMuted(j, 0L)) {
this.unreadUnmutedDialogs++;
}
}
}
}
getUserConfig().unreadDialogsLoaded = true;
getUserConfig().saveConfig(false);
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_READ_DIALOG_MESSAGE)});
this.loadingUnreadDialogs = false;
}
}
public void reorderPinnedDialogs(int folderId, ArrayList<TLRPC.InputDialogPeer> order, long taskId) {
AbstractSerializedData abstractSerializedData;
TLRPC.TL_messages_reorderPinnedDialogs tL_messages_reorderPinnedDialogs = new TLRPC.TL_messages_reorderPinnedDialogs();
tL_messages_reorderPinnedDialogs.folder_id = folderId;
tL_messages_reorderPinnedDialogs.force = true;
if (taskId == 0) {
ArrayList<TLRPC.Dialog> dialogs = getDialogs(folderId);
if (dialogs.isEmpty()) {
return;
}
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
int size = dialogs.size();
int i = 0;
for (int i2 = 0; i2 < size; i2++) {
TLRPC.Dialog dialog = dialogs.get(i2);
if (!(dialog instanceof TLRPC.TL_dialogFolder)) {
if (!dialog.pinned) {
if (dialog.id != this.promoDialogId) {
break;
}
} else {
arrayList.add(Long.valueOf(dialog.id));
arrayList2.add(Integer.valueOf(dialog.pinnedNum));
if (!DialogObject.isEncryptedDialog(dialog.id)) {
TLRPC.InputPeer inputPeer = getInputPeer(dialog.id);
TLRPC.TL_inputDialogPeer tL_inputDialogPeer = new TLRPC.TL_inputDialogPeer();
tL_inputDialogPeer.peer = inputPeer;
tL_messages_reorderPinnedDialogs.order.add(tL_inputDialogPeer);
i += tL_inputDialogPeer.getObjectSize();
}
}
}
}
getMessagesStorage().setDialogsPinned(arrayList, arrayList2);
AbstractSerializedData abstractSerializedData2 = null;
try {
abstractSerializedData = new NativeByteBuffer(i + 12);
try {
abstractSerializedData.writeInt32(16);
abstractSerializedData.writeInt32(folderId);
abstractSerializedData.writeInt32(tL_messages_reorderPinnedDialogs.order.size());
int size2 = tL_messages_reorderPinnedDialogs.order.size();
for (int i3 = 0; i3 < size2; i3++) {
((TLRPC.InputDialogPeer) tL_messages_reorderPinnedDialogs.order.get(i3)).serializeToStream(abstractSerializedData);
}
} catch (Exception e) {
e = e;
abstractSerializedData2 = abstractSerializedData;
FileLog.e(e);
abstractSerializedData = abstractSerializedData2;
taskId = getMessagesStorage().createPendingTask(abstractSerializedData);
getConnectionsManager().sendRequest(tL_messages_reorderPinnedDialogs, new MessagesController$.ExternalSyntheticLambda378(this, taskId));
}
} catch (Exception e2) {
e = e2;
}
taskId = getMessagesStorage().createPendingTask(abstractSerializedData);
} else {
tL_messages_reorderPinnedDialogs.order = order;
}
getConnectionsManager().sendRequest(tL_messages_reorderPinnedDialogs, new MessagesController$.ExternalSyntheticLambda378(this, taskId));
}
public void lambda$reorderPinnedDialogs$349(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
}
public boolean pinDialog(long dialogId, boolean pin, TLRPC.InputPeer peer, long taskId) {
NativeByteBuffer nativeByteBuffer;
long createPendingTask;
TLRPC.Dialog dialog = this.dialogs_dict.get(dialogId);
if (dialog == null || dialog.pinned == pin) {
return dialog != null;
}
int i = dialog.folder_id;
ArrayList<TLRPC.Dialog> dialogs = getDialogs(i);
dialog.pinned = pin;
if (pin) {
int i2 = 0;
for (int i3 = 0; i3 < dialogs.size(); i3++) {
TLRPC.Dialog dialog2 = dialogs.get(i3);
if (!(dialog2 instanceof TLRPC.TL_dialogFolder)) {
if (!dialog2.pinned) {
if (dialog2.id != this.promoDialogId) {
break;
}
} else {
i2 = Math.max(dialog2.pinnedNum, i2);
}
}
}
dialog.pinnedNum = i2 + 1;
} else {
dialog.pinnedNum = 0;
}
NativeByteBuffer nativeByteBuffer2 = null;
sortDialogs(null);
if (!pin && !dialogs.isEmpty() && dialogs.get(dialogs.size() - 1) == dialog && !this.dialogsEndReached.get(i)) {
dialogs.remove(dialogs.size() - 1);
}
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
if (!DialogObject.isEncryptedDialog(dialogId) && taskId != -1) {
TLRPC.TL_messages_toggleDialogPin tL_messages_toggleDialogPin = new TLRPC.TL_messages_toggleDialogPin();
tL_messages_toggleDialogPin.pinned = pin;
TLRPC.InputPeer inputPeer = peer == null ? getInputPeer(dialogId) : peer;
if (inputPeer instanceof TLRPC.TL_inputPeerEmpty) {
return false;
}
TLRPC.TL_inputDialogPeer tL_inputDialogPeer = new TLRPC.TL_inputDialogPeer();
tL_inputDialogPeer.peer = inputPeer;
tL_messages_toggleDialogPin.peer = tL_inputDialogPeer;
if (taskId == 0) {
try {
nativeByteBuffer = new NativeByteBuffer(inputPeer.getObjectSize() + 16);
} catch (Exception e) {
e = e;
}
try {
nativeByteBuffer.writeInt32(4);
nativeByteBuffer.writeInt64(dialogId);
nativeByteBuffer.writeBool(pin);
inputPeer.serializeToStream(nativeByteBuffer);
} catch (Exception e2) {
e = e2;
nativeByteBuffer2 = nativeByteBuffer;
FileLog.e(e);
nativeByteBuffer = nativeByteBuffer2;
createPendingTask = getMessagesStorage().createPendingTask(nativeByteBuffer);
getConnectionsManager().sendRequest(tL_messages_toggleDialogPin, new MessagesController$.ExternalSyntheticLambda374(this, createPendingTask));
getMessagesStorage().setDialogPinned(dialogId, dialog.pinnedNum);
return true;
}
createPendingTask = getMessagesStorage().createPendingTask(nativeByteBuffer);
} else {
createPendingTask = taskId;
}
getConnectionsManager().sendRequest(tL_messages_toggleDialogPin, new MessagesController$.ExternalSyntheticLambda374(this, createPendingTask));
}
getMessagesStorage().setDialogPinned(dialogId, dialog.pinnedNum);
return true;
}
public void lambda$pinDialog$350(long j, TLObject tLObject, TLRPC.TL_error tL_error) {
if (j != 0) {
getMessagesStorage().removePendingTask(j);
}
}
public void loadPinnedDialogs(final int folderId, long newDialogId, ArrayList<Long> order) {
if (this.loadingPinnedDialogs.indexOfKey(folderId) >= 0 || getUserConfig().isPinnedDialogsLoaded(folderId)) {
return;
}
if ((getUserConfig().getCurrentUser() == null || !getUserConfig().getCurrentUser().bot) && folderId != 2) {
if (this.increasePinnedDialogsLimit && getUserConfig().getTotalPinnedDialogsCount(folderId) > 5) {
getUserConfig().setPinnedDialogsLoaded(folderId, true);
getUserConfig().saveConfig(false);
} else {
this.loadingPinnedDialogs.put(folderId, 1);
TLRPC.TL_messages_getPinnedDialogs tL_messages_getPinnedDialogs = new TLRPC.TL_messages_getPinnedDialogs();
tL_messages_getPinnedDialogs.folder_id = folderId;
getConnectionsManager().sendRequest(tL_messages_getPinnedDialogs, new MessagesController$.ExternalSyntheticLambda355(this, folderId));
}
}
}
public void lambda$loadPinnedDialogs$353(int r19, org.telegram.tgnet.TLObject r20, org.telegram.tgnet.TLRPC.TL_error r21) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$loadPinnedDialogs$353(int, org.telegram.tgnet.TLObject, org.telegram.tgnet.TLRPC$TL_error):void");
}
public void lambda$loadPinnedDialogs$352(int i, ArrayList arrayList, boolean z, TLRPC.TL_messages_peerDialogs tL_messages_peerDialogs, LongSparseArray longSparseArray, TLRPC.TL_messages_dialogs tL_messages_dialogs) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda80(this, i, arrayList, z, tL_messages_peerDialogs, longSparseArray, tL_messages_dialogs));
}
public void lambda$loadPinnedDialogs$351(int i, ArrayList arrayList, boolean z, TLRPC.TL_messages_peerDialogs tL_messages_peerDialogs, LongSparseArray longSparseArray, TLRPC.TL_messages_dialogs tL_messages_dialogs) {
boolean z2;
boolean z3;
boolean z4;
ArrayList arrayList2;
ArrayList<MessageObject> arrayList3;
this.loadingPinnedDialogs.delete(i);
applyDialogsNotificationsSettings(arrayList);
ArrayList<TLRPC.Dialog> dialogs = getDialogs(i);
int i2 = z ? 1 : 0;
int i3 = 0;
int i4 = 0;
boolean z5 = false;
while (true) {
z2 = true;
if (i3 >= dialogs.size()) {
break;
}
TLRPC.Dialog dialog = dialogs.get(i3);
if (!(dialog instanceof TLRPC.TL_dialogFolder)) {
if (DialogObject.isEncryptedDialog(dialog.id)) {
if (i2 < arrayList.size()) {
arrayList.add(i2, dialog);
} else {
arrayList.add(dialog);
}
i2++;
} else if (!dialog.pinned) {
if (dialog.id != this.promoDialogId) {
break;
}
} else {
i4 = Math.max(dialog.pinnedNum, i4);
dialog.pinned = false;
dialog.pinnedNum = 0;
i2++;
z5 = true;
}
}
i3++;
}
ArrayList arrayList4 = new ArrayList();
if (arrayList.isEmpty()) {
z3 = false;
} else {
putUsers(tL_messages_peerDialogs.users, false);
putChats(tL_messages_peerDialogs.chats, false);
ArrayList arrayList5 = new ArrayList();
ArrayList arrayList6 = new ArrayList();
int size = arrayList.size();
int i5 = 0;
z3 = false;
while (i5 < size) {
TLRPC.Dialog dialog2 = (TLRPC.Dialog) arrayList.get(i5);
dialog2.pinnedNum = (size - i5) + i4;
arrayList4.add(Long.valueOf(dialog2.id));
TLRPC.Dialog dialog3 = this.dialogs_dict.get(dialog2.id);
if (dialog3 != null) {
dialog3.pinned = z2;
dialog3.pinnedNum = dialog2.pinnedNum;
arrayList5.add(Long.valueOf(dialog2.id));
arrayList6.add(Integer.valueOf(dialog2.pinnedNum));
arrayList2 = arrayList6;
} else {
this.dialogs_dict.put(dialog2.id, dialog2);
ArrayList<MessageObject> arrayList7 = (ArrayList) longSparseArray.get(dialog2.id);
arrayList2 = arrayList6;
this.dialogMessage.put(dialog2.id, arrayList7);
if (arrayList7 != null) {
int i6 = 0;
while (i6 < arrayList7.size()) {
MessageObject messageObject = arrayList7.get(i6);
if (messageObject != null) {
arrayList3 = arrayList7;
if (messageObject.messageOwner.peer_id.channel_id == 0) {
this.dialogMessagesByIds.put(messageObject.getId(), messageObject);
this.dialogsLoadedTillDate = Math.min(this.dialogsLoadedTillDate, messageObject.messageOwner.date);
long j = messageObject.messageOwner.random_id;
if (j != 0) {
this.dialogMessagesByRandomIds.put(j, messageObject);
}
}
} else {
arrayList3 = arrayList7;
}
i6++;
arrayList7 = arrayList3;
}
}
getTranslateController().checkDialogMessage(dialog2.id);
z3 = true;
}
i5++;
arrayList6 = arrayList2;
z5 = true;
z2 = true;
}
getMessagesStorage().setDialogsPinned(arrayList5, arrayList6);
}
if (z5) {
if (z3) {
this.allDialogs.clear();
int size2 = this.dialogs_dict.size();
for (int i7 = 0; i7 < size2; i7++) {
TLRPC.Dialog valueAt = this.dialogs_dict.valueAt(i7);
if (this.deletingDialogs.indexOfKey(valueAt.id) < 0) {
this.allDialogs.add(valueAt);
}
}
}
sortDialogs(null);
z4 = false;
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
} else {
z4 = false;
}
getMessagesStorage().unpinAllDialogsExceptNew(arrayList4, i);
getMessagesStorage().putDialogs(tL_messages_dialogs, 1);
getUserConfig().setPinnedDialogsLoaded(i, true);
getUserConfig().saveConfig(z4);
}
public void generateJoinMessage(long chatId, boolean ignoreLeft) {
TLRPC.Chat chat = getChat(Long.valueOf(chatId));
if (chat == null || !ChatObject.isChannel(chatId, this.currentAccount)) {
return;
}
if ((!ChatObject.isNotInChat(chat) || ignoreLeft) && !chat.creator) {
TLRPC.TL_messageService tL_messageService = new TLRPC.TL_messageService();
((TLRPC.Message) tL_messageService).flags = 256;
int newMessageId = getUserConfig().getNewMessageId();
((TLRPC.Message) tL_messageService).id = newMessageId;
((TLRPC.Message) tL_messageService).local_id = newMessageId;
if ((chat instanceof TLRPC.TL_channel) && !ignoreLeft) {
((TLRPC.Message) tL_messageService).date = chat.date;
} else {
((TLRPC.Message) tL_messageService).date = getConnectionsManager().getCurrentTime();
}
TLRPC.TL_peerUser tL_peerUser = new TLRPC.TL_peerUser();
((TLRPC.Message) tL_messageService).from_id = tL_peerUser;
((TLRPC.Peer) tL_peerUser).user_id = getUserConfig().getClientUserId();
TLRPC.TL_peerChannel tL_peerChannel = new TLRPC.TL_peerChannel();
((TLRPC.Message) tL_messageService).peer_id = tL_peerChannel;
((TLRPC.Peer) tL_peerChannel).channel_id = chatId;
((TLRPC.Message) tL_messageService).dialog_id = -chatId;
((TLRPC.Message) tL_messageService).post = true;
TLRPC.TL_messageActionChatAddUser tL_messageActionChatAddUser = new TLRPC.TL_messageActionChatAddUser();
((TLRPC.Message) tL_messageService).action = tL_messageActionChatAddUser;
((TLRPC.MessageAction) tL_messageActionChatAddUser).users.add(Long.valueOf(getUserConfig().getClientUserId()));
getUserConfig().saveConfig(false);
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
arrayList2.add(tL_messageService);
arrayList.add(new MessageObject(this.currentAccount, tL_messageService, true, false));
getMessagesStorage().putMessages(arrayList2, true, true, false, 0, 0, 0L);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda129(this, chatId, arrayList));
}
}
public void lambda$generateJoinMessage$354(long j, ArrayList arrayList) {
updateInterfaceWithMessages(-j, arrayList, 0);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
public void deleteMessagesByPush(long dialogId, ArrayList<Integer> ids, long channelId) {
getMessagesStorage().getStorageQueue().postRunnable(new MessagesController$.ExternalSyntheticLambda166(this, ids, channelId, dialogId));
}
public void lambda$deleteMessagesByPush$356(ArrayList arrayList, long j, long j2) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda165(this, arrayList, j));
getMessagesStorage().deletePushMessages(j2, arrayList);
getMessagesStorage().updateDialogsWithDeletedMessages(j2, j, arrayList, getMessagesStorage().markMessagesAsDeleted(j2, arrayList, false, true, 0, 0), false);
}
public void lambda$deleteMessagesByPush$355(ArrayList arrayList, long j) {
getNotificationCenter().postNotificationName(NotificationCenter.messagesDeleted, new Object[]{arrayList, Long.valueOf(j), Boolean.FALSE});
if (j == 0) {
int size = arrayList.size();
for (int i = 0; i < size; i++) {
MessageObject messageObject = this.dialogMessagesByIds.get(((Integer) arrayList.get(i)).intValue());
if (messageObject != null) {
messageObject.deleted = true;
}
}
return;
}
ArrayList<MessageObject> arrayList2 = this.dialogMessage.get(-j);
if (arrayList2 != null) {
for (int i2 = 0; i2 < arrayList2.size(); i2++) {
MessageObject messageObject2 = arrayList2.get(i2);
int size2 = arrayList.size();
int i3 = 0;
while (true) {
if (i3 >= size2) {
break;
}
if (messageObject2.getId() == ((Integer) arrayList.get(i3)).intValue()) {
messageObject2.deleted = true;
break;
}
i3++;
}
}
}
}
public void checkChatInviter(long chatId, boolean createMessage) {
TLRPC.Chat chat = getChat(Long.valueOf(chatId));
if (!ChatObject.isChannel(chat) || chat.creator || this.gettingChatInviters.indexOfKey(chatId) >= 0) {
return;
}
this.gettingChatInviters.put(chatId, Boolean.TRUE);
TLRPC.TL_channels_getParticipant tL_channels_getParticipant = new TLRPC.TL_channels_getParticipant();
tL_channels_getParticipant.channel = getInputChannel(chatId);
tL_channels_getParticipant.participant = getInputPeer(getUserConfig().getClientUserId());
getConnectionsManager().sendRequest(tL_channels_getParticipant, new MessagesController$.ExternalSyntheticLambda429(this, chat, createMessage, chatId));
}
public void lambda$checkChatInviter$361(TLRPC.Chat chat, boolean z, long j, TLObject tLObject, TLRPC.TL_error tL_error) {
ArrayList arrayList;
TLRPC.TL_channels_channelParticipant tL_channels_channelParticipant = (TLRPC.TL_channels_channelParticipant) tLObject;
if (tL_channels_channelParticipant != null) {
TLRPC.TL_channelParticipantSelf tL_channelParticipantSelf = tL_channels_channelParticipant.participant;
if (tL_channelParticipantSelf instanceof TLRPC.TL_channelParticipantSelf) {
TLRPC.TL_channelParticipantSelf tL_channelParticipantSelf2 = tL_channelParticipantSelf;
if (chat.megagroup && getMessagesStorage().isMigratedChat(chat.id)) {
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda220(this, tL_channels_channelParticipant));
getMessagesStorage().putUsersAndChats(tL_channels_channelParticipant.users, tL_channels_channelParticipant.chats, true, true);
if (!z || Math.abs(getConnectionsManager().getCurrentTime() - tL_channels_channelParticipant.participant.date) >= 86400 || getMessagesStorage().hasInviteMeMessage(j)) {
arrayList = null;
} else {
TLRPC.TL_messageService tL_messageService = new TLRPC.TL_messageService();
((TLRPC.Message) tL_messageService).flags = 256;
int newMessageId = getUserConfig().getNewMessageId();
((TLRPC.Message) tL_messageService).id = newMessageId;
((TLRPC.Message) tL_messageService).local_id = newMessageId;
((TLRPC.Message) tL_messageService).date = tL_channels_channelParticipant.participant.date;
TLRPC.TL_peerUser tL_peerUser = new TLRPC.TL_peerUser();
((TLRPC.Message) tL_messageService).from_id = tL_peerUser;
((TLRPC.Peer) tL_peerUser).user_id = tL_channels_channelParticipant.participant.inviter_id;
TLRPC.TL_peerChannel tL_peerChannel = new TLRPC.TL_peerChannel();
((TLRPC.Message) tL_messageService).peer_id = tL_peerChannel;
((TLRPC.Peer) tL_peerChannel).channel_id = j;
((TLRPC.Message) tL_messageService).media_unread = true;
((TLRPC.Message) tL_messageService).unread = true;
((TLRPC.Message) tL_messageService).post = true;
if (!((TLRPC.ChannelParticipant) tL_channelParticipantSelf2).via_invite || ((TLRPC.ChannelParticipant) tL_channelParticipantSelf2).inviter_id != getUserConfig().getClientUserId()) {
((TLRPC.Message) tL_messageService).action = new TLRPC.TL_messageActionChatAddUser();
} else {
((TLRPC.Message) tL_messageService).action = new TLRPC.TL_messageActionChatJoinedByRequest();
}
((TLRPC.Message) tL_messageService).action.users.add(Long.valueOf(getUserConfig().getClientUserId()));
((TLRPC.Message) tL_messageService).dialog_id = -j;
getUserConfig().saveConfig(false);
arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
ConcurrentHashMap concurrentHashMap = new ConcurrentHashMap();
for (int i = 0; i < tL_channels_channelParticipant.users.size(); i++) {
TLRPC$User tLRPC$User = (TLRPC$User) tL_channels_channelParticipant.users.get(i);
concurrentHashMap.put(Long.valueOf(tLRPC$User.id), tLRPC$User);
}
arrayList2.add(tL_messageService);
arrayList.add(new MessageObject(this.currentAccount, tL_messageService, concurrentHashMap, true, false));
getMessagesStorage().getStorageQueue().postRunnable(new MessagesController$.ExternalSyntheticLambda159(this, arrayList));
getMessagesStorage().putMessages(arrayList2, true, true, false, 0, 0, 0L);
}
getMessagesStorage().saveChatInviter(j, tL_channels_channelParticipant.participant.inviter_id);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda135(this, j, arrayList, tL_channels_channelParticipant));
}
}
}
public void lambda$checkChatInviter$357(TLRPC.TL_channels_channelParticipant tL_channels_channelParticipant) {
putUsers(tL_channels_channelParticipant.users, false);
putChats(tL_channels_channelParticipant.chats, false);
}
public void lambda$checkChatInviter$358(ArrayList arrayList) {
getNotificationsController().processNewMessages(arrayList, true, false, (CountDownLatch) null);
}
public void lambda$checkChatInviter$359(ArrayList arrayList) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda163(this, arrayList));
}
public void lambda$checkChatInviter$360(long j, ArrayList arrayList, TLRPC.TL_channels_channelParticipant tL_channels_channelParticipant) {
this.gettingChatInviters.delete(j);
if (arrayList != null) {
updateInterfaceWithMessages(-j, arrayList, 0);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
getNotificationCenter().postNotificationName(NotificationCenter.didLoadChatInviter, new Object[]{Long.valueOf(j), Long.valueOf(tL_channels_channelParticipant.participant.inviter_id)});
}
private int getUpdateType(TLRPC$Update update) {
if ((update instanceof TLRPC.TL_updateNewMessage) || (update instanceof TLRPC.TL_updateReadMessagesContents) || (update instanceof TLRPC.TL_updateReadHistoryInbox) || (update instanceof TLRPC.TL_updateReadHistoryOutbox) || (update instanceof TLRPC.TL_updateDeleteMessages) || (update instanceof TLRPC.TL_updateWebPage) || (update instanceof TLRPC.TL_updateEditMessage) || (update instanceof TLRPC.TL_updateFolderPeers) || (update instanceof TLRPC.TL_updatePinnedMessages)) {
return 0;
}
if (update instanceof TLRPC.TL_updateNewEncryptedMessage) {
return 1;
}
return ((update instanceof TLRPC.TL_updateNewChannelMessage) || (update instanceof TLRPC.TL_updateDeleteChannelMessages) || (update instanceof TLRPC.TL_updateEditChannelMessage) || (update instanceof TLRPC.TL_updateChannelWebPage) || (update instanceof TLRPC.TL_updatePinnedChannelMessages)) ? 2 : 3;
}
private static int getUpdatePts(TLRPC$Update update) {
if (update instanceof TLRPC.TL_updateDeleteMessages) {
return ((TLRPC.TL_updateDeleteMessages) update).pts;
}
if (update instanceof TLRPC.TL_updateNewChannelMessage) {
return ((TLRPC.TL_updateNewChannelMessage) update).pts;
}
if (update instanceof TLRPC.TL_updateReadHistoryOutbox) {
return ((TLRPC.TL_updateReadHistoryOutbox) update).pts;
}
if (update instanceof TLRPC.TL_updateNewMessage) {
return ((TLRPC.TL_updateNewMessage) update).pts;
}
if (update instanceof TLRPC.TL_updateEditMessage) {
return ((TLRPC.TL_updateEditMessage) update).pts;
}
if (update instanceof TLRPC.TL_updateWebPage) {
return ((TLRPC.TL_updateWebPage) update).pts;
}
if (update instanceof TLRPC.TL_updateReadHistoryInbox) {
return ((TLRPC.TL_updateReadHistoryInbox) update).pts;
}
if (update instanceof TLRPC.TL_updateChannelWebPage) {
return ((TLRPC.TL_updateChannelWebPage) update).pts;
}
if (update instanceof TLRPC.TL_updateDeleteChannelMessages) {
return ((TLRPC.TL_updateDeleteChannelMessages) update).pts;
}
if (update instanceof TLRPC.TL_updateEditChannelMessage) {
return ((TLRPC.TL_updateEditChannelMessage) update).pts;
}
if (update instanceof TLRPC.TL_updateReadMessagesContents) {
return ((TLRPC.TL_updateReadMessagesContents) update).pts;
}
if (update instanceof TLRPC.TL_updateChannelTooLong) {
return ((TLRPC.TL_updateChannelTooLong) update).pts;
}
if (update instanceof TLRPC.TL_updateFolderPeers) {
return ((TLRPC.TL_updateFolderPeers) update).pts;
}
if (update instanceof TLRPC.TL_updatePinnedChannelMessages) {
return ((TLRPC.TL_updatePinnedChannelMessages) update).pts;
}
if (update instanceof TLRPC.TL_updatePinnedMessages) {
return ((TLRPC.TL_updatePinnedMessages) update).pts;
}
return 0;
}
private static int getUpdatePtsCount(TLRPC$Update update) {
if (update instanceof TLRPC.TL_updateDeleteMessages) {
return ((TLRPC.TL_updateDeleteMessages) update).pts_count;
}
if (update instanceof TLRPC.TL_updateNewChannelMessage) {
return ((TLRPC.TL_updateNewChannelMessage) update).pts_count;
}
if (update instanceof TLRPC.TL_updateReadHistoryOutbox) {
return ((TLRPC.TL_updateReadHistoryOutbox) update).pts_count;
}
if (update instanceof TLRPC.TL_updateNewMessage) {
return ((TLRPC.TL_updateNewMessage) update).pts_count;
}
if (update instanceof TLRPC.TL_updateEditMessage) {
return ((TLRPC.TL_updateEditMessage) update).pts_count;
}
if (update instanceof TLRPC.TL_updateWebPage) {
return ((TLRPC.TL_updateWebPage) update).pts_count;
}
if (update instanceof TLRPC.TL_updateReadHistoryInbox) {
return ((TLRPC.TL_updateReadHistoryInbox) update).pts_count;
}
if (update instanceof TLRPC.TL_updateChannelWebPage) {
return ((TLRPC.TL_updateChannelWebPage) update).pts_count;
}
if (update instanceof TLRPC.TL_updateDeleteChannelMessages) {
return ((TLRPC.TL_updateDeleteChannelMessages) update).pts_count;
}
if (update instanceof TLRPC.TL_updateEditChannelMessage) {
return ((TLRPC.TL_updateEditChannelMessage) update).pts_count;
}
if (update instanceof TLRPC.TL_updateReadMessagesContents) {
return ((TLRPC.TL_updateReadMessagesContents) update).pts_count;
}
if (update instanceof TLRPC.TL_updateFolderPeers) {
return ((TLRPC.TL_updateFolderPeers) update).pts_count;
}
if (update instanceof TLRPC.TL_updatePinnedChannelMessages) {
return ((TLRPC.TL_updatePinnedChannelMessages) update).pts_count;
}
if (update instanceof TLRPC.TL_updatePinnedMessages) {
return ((TLRPC.TL_updatePinnedMessages) update).pts_count;
}
return 0;
}
private static int getUpdateQts(TLRPC$Update update) {
if (update instanceof TLRPC.TL_updateNewEncryptedMessage) {
return ((TLRPC.TL_updateNewEncryptedMessage) update).qts;
}
return 0;
}
public static long getUpdateChannelId(TLRPC$Update update) {
if (update instanceof TLRPC.TL_updateNewChannelMessage) {
return ((TLRPC.TL_updateNewChannelMessage) update).message.peer_id.channel_id;
}
if (update instanceof TLRPC.TL_updateEditChannelMessage) {
return ((TLRPC.TL_updateEditChannelMessage) update).message.peer_id.channel_id;
}
if (update instanceof TLRPC.TL_updateReadChannelOutbox) {
return ((TLRPC.TL_updateReadChannelOutbox) update).channel_id;
}
if (update instanceof TLRPC.TL_updateChannelMessageViews) {
return ((TLRPC.TL_updateChannelMessageViews) update).channel_id;
}
if (update instanceof TLRPC.TL_updateChannelMessageForwards) {
return ((TLRPC.TL_updateChannelMessageForwards) update).channel_id;
}
if (update instanceof TLRPC.TL_updateChannelTooLong) {
return ((TLRPC.TL_updateChannelTooLong) update).channel_id;
}
if (update instanceof TLRPC.TL_updateChannelReadMessagesContents) {
return ((TLRPC.TL_updateChannelReadMessagesContents) update).channel_id;
}
if (update instanceof TLRPC.TL_updateChannelAvailableMessages) {
return ((TLRPC.TL_updateChannelAvailableMessages) update).channel_id;
}
if (update instanceof TLRPC.TL_updateChannel) {
return ((TLRPC.TL_updateChannel) update).channel_id;
}
if (update instanceof TLRPC.TL_updateChannelWebPage) {
return ((TLRPC.TL_updateChannelWebPage) update).channel_id;
}
if (update instanceof TLRPC.TL_updateDeleteChannelMessages) {
return ((TLRPC.TL_updateDeleteChannelMessages) update).channel_id;
}
if (update instanceof TLRPC.TL_updateReadChannelInbox) {
return ((TLRPC.TL_updateReadChannelInbox) update).channel_id;
}
if (update instanceof TLRPC.TL_updateChannelPinnedTopic) {
return ((TLRPC.TL_updateChannelPinnedTopic) update).channel_id;
}
if (update instanceof TLRPC.TL_updateChannelPinnedTopics) {
return ((TLRPC.TL_updateChannelPinnedTopics) update).channel_id;
}
if (update instanceof TLRPC.TL_updateReadChannelDiscussionInbox) {
return ((TLRPC.TL_updateReadChannelDiscussionInbox) update).channel_id;
}
if (update instanceof TLRPC.TL_updateReadChannelDiscussionOutbox) {
return ((TLRPC.TL_updateReadChannelDiscussionOutbox) update).channel_id;
}
if (update instanceof TLRPC.TL_updateChannelUserTyping) {
return ((TLRPC.TL_updateChannelUserTyping) update).channel_id;
}
if (update instanceof TLRPC.TL_updatePinnedChannelMessages) {
return ((TLRPC.TL_updatePinnedChannelMessages) update).channel_id;
}
if (update instanceof TLRPC.TL_updateChannelViewForumAsMessages) {
return ((TLRPC.TL_updateChannelViewForumAsMessages) update).channel_id;
}
if (!BuildVars.LOGS_ENABLED) {
return 0L;
}
FileLog.e("trying to get unknown update channel_id for " + update);
return 0L;
}
public void processUpdates(final org.telegram.tgnet.TLRPC.Updates r28, boolean r29) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.processUpdates(org.telegram.tgnet.TLRPC$Updates, boolean):void");
}
public void lambda$processUpdates$362(boolean z, long j, ArrayList arrayList) {
if (z) {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_USER_PRINT)});
}
updateInterfaceWithMessages(j, arrayList, 0);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
public void lambda$processUpdates$363(boolean z, TLRPC.Updates updates, ArrayList arrayList) {
if (z) {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_USER_PRINT)});
}
updateInterfaceWithMessages(-updates.chat_id, arrayList, 0);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
public void lambda$processUpdates$364(ArrayList arrayList) {
getNotificationsController().processNewMessages(arrayList, true, false, (CountDownLatch) null);
}
public void lambda$processUpdates$365(ArrayList arrayList) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda161(this, arrayList));
}
public void lambda$processUpdates$367() {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_STATUS)});
}
private boolean applyFoldersUpdates(ArrayList<TLRPC.TL_updateFolderPeers> folderUpdates) {
if (folderUpdates == null) {
return false;
}
int size = folderUpdates.size();
int i = 0;
boolean z = false;
while (i < size) {
TLRPC.TL_updateFolderPeers tL_updateFolderPeers = folderUpdates.get(i);
int size2 = tL_updateFolderPeers.folder_peers.size();
for (int i2 = 0; i2 < size2; i2++) {
TLRPC.TL_folderPeer tL_folderPeer = (TLRPC.TL_folderPeer) tL_updateFolderPeers.folder_peers.get(i2);
TLRPC.Dialog dialog = this.dialogs_dict.get(DialogObject.getPeerDialogId(tL_folderPeer.peer));
if (dialog != null) {
int i3 = dialog.folder_id;
int i4 = tL_folderPeer.folder_id;
if (i3 != i4) {
dialog.pinned = false;
dialog.pinnedNum = 0;
dialog.folder_id = i4;
this.hasArchivedChats = true;
checkArchiveFolder();
}
}
}
getMessagesStorage().setDialogsFolderId(folderUpdates.get(i).folder_peers, (ArrayList) null, 0L, 0);
i++;
z = true;
}
return z;
}
public boolean processUpdateArray(java.util.ArrayList<org.telegram.tgnet.TLRPC$Update> r76, java.util.ArrayList<org.telegram.tgnet.TLRPC$User> r77, java.util.ArrayList<org.telegram.tgnet.TLRPC.Chat> r78, boolean r79, int r80) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.processUpdateArray(java.util.ArrayList, java.util.ArrayList, java.util.ArrayList, boolean, int):boolean");
}
public void lambda$processUpdateArray$368(ArrayList arrayList, ArrayList arrayList2) {
putUsers(arrayList, false);
putChats(arrayList2, false);
}
public void lambda$processUpdateArray$369(ArrayList arrayList, ArrayList arrayList2) {
putUsers(arrayList, false);
putChats(arrayList2, false);
}
public void lambda$processUpdateArray$370(TLRPC.TL_updateUserTyping tL_updateUserTyping) {
getNotificationCenter().postNotificationName(NotificationCenter.onEmojiInteractionsReceived, new Object[]{Long.valueOf(tL_updateUserTyping.user_id), tL_updateUserTyping.action});
}
public void lambda$processUpdateArray$371(TLRPC.TL_updateChatUserTyping tL_updateChatUserTyping) {
getNotificationCenter().postNotificationName(NotificationCenter.onEmojiInteractionsReceived, new Object[]{Long.valueOf(-tL_updateChatUserTyping.chat_id), tL_updateChatUserTyping.action});
}
public void lambda$processUpdateArray$373(TLRPC.TL_updatePeerBlocked tL_updatePeerBlocked) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda245(this, tL_updatePeerBlocked));
}
public void lambda$processUpdateArray$372(TLRPC.TL_updatePeerBlocked tL_updatePeerBlocked) {
long peerId = MessageObject.getPeerId(tL_updatePeerBlocked.peer_id);
if (tL_updatePeerBlocked.blocked) {
if (this.blockePeers.indexOfKey(peerId) < 0) {
this.blockePeers.put(peerId, 1);
}
} else {
this.blockePeers.delete(peerId);
}
DatabaseManager.getInstance().addUpdate((TLRPC$User) null, tL_updatePeerBlocked);
getNotificationCenter().postNotificationName(NotificationCenter.blockedUsersDidLoad, new Object[0]);
getStoriesController().updateBlockUser(peerId, tL_updatePeerBlocked.blocked_my_stories_from, false);
}
public void lambda$processUpdateArray$374(TLRPC.TL_updateServiceNotification tL_updateServiceNotification) {
getNotificationCenter().postNotificationName(NotificationCenter.needShowAlert, new Object[]{2, tL_updateServiceNotification.message, tL_updateServiceNotification.type});
}
public void lambda$processUpdateArray$375(TLRPC.Message message) {
getSendMessagesHelper().onMessageEdited(message);
}
public void lambda$processUpdateArray$376(TLRPC.TL_updateLangPack tL_updateLangPack) {
LocaleController.getInstance().saveRemoteLocaleStringsForCurrentLocale(tL_updateLangPack.difference, this.currentAccount);
}
public void lambda$processUpdateArray$377(ArrayList arrayList) {
getNotificationsController().processNewMessages(arrayList, true, false, (CountDownLatch) null);
}
public void lambda$processUpdateArray$378(ArrayList arrayList) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda157(this, arrayList));
}
public void lambda$processUpdateArray$380(LongSparseArray longSparseArray) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda146(this, longSparseArray));
}
public void lambda$processUpdateArray$379(LongSparseArray longSparseArray) {
getNotificationsController().processEditedMessages(longSparseArray);
getTopicsController().processEditedMessages(longSparseArray);
}
public void lambda$processUpdateArray$381(TLRPC$User tLRPC$User) {
getContactsController().addContactToPhoneBook(tLRPC$User, true);
}
public void lambda$processUpdateArray$382() {
getNotificationsController().deleteNotificationChannelGlobal(0);
}
public void lambda$processUpdateArray$383() {
getNotificationsController().deleteNotificationChannelGlobal(1);
}
public void lambda$processUpdateArray$384() {
getNotificationsController().deleteNotificationChannelGlobal(2);
}
public void lambda$processUpdateArray$385(TLRPC.TL_updateChannel tL_updateChannel) {
getChannelDifference(tL_updateChannel.channel_id, 1, 0L, null);
}
public void lambda$processUpdateArray$386(TLRPC.Chat chat) {
getNotificationCenter().postNotificationName(NotificationCenter.channelRightsUpdated, new Object[]{chat});
}
public void lambda$processUpdateArray$387(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
processUpdates((TLRPC.Updates) tLObject, false);
}
}
public void lambda$processUpdateArray$388(int r43, java.util.ArrayList r44, java.util.ArrayList r45, androidx.collection.LongSparseArray r46, int r47, org.telegram.messenger.support.LongSparseIntArray r48, androidx.collection.LongSparseArray r49, androidx.collection.LongSparseArray r50, java.util.ArrayList r51, androidx.collection.LongSparseArray r52, androidx.collection.LongSparseArray r53, boolean r54, java.util.ArrayList r55, java.util.ArrayList r56, androidx.collection.LongSparseArray r57, androidx.collection.LongSparseArray r58, androidx.collection.LongSparseArray r59, java.util.ArrayList r60) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$processUpdateArray$388(int, java.util.ArrayList, java.util.ArrayList, androidx.collection.LongSparseArray, int, org.telegram.messenger.support.LongSparseIntArray, androidx.collection.LongSparseArray, androidx.collection.LongSparseArray, java.util.ArrayList, androidx.collection.LongSparseArray, androidx.collection.LongSparseArray, boolean, java.util.ArrayList, java.util.ArrayList, androidx.collection.LongSparseArray, androidx.collection.LongSparseArray, androidx.collection.LongSparseArray, java.util.ArrayList):void");
}
public void lambda$processUpdateArray$390(LongSparseIntArray longSparseIntArray, LongSparseIntArray longSparseIntArray2, SparseIntArray sparseIntArray, LongSparseArray longSparseArray, LongSparseArray longSparseArray2, LongSparseArray longSparseArray3, LongSparseArray longSparseArray4, LongSparseIntArray longSparseIntArray3, ArrayList arrayList) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda187(this, longSparseIntArray, longSparseIntArray2, sparseIntArray, longSparseArray, longSparseArray2, longSparseArray3, longSparseArray4, longSparseIntArray3, arrayList));
}
public void lambda$processUpdateArray$389(org.telegram.messenger.support.LongSparseIntArray r22, org.telegram.messenger.support.LongSparseIntArray r23, android.util.SparseIntArray r24, androidx.collection.LongSparseArray r25, androidx.collection.LongSparseArray r26, androidx.collection.LongSparseArray r27, androidx.collection.LongSparseArray r28, org.telegram.messenger.support.LongSparseIntArray r29, java.util.ArrayList r30) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$processUpdateArray$389(org.telegram.messenger.support.LongSparseIntArray, org.telegram.messenger.support.LongSparseIntArray, android.util.SparseIntArray, androidx.collection.LongSparseArray, androidx.collection.LongSparseArray, androidx.collection.LongSparseArray, androidx.collection.LongSparseArray, org.telegram.messenger.support.LongSparseIntArray, java.util.ArrayList):void");
}
public void lambda$processUpdateArray$391(long j, ArrayList arrayList) {
getMessagesStorage().updateDialogsWithDeletedMessages(j, -j, arrayList, getMessagesStorage().markMessagesAsDeleted(j, arrayList, false, true, 0, 0), false);
}
public void lambda$processUpdateArray$392(long j, ArrayList arrayList, long j2) {
getMessagesStorage().updateDialogsWithDeletedMessages(j, -j, arrayList, getMessagesStorage().markMessagesAsDeleted(j, arrayList, false, true, 5, (int) j2), false);
}
public void lambda$processUpdateArray$393(long j, int i) {
getMessagesStorage().updateDialogsWithDeletedMessages(j, -j, new ArrayList(), getMessagesStorage().markMessagesAsDeleted(j, i, false, true), false);
}
public void checkUnreadReactions(long dialogId, long topicId, SparseBooleanArray unreadReactions) {
getMessagesStorage().getStorageQueue().postRunnable(new MessagesController$.ExternalSyntheticLambda143(this, unreadReactions, topicId, dialogId));
}
public void lambda$checkUnreadReactions$399(SparseBooleanArray sparseBooleanArray, long j, long j2) {
int i;
SQLiteCursor queryFinalized;
ArrayList arrayList = new ArrayList();
StringBuilder sb = new StringBuilder();
for (int i2 = 0; i2 < sparseBooleanArray.size(); i2++) {
int keyAt = sparseBooleanArray.keyAt(i2);
if (sb.length() > 0) {
sb.append(", ");
}
sb.append(keyAt);
}
SparseBooleanArray sparseBooleanArray2 = new SparseBooleanArray();
try {
if (j != 0) {
queryFinalized = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT message_id, state FROM reaction_mentions WHERE message_id IN (%s) AND dialog_id = %d", sb, Long.valueOf(j2)), new Object[0]);
} else {
queryFinalized = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT message_id, state FROM reaction_mentions_topics WHERE message_id IN (%s) AND dialog_id = %d AND topic_id = %d", sb, Long.valueOf(j2), Long.valueOf(j)), new Object[0]);
}
while (queryFinalized.next()) {
sparseBooleanArray2.put(queryFinalized.intValue(0), queryFinalized.intValue(1) == 1);
}
queryFinalized.dispose();
} catch (SQLiteException e) {
e.printStackTrace();
}
int i3 = 0;
int i4 = 0;
boolean z = false;
boolean z2 = false;
while (i4 < sparseBooleanArray.size()) {
int keyAt2 = sparseBooleanArray.keyAt(i4);
boolean valueAt = sparseBooleanArray.valueAt(i4);
if (sparseBooleanArray2.indexOfKey(keyAt2) < 0) {
i = i3;
z = true;
} else if (sparseBooleanArray2.get(keyAt2) != valueAt) {
i = i3 + (valueAt ? 1 : -1);
z2 = true;
} else {
i = i3;
}
if (valueAt) {
arrayList.add(Integer.valueOf(keyAt2));
}
if (j == 0) {
try {
try {
SQLitePreparedStatement executeFast = getMessagesStorage().getDatabase().executeFast("REPLACE INTO reaction_mentions VALUES(?, ?, ?)");
executeFast.requery();
executeFast.bindInteger(1, keyAt2);
executeFast.bindInteger(2, valueAt ? 1 : 0);
executeFast.bindLong(3, j2);
executeFast.step();
executeFast.dispose();
} catch (SQLiteException e2) {
e = e2;
e.printStackTrace();
i4++;
i3 = i;
}
} catch (SQLiteException e3) {
e = e3;
}
} else {
SQLitePreparedStatement executeFast2 = getMessagesStorage().getDatabase().executeFast("REPLACE INTO reaction_mentions_topics VALUES(?, ?, ?, ?)");
executeFast2.requery();
executeFast2.bindInteger(1, keyAt2);
try {
executeFast2.bindInteger(2, valueAt ? 1 : 0);
executeFast2.bindLong(3, j2);
executeFast2.bindLong(4, j);
executeFast2.step();
executeFast2.dispose();
} catch (SQLiteException e4) {
e = e4;
e.printStackTrace();
i4++;
i3 = i;
}
}
i4++;
i3 = i;
}
if (!z) {
if (z2) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda119(this, j, j2, i3));
}
} else {
if (j == 0) {
TLObject tL_messages_getPeerDialogs = new TLRPC.TL_messages_getPeerDialogs();
TLRPC.TL_inputDialogPeer tL_inputDialogPeer = new TLRPC.TL_inputDialogPeer();
tL_inputDialogPeer.peer = getInputPeer(j2);
((TLRPC.TL_messages_getPeerDialogs) tL_messages_getPeerDialogs).peers.add(tL_inputDialogPeer);
ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_messages_getPeerDialogs, new MessagesController$.ExternalSyntheticLambda397(this, j2, j, arrayList));
return;
}
TLObject tL_channels_getForumTopicsByID = new TLRPC.TL_channels_getForumTopicsByID();
((TLRPC.TL_channels_getForumTopicsByID) tL_channels_getForumTopicsByID).topics.add(Integer.valueOf((int) j));
((TLRPC.TL_channels_getForumTopicsByID) tL_channels_getForumTopicsByID).channel = getMessagesController().getInputChannel(-j2);
ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_channels_getForumTopicsByID, new MessagesController$.ExternalSyntheticLambda396(this, j2, j, arrayList));
}
}
public void lambda$checkUnreadReactions$395(long j, long j2, ArrayList arrayList, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
TLRPC.TL_messages_peerDialogs tL_messages_peerDialogs = (TLRPC.TL_messages_peerDialogs) tLObject;
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda113(this, j, tL_messages_peerDialogs.dialogs.size() == 0 ? 0 : ((TLRPC.Dialog) tL_messages_peerDialogs.dialogs.get(0)).unread_reactions_count, j2, arrayList));
}
}
public void lambda$checkUnreadReactions$394(long j, int i, long j2, ArrayList arrayList) {
TLRPC.Dialog dialog = this.dialogs_dict.get(j);
if (dialog == null) {
getMessagesStorage().updateDialogUnreadReactions(j, 0L, i, false);
return;
}
dialog.unread_reactions_count = i;
getMessagesStorage().updateUnreadReactionsCount(j, j2, i);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsUnreadReactionsCounterChanged, new Object[]{Long.valueOf(j), Long.valueOf(j2), Integer.valueOf(i), arrayList});
}
public void lambda$checkUnreadReactions$397(long j, long j2, ArrayList arrayList, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
TLRPC.TL_messages_forumTopics tL_messages_forumTopics = (TLRPC.TL_messages_forumTopics) tLObject;
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda121(this, j, j2, tL_messages_forumTopics.topics.size() == 0 ? 0 : ((TLRPC.TL_forumTopic) tL_messages_forumTopics.topics.get(0)).unread_reactions_count, arrayList));
}
}
public void lambda$checkUnreadReactions$396(long j, long j2, int i, ArrayList arrayList) {
getMessagesController().getTopicsController().updateReactionsUnread(j, j2, i, false);
getMessagesStorage().updateUnreadReactionsCount(j, j2, i);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsUnreadReactionsCounterChanged, new Object[]{Long.valueOf(j), Long.valueOf(j2), Integer.valueOf(i), arrayList});
}
public void lambda$checkUnreadReactions$398(long j, long j2, int i) {
if (j == 0) {
TLRPC.Dialog dialog = this.dialogs_dict.get(j2);
if (dialog == null) {
getMessagesStorage().updateDialogUnreadReactions(j2, 0L, i, true);
return;
}
int i2 = dialog.unread_reactions_count + i;
dialog.unread_reactions_count = i2;
if (i2 < 0) {
dialog.unread_reactions_count = 0;
}
getMessagesStorage().updateUnreadReactionsCount(j2, 0L, dialog.unread_reactions_count);
return;
}
int updateReactionsUnread = getMessagesController().getTopicsController().updateReactionsUnread(j2, j, i, true);
if (updateReactionsUnread >= 0) {
getMessagesStorage().updateUnreadReactionsCount(j2, j, updateReactionsUnread, true);
}
}
public boolean isDialogMuted(long dialogId, long topicId) {
return isDialogMuted(dialogId, topicId, null);
}
public boolean isDialogNotificationsSoundEnabled(long dialogId, long topicId) {
return this.notificationsPreferences.getBoolean("sound_enabled_" + NotificationsController.getSharedPrefKey(dialogId, topicId), true);
}
public boolean isDialogMuted(long dialogId, long topicId, TLRPC.Chat chat) {
Boolean bool;
int i = this.notificationsPreferences.getInt("notify2_" + NotificationsController.getSharedPrefKey(dialogId, topicId), -1);
boolean z = false;
if (i == -1) {
if (chat != null) {
if (ChatObject.isChannel(chat) && !chat.megagroup) {
z = true;
}
bool = Boolean.valueOf(z);
} else {
bool = null;
}
Boolean bool2 = bool;
if (topicId != 0) {
return isDialogMuted(dialogId, 0L, chat);
}
return !getNotificationsController().isGlobalNotificationsEnabled(dialogId, bool2, false, false);
}
if (i == 2) {
return true;
}
if (i == 3) {
if (this.notificationsPreferences.getInt("notifyuntil_" + NotificationsController.getSharedPrefKey(dialogId, topicId), 0) >= getConnectionsManager().getCurrentTime()) {
return true;
}
}
return false;
}
public void markReactionsAsRead(long dialogId, long topicId) {
if (topicId == 0) {
TLRPC.Dialog dialog = this.dialogs_dict.get(dialogId);
if (dialog != null) {
dialog.unread_reactions_count = 0;
}
} else {
this.topicsController.markAllReactionsAsRead(-dialogId, topicId);
}
getMessagesStorage().updateUnreadReactionsCount(dialogId, topicId, 0);
TLRPC.TL_messages_readReactions tL_messages_readReactions = new TLRPC.TL_messages_readReactions();
tL_messages_readReactions.peer = getInputPeer(dialogId);
if (topicId != 0) {
tL_messages_readReactions.top_msg_id = (int) topicId;
}
getConnectionsManager().sendRequest(tL_messages_readReactions, MessagesController$.ExternalSyntheticLambda468.INSTANCE);
NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_REACTIONS_READ)});
}
public SponsoredMessagesInfo getSponsoredMessages(long dialogId) {
SponsoredMessagesInfo sponsoredMessagesInfo = this.sponsoredMessages.get(dialogId);
if (sponsoredMessagesInfo != null && (sponsoredMessagesInfo.loading || Math.abs(SystemClock.elapsedRealtime() - sponsoredMessagesInfo.loadTime) <= 300000)) {
return sponsoredMessagesInfo;
}
TLRPC.Chat chat = getChat(Long.valueOf(-dialogId));
if (!ChatObject.isChannel(chat)) {
return null;
}
SponsoredMessagesInfo sponsoredMessagesInfo2 = new SponsoredMessagesInfo(this);
sponsoredMessagesInfo2.loading = true;
this.sponsoredMessages.put(dialogId, sponsoredMessagesInfo2);
TLRPC.TL_channels_getSponsoredMessages tL_channels_getSponsoredMessages = new TLRPC.TL_channels_getSponsoredMessages();
tL_channels_getSponsoredMessages.channel = getInputChannel(chat);
getConnectionsManager().sendRequest(tL_channels_getSponsoredMessages, new MessagesController$.ExternalSyntheticLambda406(this, dialogId, sponsoredMessagesInfo2));
return null;
}
public void lambda$getSponsoredMessages$403(long j, SponsoredMessagesInfo sponsoredMessagesInfo, TLObject tLObject, TLRPC.TL_error tL_error) {
?? r6;
ArrayList arrayList;
ArrayList arrayList2 = null;
if (tLObject instanceof TLRPC.messages_SponsoredMessages) {
TLRPC.messages_SponsoredMessages messages_sponsoredmessages = (TLRPC.messages_SponsoredMessages) tLObject;
if (messages_sponsoredmessages.messages.isEmpty()) {
arrayList = null;
} else {
if ((messages_sponsoredmessages instanceof TLRPC.TL_messages_sponsoredMessages) && (messages_sponsoredmessages.flags & 1) > 0) {
arrayList2 = Integer.valueOf(messages_sponsoredmessages.posts_between);
}
ArrayList arrayList3 = new ArrayList();
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda264(this, messages_sponsoredmessages));
LongSparseArray longSparseArray = new LongSparseArray();
LongSparseArray longSparseArray2 = new LongSparseArray();
int i = 0;
for (int i2 = 0; i2 < messages_sponsoredmessages.users.size(); i2++) {
TLRPC$User tLRPC$User = (TLRPC$User) messages_sponsoredmessages.users.get(i2);
longSparseArray.put(tLRPC$User.id, tLRPC$User);
}
for (int i3 = 0; i3 < messages_sponsoredmessages.chats.size(); i3++) {
TLRPC.Chat chat = (TLRPC.Chat) messages_sponsoredmessages.chats.get(i3);
longSparseArray2.put(chat.id, chat);
}
int i4 = -10000000;
int size = messages_sponsoredmessages.messages.size();
while (i < size) {
TLRPC.TL_sponsoredMessage tL_sponsoredMessage = (TLRPC.TL_sponsoredMessage) messages_sponsoredmessages.messages.get(i);
TLRPC.TL_message tL_message = new TLRPC.TL_message();
((TLRPC.Message) tL_message).message = tL_sponsoredMessage.message;
if (!tL_sponsoredMessage.entities.isEmpty()) {
((TLRPC.Message) tL_message).entities = tL_sponsoredMessage.entities;
((TLRPC.Message) tL_message).flags |= ConnectionsManager.RequestFlagNeedQuickAck;
}
((TLRPC.Message) tL_message).peer_id = getPeer(j);
((TLRPC.Message) tL_message).flags |= 256;
((TLRPC.Message) tL_message).date = getConnectionsManager().getCurrentTime();
int i5 = i4 - 1;
((TLRPC.Message) tL_message).id = i4;
MessageObject messageObject = new MessageObject(this.currentAccount, tL_message, longSparseArray, longSparseArray2, true, true);
messageObject.sponsoredId = tL_sponsoredMessage.random_id;
messageObject.sponsoredTitle = tL_sponsoredMessage.title;
messageObject.sponsoredUrl = tL_sponsoredMessage.url;
messageObject.sponsoredRecommended = tL_sponsoredMessage.recommended;
messageObject.sponsoredPhoto = tL_sponsoredMessage.photo;
messageObject.sponsoredInfo = tL_sponsoredMessage.sponsor_info;
messageObject.sponsoredAdditionalInfo = tL_sponsoredMessage.additional_info;
messageObject.sponsoredButtonText = tL_sponsoredMessage.button_text;
messageObject.sponsoredCanReport = tL_sponsoredMessage.can_report;
messageObject.sponsoredColor = tL_sponsoredMessage.color;
arrayList3.add(messageObject);
i++;
messages_sponsoredmessages = messages_sponsoredmessages;
i4 = i5;
}
arrayList = arrayList2;
arrayList2 = arrayList3;
}
r6 = arrayList;
} else {
r6 = 0;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda168(this, arrayList2, j, sponsoredMessagesInfo, (Integer) r6));
}
public void lambda$getSponsoredMessages$401(TLRPC.messages_SponsoredMessages messages_sponsoredmessages) {
putUsers(messages_sponsoredmessages.users, false);
putChats(messages_sponsoredmessages.chats, false);
}
public void lambda$getSponsoredMessages$402(ArrayList arrayList, long j, SponsoredMessagesInfo sponsoredMessagesInfo, Integer num) {
if (arrayList == null) {
this.sponsoredMessages.remove(j);
return;
}
sponsoredMessagesInfo.loadTime = SystemClock.elapsedRealtime();
sponsoredMessagesInfo.messages = arrayList;
sponsoredMessagesInfo.posts_between = num;
getNotificationCenter().postNotificationName(NotificationCenter.didLoadSponsoredMessages, new Object[]{Long.valueOf(j), arrayList});
}
public void clearSendAsPeers() {
this.sendAsPeers.clear();
}
public TLRPC.TL_channels_sendAsPeers getSendAsPeers(long dialogId) {
SendAsPeersInfo sendAsPeersInfo = this.sendAsPeers.get(dialogId);
if (sendAsPeersInfo != null && (SendAsPeersInfo.-$$Nest$fgetloading(sendAsPeersInfo) || Math.abs(SystemClock.elapsedRealtime() - SendAsPeersInfo.-$$Nest$fgetloadTime(sendAsPeersInfo)) <= 300000)) {
return SendAsPeersInfo.-$$Nest$fgetsendAsPeers(sendAsPeersInfo);
}
TLRPC.Chat chat = getChat(Long.valueOf(-dialogId));
if (chat != null && ChatObject.canSendAsPeers(chat)) {
SendAsPeersInfo sendAsPeersInfo2 = new SendAsPeersInfo(this, (SendAsPeersInfo-IA) null);
SendAsPeersInfo.-$$Nest$fputloading(sendAsPeersInfo2, true);
this.sendAsPeers.put(dialogId, sendAsPeersInfo2);
TLRPC.TL_channels_getSendAs tL_channels_getSendAs = new TLRPC.TL_channels_getSendAs();
tL_channels_getSendAs.peer = getInputPeer(dialogId);
getConnectionsManager().sendRequest(tL_channels_getSendAs, new MessagesController$.ExternalSyntheticLambda405(this, dialogId, sendAsPeersInfo2));
}
return null;
}
public void lambda$getSendAsPeers$406(long j, SendAsPeersInfo sendAsPeersInfo, TLObject tLObject, TLRPC.TL_error tL_error) {
TLRPC.TL_channels_sendAsPeers tL_channels_sendAsPeers = null;
if (tLObject != null) {
TLRPC.TL_channels_sendAsPeers tL_channels_sendAsPeers2 = (TLRPC.TL_channels_sendAsPeers) tLObject;
if (!tL_channels_sendAsPeers2.peers.isEmpty()) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda222(this, tL_channels_sendAsPeers2));
LongSparseArray longSparseArray = new LongSparseArray();
LongSparseArray longSparseArray2 = new LongSparseArray();
for (int i = 0; i < tL_channels_sendAsPeers2.users.size(); i++) {
TLRPC$User tLRPC$User = (TLRPC$User) tL_channels_sendAsPeers2.users.get(i);
longSparseArray.put(tLRPC$User.id, tLRPC$User);
}
for (int i2 = 0; i2 < tL_channels_sendAsPeers2.chats.size(); i2++) {
TLRPC.Chat chat = (TLRPC.Chat) tL_channels_sendAsPeers2.chats.get(i2);
longSparseArray2.put(chat.id, chat);
}
tL_channels_sendAsPeers = tL_channels_sendAsPeers2;
}
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda223(this, tL_channels_sendAsPeers, j, sendAsPeersInfo));
}
public void lambda$getSendAsPeers$404(TLRPC.TL_channels_sendAsPeers tL_channels_sendAsPeers) {
putUsers(tL_channels_sendAsPeers.users, false);
putChats(tL_channels_sendAsPeers.chats, false);
}
public void lambda$getSendAsPeers$405(TLRPC.TL_channels_sendAsPeers tL_channels_sendAsPeers, long j, SendAsPeersInfo sendAsPeersInfo) {
if (tL_channels_sendAsPeers == null) {
this.sendAsPeers.remove(j);
return;
}
SendAsPeersInfo.-$$Nest$fputloadTime(sendAsPeersInfo, SystemClock.elapsedRealtime());
SendAsPeersInfo.-$$Nest$fputsendAsPeers(sendAsPeersInfo, tL_channels_sendAsPeers);
getNotificationCenter().postNotificationName(NotificationCenter.didLoadSendAsPeers, new Object[]{Long.valueOf(j), tL_channels_sendAsPeers});
}
public TLRPC.Peer getSendAsSelectedPeer(long dialogId) {
TLRPC.Peer peer;
TLRPC.ChatFull chatFull = getChatFull(-dialogId);
if (chatFull != null && (peer = chatFull.default_send_as) != null) {
return peer;
}
TLRPC.TL_peerUser tL_peerUser = new TLRPC.TL_peerUser();
((TLRPC.Peer) tL_peerUser).user_id = getAccountInstance().getUserConfig().clientUserId;
return tL_peerUser;
}
public CharSequence getPrintingString(long dialogId, long threadId, boolean isDialog) {
LongSparseArray<CharSequence> longSparseArray;
TLRPC$User user;
TLRPC.UserStatus userStatus;
if ((!isDialog || !DialogObject.isUserDialog(dialogId) || (user = getUser(Long.valueOf(dialogId))) == null || (userStatus = user.status) == null || userStatus.expires >= 0) && (longSparseArray = this.printingStrings.get(dialogId)) != null) {
return longSparseArray.get(threadId);
}
return null;
}
public Integer getPrintingStringType(long dialogId, long threadId) {
LongSparseArray<Integer> longSparseArray = this.printingStringsTypes.get(dialogId);
if (longSparseArray == null) {
return null;
}
return longSparseArray.get(threadId);
}
private boolean updatePrintingUsersWithNewMessages(long uid, ArrayList<MessageObject> messages) {
boolean z;
if (uid > 0) {
if (((ConcurrentHashMap) this.printingUsers.get(Long.valueOf(uid))) != null) {
this.printingUsers.remove(Long.valueOf(uid));
return true;
}
} else if (uid < 0) {
ArrayList arrayList = new ArrayList();
Iterator<MessageObject> it = messages.iterator();
while (it.hasNext()) {
MessageObject next = it.next();
if (next.isFromUser() && !arrayList.contains(Long.valueOf(next.messageOwner.from_id.user_id))) {
arrayList.add(Long.valueOf(next.messageOwner.from_id.user_id));
}
}
ConcurrentHashMap concurrentHashMap = (ConcurrentHashMap) this.printingUsers.get(Long.valueOf(uid));
if (concurrentHashMap != null) {
ArrayList arrayList2 = null;
z = false;
for (Map.Entry entry : concurrentHashMap.entrySet()) {
Integer num = (Integer) entry.getKey();
ArrayList arrayList3 = (ArrayList) entry.getValue();
int i = 0;
while (i < arrayList3.size()) {
if (arrayList.contains(Long.valueOf(((PrintingUser) arrayList3.get(i)).userId))) {
arrayList3.remove(i);
i--;
if (arrayList3.isEmpty()) {
if (arrayList2 == null) {
arrayList2 = new ArrayList();
}
arrayList2.add(num);
}
z = true;
}
i++;
}
}
if (arrayList2 != null) {
int size = arrayList2.size();
for (int i2 = 0; i2 < size; i2++) {
concurrentHashMap.remove(arrayList2.get(i2));
}
if (concurrentHashMap.isEmpty()) {
this.printingUsers.remove(Long.valueOf(uid));
}
}
} else {
z = false;
}
if (z) {
return true;
}
}
return false;
}
public boolean updateInterfaceWithMessages(long r27, java.util.ArrayList<org.telegram.messenger.MessageObject> r29, int r30) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.updateInterfaceWithMessages(long, java.util.ArrayList, int):boolean");
}
public void lambda$updateInterfaceWithMessages$407(TLRPC.Dialog dialog, int i, long j, int i2) {
if (i2 == -1) {
if (i <= 0 || DialogObject.isEncryptedDialog(j)) {
return;
}
loadUnknownDialog(getInputPeer(j), 0L);
return;
}
if (i2 != 0) {
dialog.folder_id = i2;
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[]{Boolean.TRUE});
}
}
public TLRPC.Dialog getDialog(long did) {
return this.dialogs_dict.get(did);
}
public void addDialogAction(long did, boolean clean) {
TLRPC.Dialog dialog = this.dialogs_dict.get(did);
if (dialog == null) {
return;
}
if (clean) {
this.clearingHistoryDialogs.put(did, dialog);
} else {
this.deletingDialogs.put(did, dialog);
this.allDialogs.remove(dialog);
sortDialogs(null);
}
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[]{Boolean.TRUE});
}
public void removeDialogAction(long did, boolean clean, boolean apply) {
TLRPC.Dialog dialog = this.dialogs_dict.get(did);
if (dialog == null) {
return;
}
if (clean) {
this.clearingHistoryDialogs.remove(did);
} else {
this.deletingDialogs.remove(did);
if (!apply) {
this.allDialogs.add(dialog);
sortDialogs(null);
}
}
if (apply) {
return;
}
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[]{Boolean.TRUE});
}
public boolean isClearingDialog(long did) {
return this.clearingHistoryDialogs.get(did) != null;
}
public void sortDialogs(androidx.collection.LongSparseArray<org.telegram.tgnet.TLRPC.Chat> r18) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.sortDialogs(androidx.collection.LongSparseArray):void");
}
public void updateFilterDialogs(DialogFilter filter) {
TLRPC.EncryptedChat encryptedChat;
if (filter == null) {
return;
}
ArrayList arrayList = filter.dialogs;
ArrayList arrayList2 = filter.dialogsForward;
arrayList.clear();
arrayList2.clear();
this.sortingDialogFilter = filter;
try {
Collections.sort(this.allDialogs, this.dialogDateComparator);
} catch (Exception e) {
FileLog.e(e);
}
int size = this.allDialogs.size();
for (int i = 0; i < size; i++) {
TLRPC.Dialog dialog = this.allDialogs.get(i);
if (dialog instanceof TLRPC.TL_dialog) {
long j = dialog.id;
if (DialogObject.isEncryptedDialog(j) && (encryptedChat = getEncryptedChat(Integer.valueOf(DialogObject.getEncryptedChatId(j)))) != null) {
j = encryptedChat.user_id;
}
if (filter.includesDialog(getAccountInstance(), j, dialog)) {
if (canAddToForward(dialog)) {
arrayList2.add(dialog);
}
arrayList.add(dialog);
}
}
}
try {
Collections.sort(this.allDialogs, this.dialogComparator);
} catch (Exception unused) {
}
}
public boolean canAddToForward(TLRPC.Dialog d) {
boolean z = false;
if (d == null) {
return false;
}
if (DialogObject.isEncryptedDialog(d.id) || !DialogObject.isChannel(d)) {
return true;
}
TLRPC.Chat chat = getChat(Long.valueOf(-d.id));
if (chat == null || !chat.megagroup ? !(!ChatObject.hasAdminRights(chat) || !ChatObject.canPost(chat)) : !(chat.gigagroup && !ChatObject.hasAdminRights(chat))) {
z = true;
}
return z;
}
public void fixWrongHiddenFolder() {
if (getGlobalMainSettings().getBoolean("fixWrongHiddenFolder", false)) {
return;
}
int size = this.allDialogs.size();
for (int i = 0; i < size; i++) {
TLRPC.Dialog dialog = this.allDialogs.get(i);
if (dialog.folder_id == 2) {
getMessagesStorage().getDialogFolderId(dialog.id, new MessagesController$.ExternalSyntheticLambda313(this, dialog));
}
}
getGlobalMainSettings().edit().putBoolean("fixWrongHiddenFolder", true).apply();
}
public void lambda$fixWrongHiddenFolder$408(TLRPC.Dialog dialog, int i) {
if (i == -1 || i == 2) {
return;
}
addDialogToFolder(dialog.id, 2, -1, 0L);
}
private void addDialogsFilterToFolder(TLRPC.Dialog d, int index) {
int i = d.folder_id;
ArrayList<TLRPC.Dialog> arrayList = this.selectedDialogFilterMoreFolder[index].get(i);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.selectedDialogFilterMoreFolder[index].put(i, arrayList);
}
arrayList.add(d);
}
private void addToBots(int folder_id, TLRPC.Dialog d) {
ArrayList<TLRPC.Dialog> arrayList = this.dialogsBotsByFolder.get(folder_id);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsBotsByFolder.put(folder_id, arrayList);
}
arrayList.add(d);
if (PlusSettings.plusShowArchivedChatOnItsTab && folder_id == 1) {
addToBots(0, d);
}
}
private void addToMegaGroups(int folder_id, TLRPC.Dialog d) {
ArrayList<TLRPC.Dialog> arrayList = this.dialogsMegaGroupsByFolder.get(folder_id);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsMegaGroupsByFolder.put(folder_id, arrayList);
}
arrayList.add(d);
if (PlusSettings.plusShowArchivedChatOnItsTab && folder_id == 1) {
addToMegaGroups(0, d);
}
}
private void addToChannels(int folder_id, TLRPC.Dialog d) {
ArrayList<TLRPC.Dialog> arrayList = this.dialogsChannelsByFolder.get(folder_id);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsChannelsByFolder.put(folder_id, arrayList);
}
arrayList.add(d);
if (PlusSettings.plusShowArchivedChatOnItsTab && folder_id == 1) {
addToChannels(0, d);
}
}
private void addToGroups(int folder_id, TLRPC.Dialog d) {
ArrayList<TLRPC.Dialog> arrayList = this.dialogsGroupsByFolder.get(folder_id);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsGroupsByFolder.put(folder_id, arrayList);
}
arrayList.add(d);
if (PlusSettings.plusShowArchivedChatOnItsTab && folder_id == 1) {
addToGroups(0, d);
}
}
private void addToGroupsAll(int folder_id, TLRPC.Dialog d) {
ArrayList<TLRPC.Dialog> arrayList = this.dialogsGroupsAllByFolder.get(folder_id);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsGroupsAllByFolder.put(folder_id, arrayList);
}
arrayList.add(d);
if (PlusSettings.plusShowArchivedChatOnItsTab && folder_id == 1) {
addToGroupsAll(0, d);
}
}
private void addToFavs(int folder_id, TLRPC.Dialog d) {
ArrayList<TLRPC.Dialog> arrayList = this.dialogsFavsByFolder.get(folder_id);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsFavsByFolder.put(folder_id, arrayList);
}
arrayList.add(d);
if (PlusSettings.plusShowArchivedChatOnItsTab && folder_id == 1) {
addToFavs(0, d);
}
}
private void addToUnread(int folder_id, TLRPC.Dialog d) {
ArrayList<TLRPC.Dialog> arrayList = this.dialogsUnreadByFolder.get(folder_id);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsUnreadByFolder.put(folder_id, arrayList);
}
arrayList.add(d);
if (PlusSettings.plusShowArchivedChatOnItsTab && folder_id == 1) {
addToUnread(0, d);
}
}
private void addToAdmin(int folder_id, TLRPC.Dialog d) {
ArrayList<TLRPC.Dialog> arrayList = this.dialogsAdminByFolder.get(folder_id);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsAdminByFolder.put(folder_id, arrayList);
}
arrayList.add(d);
if (PlusSettings.plusShowArchivedChatOnItsTab && folder_id == 1) {
addToAdmin(0, d);
}
}
private void addToUsers(int folder_id, TLRPC.Dialog d) {
ArrayList<TLRPC.Dialog> arrayList = this.dialogsUsersByFolder.get(folder_id);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsUsersByFolder.put(folder_id, arrayList);
}
arrayList.add(d);
if (PlusSettings.plusShowArchivedChatOnItsTab && folder_id == 1) {
addToUsers(0, d);
}
}
private void initializeFolderArrayLists() {
int i = 0;
while (true) {
SparseArray<ArrayList<TLRPC.Dialog>>[] sparseArrayArr = this.selectedDialogFilterMoreFolder;
if (i >= sparseArrayArr.length) {
break;
}
sparseArrayArr[i] = new SparseArray<>();
i++;
}
for (int i2 = 0; i2 < this.dialogsUsersByFolder.size(); i2++) {
this.dialogsUsersByFolder.put(i2, new ArrayList<>());
}
for (int i3 = 0; i3 < this.dialogsGroupsByFolder.size(); i3++) {
this.dialogsGroupsByFolder.put(i3, new ArrayList<>());
}
for (int i4 = 0; i4 < this.dialogsGroupsAllByFolder.size(); i4++) {
this.dialogsGroupsAllByFolder.put(i4, new ArrayList<>());
}
for (int i5 = 0; i5 < this.dialogsBotsByFolder.size(); i5++) {
this.dialogsBotsByFolder.put(i5, new ArrayList<>());
}
for (int i6 = 0; i6 < this.dialogsMegaGroupsByFolder.size(); i6++) {
this.dialogsMegaGroupsByFolder.put(i6, new ArrayList<>());
}
for (int i7 = 0; i7 < this.dialogsChannelsByFolder.size(); i7++) {
this.dialogsChannelsByFolder.put(i7, new ArrayList<>());
}
for (int i8 = 0; i8 < this.dialogsFavsByFolder.size(); i8++) {
this.dialogsFavsByFolder.put(i8, new ArrayList<>());
}
for (int i9 = 0; i9 < this.dialogsAdminByFolder.size(); i9++) {
this.dialogsAdminByFolder.put(i9, new ArrayList<>());
}
for (int i10 = 0; i10 < this.dialogsUnreadByFolder.size(); i10++) {
this.dialogsUnreadByFolder.put(i10, new ArrayList<>());
}
for (int i11 = 0; i11 < this.dialogsHiddenByFolder.size(); i11++) {
this.dialogsHiddenByFolder.put(i11, new ArrayList<>());
}
}
private void addDialogToItsFolder(int index, TLRPC.Dialog dialog) {
int i;
boolean z = dialog instanceof TLRPC.TL_dialogFolder;
if (z) {
if (PlusSettings.removeArchiveFromList) {
return;
}
boolean z2 = this.isForwarding;
if (z2 && PlusSettings.showFoldersIfForwarding) {
return;
}
if ((!z2) & PlusSettings.plusShowArchivedDialogsInTabs) {
addDialogFolderToTabs(dialog);
}
i = 0;
} else {
i = dialog.folder_id;
}
ArrayList<TLRPC.Dialog> arrayList = this.dialogsByFolder.get(i);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.dialogsByFolder.put(i, arrayList);
}
if (index == -1) {
if (z && ((TLRPC.TL_dialogFolder) dialog).folder.id == 2) {
this.removeHiddenDialogFolder = true;
}
arrayList.add(dialog);
return;
}
if (index == -2) {
if (arrayList.isEmpty() || !(arrayList.get(0) instanceof TLRPC.TL_dialogFolder)) {
arrayList.add(0, dialog);
return;
} else {
arrayList.add(1, dialog);
return;
}
}
arrayList.add(index, dialog);
}
public static String getRestrictionReason(ArrayList<TLRPC.TL_restrictionReason> reasons) {
if (reasons.isEmpty()) {
return null;
}
int size = reasons.size();
for (int i = 0; i < size; i++) {
TLRPC.TL_restrictionReason tL_restrictionReason = reasons.get(i);
if ("all".equals(tL_restrictionReason.platform) || (!ApplicationLoader.isStandaloneBuild() && !BuildVars.isBetaApp() && PlusUtils.verifyInstallerId() && "android".equals(tL_restrictionReason.platform))) {
return tL_restrictionReason.text;
}
}
return null;
}
public static void showCantOpenAlert(BaseFragment fragment, String reason) {
if (fragment == null || fragment.getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(fragment.getParentActivity(), fragment.getResourceProvider());
builder.setTitle(LocaleController.getString(R.string.DialogNotAvailable));
HashMap hashMap = new HashMap();
int i = Theme.key_dialogTopBackground;
hashMap.put("info1.**", Integer.valueOf(fragment.getThemedColor(i)));
hashMap.put("info2.**", Integer.valueOf(fragment.getThemedColor(i)));
builder.setTopAnimation(R.raw.not_available, 52, false, fragment.getThemedColor(i), hashMap);
builder.setTopAnimationIsNew(true);
String str = null;
builder.setPositiveButton(LocaleController.getString(R.string.Close), (DialogInterface.OnClickListener) null);
builder.setMessage(reason);
if (Theme.plusDisableRestriction && !reason.equals(LocaleController.getString("ChannelCantOpenBannedByAdmin", R.string.ChannelCantOpenBannedByAdmin))) {
TLRPC$User[] tLRPC$UserArr = {null};
TLRPC.Chat[] chatArr = {null};
tLRPC$UserArr[0] = getInstance(UserConfig.selectedAccount).getUser(Long.valueOf(getInstance(UserConfig.selectedAccount).tempId));
chatArr[0] = getInstance(UserConfig.selectedAccount).getChat(Long.valueOf(getInstance(UserConfig.selectedAccount).tempId));
if (tLRPC$UserArr[0] != null) {
if (tLRPC$UserArr[0].min) {
tLRPC$UserArr[0] = null;
} else {
str = getRestrictionReason(tLRPC$UserArr[0].restriction_reason);
}
} else if (chatArr[0] != null) {
if (chatArr[0].min) {
chatArr[0] = null;
} else {
str = getRestrictionReason(chatArr[0].restriction_reason);
}
}
if (str != null) {
builder.setMessage(str);
}
builder.setNegativeButton(LocaleController.getString("Open", R.string.Open), new MessagesController$.ExternalSyntheticLambda18(tLRPC$UserArr, chatArr, fragment));
builder.setNeutralButton(LocaleController.getString("ShowProfile", R.string.ShowProfile), new MessagesController$.ExternalSyntheticLambda17(tLRPC$UserArr, chatArr, fragment));
}
fragment.showDialog(builder.create());
}
public static void lambda$showCantOpenAlert$409(TLRPC$User[] tLRPC$UserArr, TLRPC.Chat[] chatArr, BaseFragment baseFragment, DialogInterface dialogInterface, int i) {
openChatOrProfileWith(tLRPC$UserArr[0], chatArr[0], baseFragment, 1, false);
}
public static void lambda$showCantOpenAlert$410(TLRPC$User[] tLRPC$UserArr, TLRPC.Chat[] chatArr, BaseFragment baseFragment, DialogInterface dialogInterface, int i) {
openChatOrProfileWith(tLRPC$UserArr[0], chatArr[0], baseFragment, 0, false);
}
public boolean checkCanOpenChat(Bundle bundle, BaseFragment fragment) {
return checkCanOpenChat(bundle, fragment, null);
}
public boolean checkCanOpenChat(Bundle bundle, BaseFragment fragment, MessageObject originalMessage) {
TLRPC.Chat chat;
String restrictionReason;
TLRPC.TL_channels_getMessages tL_messages_getMessages;
if (bundle != null && fragment != null) {
long j = bundle.getLong("user_id", 0L);
long j2 = bundle.getLong("chat_id", 0L);
int i = bundle.getInt("message_id", 0);
TLRPC$User tLRPC$User = null;
if (j != 0) {
chat = null;
tLRPC$User = getUser(Long.valueOf(j));
} else {
chat = j2 != 0 ? getChat(Long.valueOf(j2)) : null;
}
if (tLRPC$User == null && chat == null) {
return true;
}
if (chat != null) {
restrictionReason = getRestrictionReason(chat.restriction_reason);
} else {
restrictionReason = getRestrictionReason(tLRPC$User.restriction_reason);
}
if (restrictionReason != null && Theme.plusDisableRestriction) {
if (chat != null) {
j = j2;
}
this.tempId = j;
}
if (restrictionReason != null) {
showCantOpenAlert(fragment, restrictionReason);
return false;
}
if (i != 0 && originalMessage != null && chat != null && chat.access_hash == 0) {
long dialogId = originalMessage.getDialogId();
if (!DialogObject.isEncryptedDialog(dialogId)) {
AlertDialog alertDialog = new AlertDialog(fragment.getParentActivity(), 3);
if (dialogId < 0) {
chat = getChat(Long.valueOf(-dialogId));
}
if (dialogId > 0 || !ChatObject.isChannel(chat)) {
tL_messages_getMessages = new TLRPC.TL_messages_getMessages();
((TLRPC.TL_messages_getMessages) tL_messages_getMessages).id.add(Integer.valueOf(originalMessage.getId()));
} else {
TLRPC.Chat chat2 = getChat(Long.valueOf(-dialogId));
tL_messages_getMessages = new TLRPC.TL_channels_getMessages();
tL_messages_getMessages.channel = getInputChannel(chat2);
tL_messages_getMessages.id.add(Integer.valueOf(originalMessage.getId()));
}
alertDialog.setOnCancelListener(new MessagesController$.ExternalSyntheticLambda15(this, getConnectionsManager().sendRequest(tL_messages_getMessages, new MessagesController$.ExternalSyntheticLambda435(this, alertDialog, fragment, bundle)), fragment));
fragment.setVisibleDialog(alertDialog);
alertDialog.show();
return false;
}
}
}
return true;
}
public void lambda$checkCanOpenChat$412(AlertDialog alertDialog, BaseFragment baseFragment, Bundle bundle, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda271(this, alertDialog, tLObject, baseFragment, bundle));
}
}
public void lambda$checkCanOpenChat$411(AlertDialog alertDialog, TLObject tLObject, BaseFragment baseFragment, Bundle bundle) {
try {
alertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject;
putUsers(messages_messages.users, false);
putChats(messages_messages.chats, false);
getMessagesStorage().putUsersAndChats(messages_messages.users, messages_messages.chats, true, true);
baseFragment.presentFragment(new ChatActivity(bundle), true);
}
public void lambda$checkCanOpenChat$413(int i, BaseFragment baseFragment, DialogInterface dialogInterface) {
getConnectionsManager().cancelRequest(i, true);
baseFragment.setVisibleDialog(null);
}
public static void openChatOrProfileWith(TLRPC$User user, TLRPC.Chat chat, BaseFragment fragment, int type, boolean closeLast) {
String restrictionReason;
if ((user == null && chat == null) || fragment == null) {
return;
}
if (chat != null) {
restrictionReason = getRestrictionReason(chat.restriction_reason);
} else {
restrictionReason = getRestrictionReason(user.restriction_reason);
if (type != 3 && user.bot && !Theme.plusDisableRestriction) {
if (LaunchActivity.getLastFragment().getLastStoryViewer() == null) {
type = 1;
closeLast = true;
} else {
type = 1;
}
}
}
boolean z = LaunchActivity.getLastFragment() instanceof DialogsActivity;
if (restrictionReason != null && Theme.plusDisableRestriction) {
restrictionReason = null;
}
if (restrictionReason != null) {
showCantOpenAlert(fragment, restrictionReason);
return;
}
Bundle bundle = new Bundle();
if (chat != null) {
bundle.putLong("chat_id", chat.id);
} else {
bundle.putLong("user_id", user.id);
if (UserObject.isUserSelf(user)) {
bundle.putBoolean("my_profile", true);
}
}
if (chat != null && getInstance(UserConfig.selectedAccount).hiddenDialogs.contains(Long.valueOf(-chat.id)) && !PlusSettings.openHiddenDialogsWithoutPasscode && !PlusSettings.insideHidden && SharedConfig.hiddenPasscodeHash.length() > 0) {
NotificationCenter.getInstance(UserConfig.selectedAccount).postNotificationName(NotificationCenter.closeChats, new Object[]{0L});
bundle.putLong("hidden_dialog", -chat.id);
fragment.presentFragment(new DialogsActivity(bundle), true, true);
} else {
if (type == 0) {
fragment.presentFragment((BaseFragment) new ProfileActivity(bundle));
return;
}
if (type == 2) {
if (ChatObject.isForum(chat)) {
fragment.presentFragment(TopicsFragment.getTopicsOrChat(fragment, bundle), !z, true);
return;
} else {
fragment.presentFragment(new ChatActivity(bundle), !z, true);
return;
}
}
if (ChatObject.isForum(chat)) {
fragment.presentFragment(TopicsFragment.getTopicsOrChat(fragment, bundle), closeLast && !z);
} else {
fragment.presentFragment(new ChatActivity(bundle), closeLast && !z);
}
}
}
public void openByUserName(String username, BaseFragment fragment, int type) {
openByUserName(username, fragment, type, null);
}
public void openByUserName(String username, BaseFragment fragment, int type, Browser.Progress progress) {
TLRPC.Chat chat;
TLRPC$User tLRPC$User;
if (username == null || fragment == null) {
return;
}
TLRPC.Chat userOrChat = getUserOrChat(username);
if (userOrChat instanceof TLRPC$User) {
tLRPC$User = (TLRPC$User) userOrChat;
if (!tLRPC$User.min) {
chat = null;
}
tLRPC$User = null;
chat = null;
} else {
if (userOrChat instanceof TLRPC.Chat) {
TLRPC.Chat chat2 = userOrChat;
if (!chat2.min) {
chat = chat2;
tLRPC$User = null;
}
}
tLRPC$User = null;
chat = null;
}
if (tLRPC$User != null) {
openChatOrProfileWith(tLRPC$User, null, fragment, type, false);
return;
}
if (chat != null) {
openChatOrProfileWith(null, chat, fragment, 1, false);
return;
}
if (fragment.getParentActivity() == null) {
return;
}
AlertDialog[] alertDialogArr = {new AlertDialog(fragment.getParentActivity(), 3)};
boolean[] zArr = {false};
getMessagesController().getUserNameResolver().resolve(username, new MessagesController$.ExternalSyntheticLambda19(this, progress, alertDialogArr, fragment, zArr, type, username));
if (progress != null) {
progress.onCancel(new MessagesController$.ExternalSyntheticLambda291(zArr));
progress.init();
} else {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda290(alertDialogArr, zArr, fragment), 500L);
}
}
public void lambda$openByUserName$414(Browser.Progress progress, AlertDialog[] alertDialogArr, BaseFragment baseFragment, boolean[] zArr, int i, String str, Long l) {
try {
if (progress != null) {
progress.end();
} else {
alertDialogArr[0].dismiss();
}
} catch (Exception unused) {
}
alertDialogArr[0] = null;
baseFragment.setVisibleDialog(null);
if (zArr[0]) {
return;
}
if (l != null) {
if (l.longValue() < 0) {
openChatOrProfileWith(null, getChat(Long.valueOf(-l.longValue())), baseFragment, 1, false);
return;
} else {
openChatOrProfileWith(getUser(l), null, baseFragment, i, false);
return;
}
}
if (baseFragment.getParentActivity() != null) {
try {
if (baseFragment instanceof ChatActivity) {
((ChatActivity) baseFragment).shakeContent();
}
BulletinFactory.of(baseFragment).createErrorBulletin(LocaleController.getString("NoUsernameFound", R.string.NoUsernameFound)).show();
if (ApplicationLoader.applicationContext.getSharedPreferences("plusconfig", 0).getBoolean("searchOnTwitter", false)) {
try {
baseFragment.getParentActivity().startActivity(new Intent("android.intent.action.VIEW", Uri.parse("twitter://user?screen_name=" + str)));
} catch (Exception unused2) {
baseFragment.getParentActivity().startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://twitter.com/" + str)));
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
}
public static void lambda$openByUserName$415(boolean[] zArr) {
zArr[0] = true;
}
public static void lambda$openByUserName$417(AlertDialog[] alertDialogArr, boolean[] zArr, BaseFragment baseFragment) {
if (alertDialogArr[0] == null) {
return;
}
alertDialogArr[0].setOnCancelListener(new MessagesController$.ExternalSyntheticLambda16(zArr));
baseFragment.showDialog(alertDialogArr[0]);
}
public static void lambda$openByUserName$416(boolean[] zArr, DialogInterface dialogInterface) {
zArr[0] = true;
}
public long getChatId(String username) {
if (username == null) {
return 0L;
}
TLRPC.Chat userOrChat = getUserOrChat(username);
if (userOrChat instanceof TLRPC$User) {
TLRPC$User tLRPC$User = (TLRPC$User) userOrChat;
if (tLRPC$User.min) {
return 0L;
}
return tLRPC$User.id;
}
if (!(userOrChat instanceof TLRPC.Chat)) {
return 0L;
}
TLRPC.Chat chat = userOrChat;
if (chat.min) {
return 0L;
}
return chat.id;
}
public void ensureMessagesLoaded(long dialogId, int messageId, MessagesLoadedCallback callback) {
int i;
SharedPreferences notificationsSettings = getNotificationsSettings(this.currentAccount);
if (messageId == 0) {
i = notificationsSettings.getInt("diditem" + dialogId, 0);
} else {
i = messageId;
}
int generateClassGuid = ConnectionsManager.generateClassGuid();
long j = DialogObject.isChatDialog(dialogId) ? -dialogId : 0L;
if (j != 0 && getMessagesController().getChat(Long.valueOf(j)) == null) {
MessagesStorage messagesStorage = getMessagesStorage();
messagesStorage.getStorageQueue().postRunnable(new MessagesController$.ExternalSyntheticLambda182(this, messagesStorage, j, dialogId, i, callback));
return;
}
int i2 = AndroidUtilities.isTablet() ? 30 : 20;
10 r8 = new 10(this, generateClassGuid, i2, i, dialogId, callback);
getNotificationCenter().addObserver(r8, NotificationCenter.messagesDidLoadWithoutProcess);
getNotificationCenter().addObserver(r8, NotificationCenter.loadingMessagesFailed);
if (i != 0) {
loadMessagesInternal(dialogId, 0L, true, i2, i, 0, true, 0, generateClassGuid, 3, 0, 0, 0L, -1, 0, 0, 0, false, 0, true, false, false, null, 0L);
} else {
loadMessagesInternal(dialogId, 0L, true, i2, i, 0, true, 0, generateClassGuid, 2, 0, 0, 0L, -1, 0, 0, 0, false, 0, true, false, false, null, 0L);
}
}
public void lambda$ensureMessagesLoaded$419(MessagesStorage messagesStorage, long j, long j2, int i, MessagesLoadedCallback messagesLoadedCallback) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda211(this, messagesStorage.getChat(j), j2, i, messagesLoadedCallback));
}
public void lambda$ensureMessagesLoaded$418(TLRPC.Chat chat, long j, int i, MessagesLoadedCallback messagesLoadedCallback) {
if (chat != null) {
getMessagesController().putChat(chat, true);
ensureMessagesLoaded(j, i, messagesLoadedCallback);
} else if (messagesLoadedCallback != null) {
messagesLoadedCallback.onError();
}
}
public int getChatPendingRequestsOnClosed(long chatId) {
return this.mainPreferences.getInt("chatPendingRequests" + chatId, 0);
}
public void setChatPendingRequestsOnClose(long chatId, int count) {
this.mainPreferences.edit().putInt("chatPendingRequests" + chatId, count).apply();
}
public void deleteMessagesRange(long dialogId, long channelId, int minDate, int maxDate, boolean forAll, Runnable callback) {
TLRPC.TL_messages_deleteHistory tL_messages_deleteHistory = new TLRPC.TL_messages_deleteHistory();
tL_messages_deleteHistory.peer = getInputPeer(dialogId);
tL_messages_deleteHistory.flags = 12;
tL_messages_deleteHistory.min_date = minDate;
tL_messages_deleteHistory.max_date = maxDate;
tL_messages_deleteHistory.revoke = forAll;
getConnectionsManager().sendRequest(tL_messages_deleteHistory, new MessagesController$.ExternalSyntheticLambda390(this, dialogId, minDate, maxDate, channelId, callback));
}
public void lambda$deleteMessagesRange$423(long j, int i, int i2, long j2, Runnable runnable, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC.TL_messages_affectedHistory tL_messages_affectedHistory = (TLRPC.TL_messages_affectedHistory) tLObject;
processNewDifferenceParams(-1, tL_messages_affectedHistory.pts, -1, tL_messages_affectedHistory.pts_count);
getMessagesStorage().getStorageQueue().postRunnable(new MessagesController$.ExternalSyntheticLambda110(this, j, i, i2, j2, runnable));
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda28(runnable));
}
public void lambda$deleteMessagesRange$421(long j, int i, int i2, long j2, Runnable runnable) {
ArrayList cachedMessagesInRange = getMessagesStorage().getCachedMessagesInRange(j, i, i2);
getMessagesStorage().markMessagesAsDeleted(j, cachedMessagesInRange, false, true, 0, 0);
getMessagesStorage().updateDialogsWithDeletedMessages(j, 0L, cachedMessagesInRange, (ArrayList) null, false);
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda167(this, cachedMessagesInRange, j2, runnable));
}
public void lambda$deleteMessagesRange$420(ArrayList arrayList, long j, Runnable runnable) {
getNotificationCenter().postNotificationName(NotificationCenter.messagesDeleted, new Object[]{arrayList, Long.valueOf(j), Boolean.FALSE});
runnable.run();
}
public void setCustomChatReactions(long chatId, int type, List<TLRPC.Reaction> reactions, int reactionsCount, Utilities.Callback<TLRPC.TL_error> onError, Runnable onSuccess) {
TLRPC.TL_messages_setChatAvailableReactions tL_messages_setChatAvailableReactions = new TLRPC.TL_messages_setChatAvailableReactions();
tL_messages_setChatAvailableReactions.peer = getInputPeer(-chatId);
if (type == 2 || reactions.isEmpty()) {
tL_messages_setChatAvailableReactions.available_reactions = new TLRPC.TL_chatReactionsNone();
} else if (type == 0) {
tL_messages_setChatAvailableReactions.available_reactions = new TLRPC.TL_chatReactionsAll();
} else {
TLRPC.TL_chatReactionsSome tL_chatReactionsSome = new TLRPC.TL_chatReactionsSome();
tL_messages_setChatAvailableReactions.available_reactions = tL_chatReactionsSome;
tL_chatReactionsSome.reactions.addAll(reactions);
}
tL_messages_setChatAvailableReactions.flags |= 1;
tL_messages_setChatAvailableReactions.reactions_limit = reactionsCount;
getConnectionsManager().sendRequest(tL_messages_setChatAvailableReactions, new MessagesController$.ExternalSyntheticLambda410(this, chatId, tL_messages_setChatAvailableReactions, onSuccess, onError));
TLRPC.ChatFull chatFull = getChatFull(chatId);
if (chatFull != null) {
if (chatFull instanceof TLRPC.TL_channelFull) {
chatFull.flags2 |= 8192;
} else {
chatFull.flags |= 1048576;
}
chatFull.reactions_limit = reactionsCount;
getMessagesStorage().updateChatInfo(chatFull, false);
}
}
public void lambda$setCustomChatReactions$426(long j, TLRPC.TL_messages_setChatAvailableReactions tL_messages_setChatAvailableReactions, Runnable runnable, Utilities.Callback callback, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
processUpdates((TLRPC.Updates) tLObject, false);
TLRPC.ChatFull chatFull = getChatFull(j);
if (chatFull != null) {
if (chatFull instanceof TLRPC.TL_chatFull) {
chatFull.flags |= 262144;
}
if (chatFull instanceof TLRPC.TL_channelFull) {
chatFull.flags |= 1073741824;
}
chatFull.available_reactions = tL_messages_setChatAvailableReactions.available_reactions;
getMessagesStorage().updateChatInfo(chatFull, false);
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda153(this, runnable, j));
return;
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda286(callback, tL_error));
}
public void lambda$setCustomChatReactions$424(Runnable runnable, long j) {
if (runnable != null) {
runnable.run();
}
getNotificationCenter().postNotificationName(NotificationCenter.chatAvailableReactionsUpdated, new Object[]{Long.valueOf(j), 0L});
}
public static void lambda$setCustomChatReactions$425(Utilities.Callback callback, TLRPC.TL_error tL_error) {
if (callback != null) {
callback.run(tL_error);
}
}
public void setChatReactions(long chatId, int type, List<String> reactions) {
TLRPC.TL_messages_setChatAvailableReactions tL_messages_setChatAvailableReactions = new TLRPC.TL_messages_setChatAvailableReactions();
tL_messages_setChatAvailableReactions.peer = getInputPeer(-chatId);
if (type == 2) {
tL_messages_setChatAvailableReactions.available_reactions = new TLRPC.TL_chatReactionsNone();
} else if (type == 0) {
tL_messages_setChatAvailableReactions.available_reactions = new TLRPC.TL_chatReactionsAll();
} else {
TLRPC.TL_chatReactionsSome tL_chatReactionsSome = new TLRPC.TL_chatReactionsSome();
tL_messages_setChatAvailableReactions.available_reactions = tL_chatReactionsSome;
for (int i = 0; i < reactions.size(); i++) {
TLRPC.TL_reactionEmoji tL_reactionEmoji = new TLRPC.TL_reactionEmoji();
tL_reactionEmoji.emoticon = reactions.get(i);
tL_chatReactionsSome.reactions.add(tL_reactionEmoji);
}
}
getConnectionsManager().sendRequest(tL_messages_setChatAvailableReactions, new MessagesController$.ExternalSyntheticLambda409(this, chatId, tL_messages_setChatAvailableReactions));
}
public void lambda$setChatReactions$428(long j, TLRPC.TL_messages_setChatAvailableReactions tL_messages_setChatAvailableReactions, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject != null) {
processUpdates((TLRPC.Updates) tLObject, false);
TLRPC.ChatFull chatFull = getChatFull(j);
if (chatFull != null) {
if (chatFull instanceof TLRPC.TL_chatFull) {
chatFull.flags |= 262144;
}
if (chatFull instanceof TLRPC.TL_channelFull) {
chatFull.flags |= 1073741824;
}
chatFull.available_reactions = tL_messages_setChatAvailableReactions.available_reactions;
getMessagesStorage().updateChatInfo(chatFull, false);
}
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda106(this, j));
}
}
public void lambda$setChatReactions$427(long j) {
getNotificationCenter().postNotificationName(NotificationCenter.chatAvailableReactionsUpdated, new Object[]{Long.valueOf(j), 0L});
}
public boolean matchesAdminRights(TLRPC.Chat chat, TLRPC$User user, TLRPC.TL_chatAdminRights rights) {
if (rights == null) {
return true;
}
TLRPC.TL_chatAdminRights chatAdminRightsCached = getChatAdminRightsCached(chat, user);
if ((!rights.change_info || (chatAdminRightsCached != null && chatAdminRightsCached.change_info)) && ((!rights.post_messages || (chatAdminRightsCached != null && chatAdminRightsCached.post_messages)) && ((!rights.edit_messages || (chatAdminRightsCached != null && chatAdminRightsCached.edit_messages)) && ((!rights.delete_messages || (chatAdminRightsCached != null && chatAdminRightsCached.delete_messages)) && ((!rights.ban_users || (chatAdminRightsCached != null && chatAdminRightsCached.ban_users)) && ((!rights.invite_users || (chatAdminRightsCached != null && chatAdminRightsCached.invite_users)) && ((!rights.pin_messages || (chatAdminRightsCached != null && chatAdminRightsCached.pin_messages)) && ((!rights.add_admins || (chatAdminRightsCached != null && chatAdminRightsCached.add_admins)) && ((!rights.anonymous || (chatAdminRightsCached != null && chatAdminRightsCached.anonymous)) && ((!rights.manage_call || (chatAdminRightsCached != null && chatAdminRightsCached.manage_call)) && (!rights.other || (chatAdminRightsCached != null && chatAdminRightsCached.other)))))))))))) {
if (!rights.manage_topics) {
return true;
}
if (chatAdminRightsCached != null && chatAdminRightsCached.manage_topics) {
return true;
}
}
return false;
}
public TLRPC.TL_chatAdminRights getChatAdminRightsCached(TLRPC.Chat chat, TLRPC$User user) {
TLRPC.ChatParticipants chatParticipants;
ArrayList arrayList;
TLRPC.ChannelParticipant channelParticipant;
if (chat != null && user != null) {
if (UserObject.isUserSelf(user)) {
return chat.admin_rights;
}
TLRPC.ChatFull chatFull = getChatFull(chat.id);
if (chatFull != null && (chatParticipants = chatFull.participants) != null && (arrayList = chatParticipants.participants) != null) {
for (int i = 0; i < arrayList.size(); i++) {
TLRPC.TL_chatChannelParticipant tL_chatChannelParticipant = (TLRPC.ChatParticipant) arrayList.get(i);
if (tL_chatChannelParticipant != null && ((TLRPC.ChatParticipant) tL_chatChannelParticipant).user_id == user.id) {
if (!(tL_chatChannelParticipant instanceof TLRPC.TL_chatChannelParticipant) || (channelParticipant = tL_chatChannelParticipant.channelParticipant) == null) {
return null;
}
return channelParticipant.admin_rights;
}
}
}
}
return null;
}
public boolean isInChatCached(TLRPC.Chat chat, TLRPC$User user) {
TLRPC.ChatParticipants chatParticipants;
ArrayList arrayList;
if (chat != null && user != null) {
if (UserObject.isUserSelf(user)) {
return !ChatObject.isNotInChat(chat);
}
TLRPC.ChatFull chatFull = getChatFull(chat.id);
if (chatFull != null && (chatParticipants = chatFull.participants) != null && (arrayList = chatParticipants.participants) != null) {
for (int i = 0; i < arrayList.size(); i++) {
TLRPC.ChatParticipant chatParticipant = (TLRPC.ChatParticipant) arrayList.get(i);
if (chatParticipant != null && chatParticipant.user_id == user.id) {
return true;
}
}
}
}
return false;
}
public void getChannelParticipant(TLRPC.Chat chat, TLRPC$User user, Utilities.Callback<TLRPC.ChannelParticipant> callback) {
if (chat == null || user == null) {
if (callback != null) {
callback.run((Object) null);
}
} else {
TLRPC.TL_channels_getParticipant tL_channels_getParticipant = new TLRPC.TL_channels_getParticipant();
tL_channels_getParticipant.channel = getInputChannel(chat.id);
tL_channels_getParticipant.participant = getInputPeer(user);
getConnectionsManager().sendRequest(tL_channels_getParticipant, new MessagesController$.ExternalSyntheticLambda448(callback));
}
}
public static void lambda$getChannelParticipant$429(Utilities.Callback callback, TLObject tLObject, TLRPC.TL_error tL_error) {
if (callback != null) {
callback.run(tLObject instanceof TLRPC.TL_channels_channelParticipant ? ((TLRPC.TL_channels_channelParticipant) tLObject).participant : null);
}
}
public void checkIsInChat(boolean z, TLRPC.Chat chat, TLRPC$User tLRPC$User, IsInChatCheckedCallback isInChatCheckedCallback) {
TLRPC.ChatFull chatFull;
TLRPC.ChatParticipant chatParticipant;
ArrayList arrayList;
TLRPC.ChatParticipant chatParticipant2;
ArrayList arrayList2;
if (chat == null || tLRPC$User == null) {
if (isInChatCheckedCallback != null) {
isInChatCheckedCallback.run(false, (TLRPC.TL_chatAdminRights) null, (String) null);
return;
}
return;
}
if (chat.megagroup || ChatObject.isChannel(chat)) {
if (z && (chatFull = getChatFull(chat.id)) != null) {
TLRPC.ChatParticipants chatParticipants = chatFull.participants;
if (chatParticipants != null && (arrayList = chatParticipants.participants) != null) {
int size = arrayList.size();
for (int i = 0; i < size; i++) {
chatParticipant = (TLRPC.ChatParticipant) chatFull.participants.participants.get(i);
if (chatParticipant != null && chatParticipant.user_id == tLRPC$User.id) {
break;
}
}
}
chatParticipant = null;
if (isInChatCheckedCallback != null && chatParticipant != null) {
TLRPC.ChatParticipants chatParticipants2 = chatFull.participants;
isInChatCheckedCallback.run(true, (chatParticipants2 == null || chatParticipants2.admin_id != tLRPC$User.id) ? null : ChatRightsEditActivity.emptyAdminRights(true), (String) null);
return;
}
}
TLRPC.TL_channels_getParticipant tL_channels_getParticipant = new TLRPC.TL_channels_getParticipant();
tL_channels_getParticipant.channel = getInputChannel(chat.id);
tL_channels_getParticipant.participant = getInputPeer(tLRPC$User);
getConnectionsManager().sendRequest(tL_channels_getParticipant, new MessagesController$.ExternalSyntheticLambda322(isInChatCheckedCallback));
return;
}
TLRPC.ChatFull chatFull2 = getChatFull(chat.id);
if (chatFull2 == null) {
if (isInChatCheckedCallback != null) {
isInChatCheckedCallback.run(false, (TLRPC.TL_chatAdminRights) null, (String) null);
return;
}
return;
}
TLRPC.ChatParticipants chatParticipants3 = chatFull2.participants;
if (chatParticipants3 != null && (arrayList2 = chatParticipants3.participants) != null) {
int size2 = arrayList2.size();
for (int i2 = 0; i2 < size2; i2++) {
chatParticipant2 = (TLRPC.ChatParticipant) chatFull2.participants.participants.get(i2);
if (chatParticipant2 != null && chatParticipant2.user_id == tLRPC$User.id) {
break;
}
}
}
chatParticipant2 = null;
if (isInChatCheckedCallback != null) {
boolean z2 = chatParticipant2 != null;
TLRPC.ChatParticipants chatParticipants4 = chatFull2.participants;
isInChatCheckedCallback.run(z2, (chatParticipants4 == null || chatParticipants4.admin_id != tLRPC$User.id) ? null : ChatRightsEditActivity.emptyAdminRights(true), (String) null);
}
}
public static void lambda$checkIsInChat$430(IsInChatCheckedCallback isInChatCheckedCallback, TLObject tLObject, TLRPC.TL_error tL_error) {
if (isInChatCheckedCallback != null) {
TLRPC.ChannelParticipant channelParticipant = tLObject instanceof TLRPC.TL_channels_channelParticipant ? ((TLRPC.TL_channels_channelParticipant) tLObject).participant : null;
isInChatCheckedCallback.run((tL_error != null || channelParticipant == null || channelParticipant.left) ? false : true, channelParticipant != null ? channelParticipant.admin_rights : null, channelParticipant != null ? channelParticipant.rank : null);
}
}
public void updateEmojiStatusUntilUpdate(long dialogId, TLRPC.EmojiStatus status) {
if (status instanceof TLRPC.TL_emojiStatusUntil) {
this.emojiStatusUntilValues.put(dialogId, Integer.valueOf(((TLRPC.TL_emojiStatusUntil) status).until));
} else if (!this.emojiStatusUntilValues.containsKey(dialogId)) {
return;
} else {
this.emojiStatusUntilValues.remove(dialogId);
}
updateEmojiStatusUntil();
}
public void updateEmojiStatusUntil() {
int currentTimeMillis = (int) (System.currentTimeMillis() / 1000);
Long l = null;
int i = 0;
while (i < this.emojiStatusUntilValues.size()) {
if (this.emojiStatusUntilValues.valueAt(i).intValue() > currentTimeMillis) {
l = Long.valueOf(Math.min(l == null ? Long.MAX_VALUE : l.longValue(), r5 - currentTimeMillis));
} else {
this.emojiStatusUntilValues.removeAt(i);
i--;
}
i++;
}
if (l != null) {
Long valueOf = Long.valueOf(l.longValue() + 2);
long j = currentTimeMillis;
if (valueOf.longValue() + j != this.recentEmojiStatusUpdateRunnableTime + this.recentEmojiStatusUpdateRunnableTimeout) {
AndroidUtilities.cancelRunOnUIThread(this.recentEmojiStatusUpdateRunnable);
this.recentEmojiStatusUpdateRunnableTime = j;
this.recentEmojiStatusUpdateRunnableTimeout = valueOf.longValue();
MessagesController$.ExternalSyntheticLambda41 externalSyntheticLambda41 = new MessagesController$.ExternalSyntheticLambda41(this);
this.recentEmojiStatusUpdateRunnable = externalSyntheticLambda41;
AndroidUtilities.runOnUIThread(externalSyntheticLambda41, valueOf.longValue() * 1000);
return;
}
return;
}
Runnable runnable = this.recentEmojiStatusUpdateRunnable;
if (runnable != null) {
this.recentEmojiStatusUpdateRunnableTime = -1L;
this.recentEmojiStatusUpdateRunnableTimeout = -1L;
AndroidUtilities.cancelRunOnUIThread(runnable);
}
}
public void lambda$updateEmojiStatusUntil$431() {
getNotificationCenter().postNotificationName(NotificationCenter.updateInterfaces, new Object[]{Integer.valueOf(UPDATE_MASK_EMOJI_STATUS)});
updateEmojiStatusUntil();
}
public String getMutedString(long dialogId, long topicId) {
if (getMessagesController().isDialogMuted(dialogId, topicId)) {
int i = this.notificationsPreferences.getInt("notifyuntil_" + NotificationsController.getSharedPrefKey(dialogId, topicId), 0);
return i >= getConnectionsManager().getCurrentTime() ? LocaleController.formatString("NotificationsMutedForHint", R.string.NotificationsMutedForHint, LocaleController.formatTTLString(i)) : LocaleController.getString(R.string.NotificationsMuted);
}
return LocaleController.getString(R.string.NotificationsUnmuted);
}
public int getDialogUnreadCount(TLRPC.Dialog d) {
if (d == null) {
return 0;
}
int i = d.unread_count;
TLRPC.Chat chat = getChat(Long.valueOf(-d.id));
return (chat == null || !chat.forum) ? i : this.topicsController.getForumUnreadCount(-d.id)[0];
}
public TLRPC.TL_exportedContactToken getCachedContactToken() {
if (this.cachedContactToken == null || r0.expires <= System.currentTimeMillis() / 1000) {
return null;
}
return this.cachedContactToken;
}
public void requestContactToken(Utilities.Callback<TLRPC.TL_exportedContactToken> callback) {
requestContactToken(0L, callback);
}
public void requestContactToken(long minDuration, Utilities.Callback<TLRPC.TL_exportedContactToken> callback) {
if (callback == null || this.requestingContactToken) {
return;
}
if (this.cachedContactToken != null && r0.expires > System.currentTimeMillis() / 1000) {
callback.run(this.cachedContactToken);
return;
}
this.requestingContactToken = true;
getConnectionsManager().sendRequest(new TLRPC.TL_contacts_exportContactToken(), new MessagesController$.ExternalSyntheticLambda426(this, callback, minDuration, System.currentTimeMillis()));
}
public void lambda$requestContactToken$433(Utilities.Callback callback, long j, long j2, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject instanceof TLRPC.TL_exportedContactToken) {
this.cachedContactToken = (TLRPC.TL_exportedContactToken) tLObject;
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda183(this, callback), Math.max(0L, j - (System.currentTimeMillis() - j2)));
} else {
this.requestingContactToken = false;
}
}
public void lambda$requestContactToken$432(Utilities.Callback callback) {
callback.run(this.cachedContactToken);
this.requestingContactToken = false;
}
public CacheByChatsController getCacheByChatsController() {
return this.cacheByChatsController;
}
public int getFilterIdByDialogsType(int dialogsType) {
if (dialogsType != 7 && dialogsType != 8) {
return 0;
}
DialogFilter dialogFilter = this.selectedDialogFilter[dialogsType - 7];
if (dialogFilter == null) {
return -1;
}
return dialogFilter.id;
}
public void invalidateChatlistFolderUpdate(int filterId) {
this.chatlistFoldersUpdates.remove(filterId);
getNotificationCenter().postNotificationName(NotificationCenter.chatlistFolderUpdate, new Object[]{Integer.valueOf(filterId)});
}
public void checkChatlistFolderUpdate(int filterId, boolean invalidate) {
if (filterId < 0) {
return;
}
ChatlistUpdatesStat chatlistUpdatesStat = this.chatlistFoldersUpdates.get(filterId);
if (chatlistUpdatesStat != null) {
if (chatlistUpdatesStat.loading) {
return;
}
if (System.currentTimeMillis() - chatlistUpdatesStat.lastRequestTime <= this.chatlistUpdatePeriod * 1000 && !invalidate) {
return;
}
}
if (chatlistUpdatesStat == null) {
chatlistUpdatesStat = new ChatlistUpdatesStat(this);
this.chatlistFoldersUpdates.put(filterId, chatlistUpdatesStat);
}
chatlistUpdatesStat.loading = false;
TL_chatlists.TL_chatlists_getChatlistUpdates tL_chatlists_getChatlistUpdates = new TL_chatlists.TL_chatlists_getChatlistUpdates();
TL_chatlists.TL_inputChatlistDialogFilter tL_inputChatlistDialogFilter = new TL_chatlists.TL_inputChatlistDialogFilter();
tL_chatlists_getChatlistUpdates.chatlist = tL_inputChatlistDialogFilter;
tL_inputChatlistDialogFilter.filter_id = filterId;
getConnectionsManager().sendRequest(tL_chatlists_getChatlistUpdates, new MessagesController$.ExternalSyntheticLambda367(this, filterId, chatlistUpdatesStat));
}
public void lambda$checkChatlistFolderUpdate$435(int i, ChatlistUpdatesStat chatlistUpdatesStat, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda197(this, tLObject, i, chatlistUpdatesStat));
}
public void lambda$checkChatlistFolderUpdate$434(TLObject tLObject, int i, ChatlistUpdatesStat chatlistUpdatesStat) {
if (tLObject instanceof TL_chatlists.TL_chatlists_chatlistUpdates) {
TL_chatlists.TL_chatlists_chatlistUpdates tL_chatlists_chatlistUpdates = (TL_chatlists.TL_chatlists_chatlistUpdates) tLObject;
putChats(tL_chatlists_chatlistUpdates.chats, false);
putUsers(tL_chatlists_chatlistUpdates.users, false);
this.chatlistFoldersUpdates.put(i, new ChatlistUpdatesStat(this, tL_chatlists_chatlistUpdates));
getNotificationCenter().postNotificationName(NotificationCenter.chatlistFolderUpdate, new Object[]{Integer.valueOf(i)});
return;
}
chatlistUpdatesStat.loading = false;
}
public TL_chatlists.TL_chatlists_chatlistUpdates getChatlistFolderUpdates(int filterId) {
ChatlistUpdatesStat chatlistUpdatesStat = this.chatlistFoldersUpdates.get(filterId);
if (chatlistUpdatesStat == null) {
return null;
}
return chatlistUpdatesStat.lastValue;
}
public Pair<Runnable, Runnable> removeFolderTemporarily(final int filterId, final ArrayList<Long> chats) {
this.frozenDialogFilters = new ArrayList<>(this.dialogFilters);
int i = 0;
while (i < this.frozenDialogFilters.size()) {
if (this.frozenDialogFilters.get(i).id == filterId) {
this.frozenDialogFilters.remove(i);
i--;
}
i++;
}
this.hiddenUndoChats.clear();
if (chats != null) {
this.hiddenUndoChats.addAll(chats);
}
boolean z = !this.hiddenUndoChats.isEmpty();
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated, new Object[0]);
if (z) {
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
return new Pair<>(new MessagesController$.ExternalSyntheticLambda88(this, filterId, z), new MessagesController$.ExternalSyntheticLambda273(this, z));
}
public void lambda$removeFolderTemporarily$436(int i, boolean z) {
int i2 = 0;
while (i2 < this.dialogFilters.size()) {
if (this.dialogFilters.get(i2).id == i) {
this.dialogFilters.remove(i2);
i2--;
}
i2++;
}
this.frozenDialogFilters = null;
this.hiddenUndoChats.clear();
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated, new Object[0]);
if (z) {
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
}
public void lambda$removeFolderTemporarily$437(boolean z) {
this.frozenDialogFilters = null;
this.hiddenUndoChats.clear();
getNotificationCenter().postNotificationName(NotificationCenter.dialogFiltersUpdated, new Object[0]);
if (z) {
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
}
public boolean isHiddenByUndo(long did) {
return !this.hiddenUndoChats.isEmpty() && this.hiddenUndoChats.contains(Long.valueOf(did));
}
public void cancelUploadWallpaper() {
Theme.OverrideWallpaperInfo overrideWallpaperInfo = this.uploadingWallpaperInfo;
if (overrideWallpaperInfo != null) {
if (overrideWallpaperInfo.requestIds != null) {
for (int i = 0; i < this.uploadingWallpaperInfo.requestIds.size(); i++) {
ConnectionsManager.getInstance(this.currentAccount).cancelRequest(((Integer) this.uploadingWallpaperInfo.requestIds.get(i)).intValue(), true);
}
}
FileLoader.getInstance(this.currentAccount).cancelFileUpload(this.uploadingWallpaper, false);
long j = this.uploadingWallpaperInfo.dialogId;
if (j != 0) {
if (j >= 0) {
TLRPC.UserFull userFull = getUserFull(j);
if (userFull != null) {
userFull.wallpaper = this.uploadingWallpaperInfo.prevUserWallpaper;
NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.userInfoDidLoad, new Object[]{Long.valueOf(this.uploadingWallpaperInfo.dialogId), userFull});
}
} else {
TLRPC.ChatFull chatFull = getChatFull(-j);
if (chatFull != null) {
chatFull.wallpaper = this.uploadingWallpaperInfo.prevUserWallpaper;
NotificationCenter notificationCenter = NotificationCenter.getInstance(this.currentAccount);
int i2 = NotificationCenter.chatInfoDidLoad;
Boolean bool = Boolean.FALSE;
notificationCenter.postNotificationName(i2, new Object[]{chatFull, 0, bool, bool});
}
}
}
this.uploadingWallpaperInfo = null;
this.uploadingWallpaper = null;
}
}
public StoriesController getStoriesController() {
StoriesController storiesController = this.storiesController;
if (storiesController != null) {
return storiesController;
}
synchronized (lockObjects[this.currentAccount]) {
StoriesController storiesController2 = this.storiesController;
if (storiesController2 != null) {
return storiesController2;
}
StoriesController storiesController3 = new StoriesController(this.currentAccount);
this.storiesController = storiesController3;
return storiesController3;
}
}
public SavedMessagesController getSavedMessagesController() {
SavedMessagesController savedMessagesController = this.savedMessagesController;
if (savedMessagesController != null) {
return savedMessagesController;
}
synchronized (lockObjects[this.currentAccount]) {
SavedMessagesController savedMessagesController2 = this.savedMessagesController;
if (savedMessagesController2 != null) {
return savedMessagesController2;
}
SavedMessagesController savedMessagesController3 = new SavedMessagesController(this.currentAccount);
this.savedMessagesController = savedMessagesController3;
return savedMessagesController3;
}
}
public UnconfirmedAuthController getUnconfirmedAuthController() {
UnconfirmedAuthController unconfirmedAuthController = this.unconfirmedAuthController;
if (unconfirmedAuthController != null) {
return unconfirmedAuthController;
}
synchronized (lockObjects[this.currentAccount]) {
UnconfirmedAuthController unconfirmedAuthController2 = this.unconfirmedAuthController;
if (unconfirmedAuthController2 != null) {
return unconfirmedAuthController2;
}
UnconfirmedAuthController unconfirmedAuthController3 = new UnconfirmedAuthController(this.currentAccount);
this.unconfirmedAuthController = unconfirmedAuthController3;
return unconfirmedAuthController3;
}
}
public boolean storiesEnabled() {
char c;
String str = this.storiesPosting;
int hashCode = str.hashCode();
if (hashCode == -1609594047) {
if (str.equals("enabled")) {
c = 1;
}
c = 65535;
} else if (hashCode != -318452137) {
if (hashCode == 270940796 && str.equals("disabled")) {
c = 3;
}
c = 65535;
} else {
if (str.equals("premium")) {
c = 0;
}
c = 65535;
}
if (c != 0) {
return true;
}
return getUserConfig().isPremium();
}
public boolean storyEntitiesAllowed() {
char c;
String str = this.storiesEntities;
int hashCode = str.hashCode();
if (hashCode == -1609594047) {
if (str.equals("enabled")) {
c = 1;
}
c = 65535;
} else if (hashCode != -318452137) {
if (hashCode == 270940796 && str.equals("disabled")) {
c = 3;
}
c = 65535;
} else {
if (str.equals("premium")) {
c = 0;
}
c = 65535;
}
if (c != 0) {
return c == 1;
}
return getUserConfig().isPremium();
}
public boolean storyEntitiesAllowed(TLRPC$User user) {
if (user != null && user.id == this.storiesChangelogUserId) {
return true;
}
String str = this.storiesEntities;
char c = 65535;
int hashCode = str.hashCode();
if (hashCode != -1609594047) {
if (hashCode != -318452137) {
if (hashCode == 270940796 && str.equals("disabled")) {
c = 3;
}
} else if (str.equals("premium")) {
c = 0;
}
} else if (str.equals("enabled")) {
c = 1;
}
return c != 0 ? c == 1 : user != null && user.premium;
}
public ChannelRecommendations getCachedChannelRecommendations(long chatId) {
HashMap<Long, ChannelRecommendations> hashMap = this.cachedChannelRecommendations;
if (hashMap == null) {
return null;
}
return hashMap.get(Long.valueOf(chatId));
}
public ChannelRecommendations getChannelRecommendations(long chatId) {
ChannelRecommendations channelRecommendations;
TLRPC.InputChannel inputChannel = getInputChannel(chatId);
if (inputChannel == null && chatId != 0) {
return null;
}
if (this.cachedChannelRecommendations == null) {
this.cachedChannelRecommendations = new HashMap<>();
}
boolean isPremium = getUserConfig().isPremium();
if (this.cachedChannelRecommendations.containsKey(Long.valueOf(chatId))) {
channelRecommendations = this.cachedChannelRecommendations.get(Long.valueOf(chatId));
if (channelRecommendations != null && channelRecommendations.wasPremium == isPremium) {
return channelRecommendations;
}
} else {
channelRecommendations = null;
}
this.cachedChannelRecommendations.put(Long.valueOf(chatId), null);
TLRPC.TL_channels_getChannelRecommendations tL_channels_getChannelRecommendations = new TLRPC.TL_channels_getChannelRecommendations();
if (chatId != 0) {
tL_channels_getChannelRecommendations.flags |= 1;
tL_channels_getChannelRecommendations.channel = inputChannel;
}
getConnectionsManager().sendRequest(tL_channels_getChannelRecommendations, new MessagesController$.ExternalSyntheticLambda443(this, isPremium, chatId));
return channelRecommendations;
}
public void lambda$getChannelRecommendations$439(boolean z, long j, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda204(this, tLObject, z, j));
}
public void lambda$getChannelRecommendations$438(TLObject tLObject, boolean z, long j) {
if (tLObject instanceof TLRPC.messages_Chats) {
ArrayList<TLRPC.Chat> arrayList = ((TLRPC.messages_Chats) tLObject).chats;
putChats(arrayList, false);
ChannelRecommendations channelRecommendations = new ChannelRecommendations();
channelRecommendations.wasPremium = z;
channelRecommendations.chats.addAll(arrayList);
if (tLObject instanceof TLRPC.TL_messages_chatsSlice) {
channelRecommendations.more = Math.max(0, ((TLRPC.messages_Chats) ((TLRPC.TL_messages_chatsSlice) tLObject)).count - arrayList.size());
} else if (!getUserConfig().isPremium() && BuildVars.DEBUG_PRIVATE_VERSION) {
channelRecommendations.more = 90;
}
this.cachedChannelRecommendations.put(Long.valueOf(j), channelRecommendations);
getNotificationCenter().postNotificationName(NotificationCenter.channelRecommendationsLoaded, new Object[]{Long.valueOf(j)});
}
}
public boolean processDeletedReactionTags(TLRPC.Message message) {
TLRPC.TL_messageReactions tL_messageReactions;
if (message == null || DialogObject.getPeerDialogId(message.peer_id) != getUserConfig().getClientUserId() || (tL_messageReactions = message.reactions) == null || !((TLRPC.MessageReactions) tL_messageReactions).reactions_as_tags || ((TLRPC.MessageReactions) tL_messageReactions).results == null) {
return false;
}
long savedDialogId = MessageObject.getSavedDialogId(getUserConfig().getClientUserId(), message);
boolean z = false;
for (int i = 0; i < ((TLRPC.MessageReactions) message.reactions).results.size(); i++) {
if (updateSavedReactionTags(savedDialogId, ReactionsLayoutInBubble.VisibleReaction.fromTL(((TLRPC.ReactionCount) ((TLRPC.MessageReactions) message.reactions).results.get(i)).reaction), false, false)) {
z = true;
}
}
return z;
}
public boolean updateSavedReactionTags(long topic_id, ReactionsLayoutInBubble.VisibleReaction reaction, boolean add, boolean update) {
if (this.reactionTags == null) {
return false;
}
int i = 0;
boolean z = false;
while (i < 2) {
long j = i == 0 ? 0L : topic_id;
boolean z2 = true;
if (i != 1 || j != 0) {
TLRPC.TL_messages_savedReactionsTags tL_messages_savedReactionsTags = this.reactionTags.get(j);
if (tL_messages_savedReactionsTags == null) {
if (j != 0) {
LongSparseArray<TLRPC.TL_messages_savedReactionsTags> longSparseArray = this.reactionTags;
tL_messages_savedReactionsTags = new TLRPC.TL_messages_savedReactionsTags();
longSparseArray.put(j, tL_messages_savedReactionsTags);
}
}
int i2 = 0;
boolean z3 = false;
boolean z4 = false;
while (i2 < ((TLRPC.messages_SavedReactionTags) tL_messages_savedReactionsTags).tags.size()) {
TLRPC.TL_savedReactionTag tL_savedReactionTag = (TLRPC.TL_savedReactionTag) ((TLRPC.messages_SavedReactionTags) tL_messages_savedReactionsTags).tags.get(i2);
if (reaction.isSame(tL_savedReactionTag.reaction)) {
int i3 = tL_savedReactionTag.count;
int max = Math.max(0, (add ? 1 : -1) + i3);
tL_savedReactionTag.count = max;
if (max <= 0) {
((TLRPC.messages_SavedReactionTags) tL_messages_savedReactionsTags).tags.remove(i2);
i2--;
} else if (max == i3) {
z3 = true;
}
z = true;
z3 = true;
z4 = true;
}
i2++;
}
if (z3 || !add) {
z2 = z4;
} else {
TLRPC.TL_savedReactionTag tL_savedReactionTag2 = new TLRPC.TL_savedReactionTag();
tL_savedReactionTag2.reaction = reaction.toTLReaction();
tL_savedReactionTag2.count = 1;
((TLRPC.messages_SavedReactionTags) tL_messages_savedReactionsTags).tags.add(tL_savedReactionTag2);
z = true;
}
if (update && z2) {
updateSavedReactionTags(j);
}
i++;
}
i++;
}
return z;
}
public void updateSavedReactionTags(HashSet<Long> topic_ids) {
updateSavedReactionTags(0L);
Iterator<Long> it = topic_ids.iterator();
while (it.hasNext()) {
updateSavedReactionTags(it.next().longValue());
}
}
public void updateSavedReactionTags(long topic_id) {
String str;
LongSparseArray<TLRPC.TL_messages_savedReactionsTags> longSparseArray = this.reactionTags;
if (longSparseArray == null) {
return;
}
TLRPC.messages_SavedReactionTags messages_savedreactiontags = (TLRPC.TL_messages_savedReactionsTags) longSparseArray.get(topic_id);
if (messages_savedreactiontags == null) {
if (topic_id == 0) {
return;
}
LongSparseArray<TLRPC.TL_messages_savedReactionsTags> longSparseArray2 = this.reactionTags;
TLRPC.messages_SavedReactionTags tL_messages_savedReactionsTags = new TLRPC.TL_messages_savedReactionsTags();
longSparseArray2.put(topic_id, tL_messages_savedReactionsTags);
messages_savedreactiontags = tL_messages_savedReactionsTags;
}
Collections.sort(messages_savedreactiontags.tags, new MessagesController$.ExternalSyntheticLambda297(this));
long j = 0;
for (int i = 0; i < messages_savedreactiontags.tags.size(); i++) {
TLRPC.TL_savedReactionTag tL_savedReactionTag = (TLRPC.TL_savedReactionTag) messages_savedreactiontags.tags.get(i);
if (tL_savedReactionTag.count > 0) {
TLRPC.TL_reactionEmoji tL_reactionEmoji = tL_savedReactionTag.reaction;
if (tL_reactionEmoji instanceof TLRPC.TL_reactionEmoji) {
j = MediaDataController.calcHash(j, MessagesController$.ExternalSyntheticBackport10.m(Utilities.MD5(tL_reactionEmoji.emoticon).substring(0, 16), 16));
} else if (tL_reactionEmoji instanceof TLRPC.TL_reactionCustomEmoji) {
j = MediaDataController.calcHash(j, ((TLRPC.TL_reactionCustomEmoji) tL_reactionEmoji).document_id);
}
if (topic_id == 0 && (1 & tL_savedReactionTag.flags) != 0 && (str = tL_savedReactionTag.title) != null) {
j = MediaDataController.calcHash(j, MessagesController$.ExternalSyntheticBackport12.m(Utilities.MD5(str).substring(0, 16), 16));
}
j = MediaDataController.calcHash(j, tL_savedReactionTag.count);
}
}
messages_savedreactiontags.hash = j;
saveSavedReactionsTags(topic_id, messages_savedreactiontags);
getNotificationCenter().postNotificationName(NotificationCenter.savedReactionTagsUpdate, new Object[]{Long.valueOf(topic_id)});
}
public int lambda$updateSavedReactionTags$440(TLRPC.TL_savedReactionTag tL_savedReactionTag, TLRPC.TL_savedReactionTag tL_savedReactionTag2) {
int i = tL_savedReactionTag.count;
int i2 = tL_savedReactionTag2.count;
return i == i2 ? MessagesController$.ExternalSyntheticBackport0.m(getTagLongId(tL_savedReactionTag2.reaction), getTagLongId(tL_savedReactionTag.reaction)) : i2 - i;
}
public String getSavedTagName(ReactionsLayoutInBubble.VisibleReaction reaction) {
TLRPC.TL_messages_savedReactionsTags tL_messages_savedReactionsTags;
LongSparseArray<TLRPC.TL_messages_savedReactionsTags> longSparseArray = this.reactionTags;
if (longSparseArray == null || (tL_messages_savedReactionsTags = longSparseArray.get(0L)) == null) {
return null;
}
for (int i = 0; i < ((TLRPC.messages_SavedReactionTags) tL_messages_savedReactionsTags).tags.size(); i++) {
if (reaction.isSame(((TLRPC.TL_savedReactionTag) ((TLRPC.messages_SavedReactionTags) tL_messages_savedReactionsTags).tags.get(i)).reaction)) {
return ((TLRPC.TL_savedReactionTag) ((TLRPC.messages_SavedReactionTags) tL_messages_savedReactionsTags).tags.get(i)).title;
}
}
return null;
}
public int getSavedTagCount(long topic_id, ReactionsLayoutInBubble.VisibleReaction reaction) {
TLRPC.TL_messages_savedReactionsTags tL_messages_savedReactionsTags;
LongSparseArray<TLRPC.TL_messages_savedReactionsTags> longSparseArray = this.reactionTags;
if (longSparseArray == null || (tL_messages_savedReactionsTags = longSparseArray.get(topic_id)) == null) {
return 0;
}
for (int i = 0; i < ((TLRPC.messages_SavedReactionTags) tL_messages_savedReactionsTags).tags.size(); i++) {
if (reaction.isSame(((TLRPC.TL_savedReactionTag) ((TLRPC.messages_SavedReactionTags) tL_messages_savedReactionsTags).tags.get(i)).reaction)) {
return ((TLRPC.TL_savedReactionTag) ((TLRPC.messages_SavedReactionTags) tL_messages_savedReactionsTags).tags.get(i)).count;
}
}
return 0;
}
public String getSavedTagName(TLRPC.Reaction reaction) {
TLRPC.TL_messages_savedReactionsTags tL_messages_savedReactionsTags;
LongSparseArray<TLRPC.TL_messages_savedReactionsTags> longSparseArray = this.reactionTags;
if (longSparseArray == null || (tL_messages_savedReactionsTags = longSparseArray.get(0L)) == null) {
return null;
}
for (int i = 0; i < ((TLRPC.messages_SavedReactionTags) tL_messages_savedReactionsTags).tags.size(); i++) {
if (ReactionsLayoutInBubble.reactionsEqual(reaction, ((TLRPC.TL_savedReactionTag) ((TLRPC.messages_SavedReactionTags) tL_messages_savedReactionsTags).tags.get(i)).reaction)) {
return ((TLRPC.TL_savedReactionTag) ((TLRPC.messages_SavedReactionTags) tL_messages_savedReactionsTags).tags.get(i)).title;
}
}
return null;
}
public void renameSavedReactionTag(ReactionsLayoutInBubble.VisibleReaction reaction, String name) {
boolean z;
boolean z2;
String str;
LongSparseArray<TLRPC.TL_messages_savedReactionsTags> longSparseArray = this.reactionTags;
if (longSparseArray == null) {
return;
}
TLRPC.messages_SavedReactionTags messages_savedreactiontags = (TLRPC.TL_messages_savedReactionsTags) longSparseArray.get(0L);
if (messages_savedreactiontags == null) {
LongSparseArray<TLRPC.TL_messages_savedReactionsTags> longSparseArray2 = this.reactionTags;
TLRPC.messages_SavedReactionTags tL_messages_savedReactionsTags = new TLRPC.TL_messages_savedReactionsTags();
longSparseArray2.put(0L, tL_messages_savedReactionsTags);
messages_savedreactiontags = tL_messages_savedReactionsTags;
}
int i = 0;
while (true) {
if (i >= messages_savedreactiontags.tags.size()) {
z = false;
z2 = false;
break;
}
TLRPC.TL_savedReactionTag tL_savedReactionTag = (TLRPC.TL_savedReactionTag) messages_savedreactiontags.tags.get(i);
if (reaction.isSame(tL_savedReactionTag.reaction)) {
if (TextUtils.isEmpty(name)) {
z = tL_savedReactionTag.title != null;
tL_savedReactionTag.flags &= -2;
tL_savedReactionTag.title = null;
} else {
z = !TextUtils.equals(tL_savedReactionTag.title, name);
tL_savedReactionTag.flags |= 1;
tL_savedReactionTag.title = name;
}
z2 = true;
} else {
i++;
}
}
if (!z2) {
TLRPC.TL_savedReactionTag tL_savedReactionTag2 = new TLRPC.TL_savedReactionTag();
tL_savedReactionTag2.reaction = reaction.toTLReaction();
if (!TextUtils.isEmpty(name)) {
tL_savedReactionTag2.title = name;
}
tL_savedReactionTag2.count = 1;
messages_savedreactiontags.tags.add(tL_savedReactionTag2);
z = true;
}
if (z) {
TLRPC.TL_messages_updateSavedReactionTag tL_messages_updateSavedReactionTag = new TLRPC.TL_messages_updateSavedReactionTag();
tL_messages_updateSavedReactionTag.reaction = reaction.toTLReaction();
if (!TextUtils.isEmpty(name)) {
tL_messages_updateSavedReactionTag.flags |= 1;
tL_messages_updateSavedReactionTag.title = name;
}
getConnectionsManager().sendRequest(tL_messages_updateSavedReactionTag, null);
Collections.sort(messages_savedreactiontags.tags, new MessagesController$.ExternalSyntheticLambda298(this));
long j = 0;
for (int i2 = 0; i2 < messages_savedreactiontags.tags.size(); i2++) {
TLRPC.TL_savedReactionTag tL_savedReactionTag3 = (TLRPC.TL_savedReactionTag) messages_savedreactiontags.tags.get(i2);
if (tL_savedReactionTag3.count > 0) {
TLRPC.TL_reactionEmoji tL_reactionEmoji = tL_savedReactionTag3.reaction;
if (tL_reactionEmoji instanceof TLRPC.TL_reactionEmoji) {
j = MediaDataController.calcHash(j, MessagesController$.ExternalSyntheticBackport9.m(Utilities.MD5(tL_reactionEmoji.emoticon).substring(0, 16), 16));
} else if (tL_reactionEmoji instanceof TLRPC.TL_reactionCustomEmoji) {
j = MediaDataController.calcHash(j, ((TLRPC.TL_reactionCustomEmoji) tL_reactionEmoji).document_id);
}
if ((tL_savedReactionTag3.flags & 1) != 0 && (str = tL_savedReactionTag3.title) != null) {
j = MediaDataController.calcHash(j, MessagesController$.ExternalSyntheticBackport11.m(Utilities.MD5(str).substring(0, 16), 16));
}
j = MediaDataController.calcHash(j, tL_savedReactionTag3.count);
}
}
messages_savedreactiontags.hash = j;
saveSavedReactionsTags(0L, messages_savedreactiontags);
getNotificationCenter().postNotificationName(NotificationCenter.savedReactionTagsUpdate, new Object[]{0L});
}
}
public int lambda$renameSavedReactionTag$441(TLRPC.TL_savedReactionTag tL_savedReactionTag, TLRPC.TL_savedReactionTag tL_savedReactionTag2) {
int i = tL_savedReactionTag.count;
int i2 = tL_savedReactionTag2.count;
return i == i2 ? MessagesController$.ExternalSyntheticBackport0.m(getTagLongId(tL_savedReactionTag2.reaction), getTagLongId(tL_savedReactionTag.reaction)) : i2 - i;
}
private long getTagLongId(TLRPC.Reaction reaction) {
if (reaction == null) {
return 0L;
}
long j = reaction.tag_long_id;
if (j != 0) {
return j;
}
if (reaction instanceof TLRPC.TL_reactionEmoji) {
long m = MessagesController$.ExternalSyntheticBackport8.m(Utilities.MD5(((TLRPC.TL_reactionEmoji) reaction).emoticon).substring(0, 16), 16);
reaction.tag_long_id = m;
return m;
}
if (!(reaction instanceof TLRPC.TL_reactionCustomEmoji)) {
return 0L;
}
long j2 = ((TLRPC.TL_reactionCustomEmoji) reaction).document_id;
reaction.tag_long_id = j2;
return j2;
}
public TLRPC.TL_messages_savedReactionsTags getSavedReactionTags(long topic_id) {
return getSavedReactionTags(topic_id, false);
}
public TLRPC.TL_messages_savedReactionsTags getSavedReactionTags(long topic_id, boolean force) {
HashSet<Long> hashSet = this.loadingReactionTags;
if (hashSet != null && hashSet.contains(Long.valueOf(topic_id)) && !force) {
LongSparseArray<TLRPC.TL_messages_savedReactionsTags> longSparseArray = this.reactionTags;
if (longSparseArray == null) {
return null;
}
return longSparseArray.get(topic_id);
}
if (this.loadingReactionTags == null) {
this.loadingReactionTags = new HashSet<>();
}
this.loadingReactionTags.add(Long.valueOf(topic_id));
getMessagesStorage().getStorageQueue().postRunnable(new MessagesController$.ExternalSyntheticLambda90(this, topic_id));
return null;
}
public void lambda$getSavedReactionTags$445(long r8) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.messenger.MessagesController.lambda$getSavedReactionTags$445(long):void");
}
public void lambda$getSavedReactionTags$444(TLRPC.messages_SavedReactionTags messages_savedreactiontags, long j) {
if (this.reactionTags == null) {
this.reactionTags = new LongSparseArray<>();
}
boolean z = messages_savedreactiontags instanceof TLRPC.TL_messages_savedReactionsTags;
if (z) {
this.reactionTags.put(j, (TLRPC.TL_messages_savedReactionsTags) messages_savedreactiontags);
getNotificationCenter().postNotificationName(NotificationCenter.savedReactionTagsUpdate, new Object[]{Long.valueOf(j)});
}
TLRPC.TL_messages_getSavedReactionTags tL_messages_getSavedReactionTags = new TLRPC.TL_messages_getSavedReactionTags();
if (z) {
tL_messages_getSavedReactionTags.hash = messages_savedreactiontags.hash;
}
if (j != 0) {
tL_messages_getSavedReactionTags.flags |= 1;
tL_messages_getSavedReactionTags.peer = getInputPeer(j);
}
getConnectionsManager().sendRequest(tL_messages_getSavedReactionTags, new MessagesController$.ExternalSyntheticLambda412(this, j, messages_savedreactiontags, tL_messages_getSavedReactionTags));
}
public void lambda$getSavedReactionTags$443(long j, TLRPC.messages_SavedReactionTags messages_savedreactiontags, TLRPC.TL_messages_getSavedReactionTags tL_messages_getSavedReactionTags, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda200(this, tLObject, j, messages_savedreactiontags, tL_messages_getSavedReactionTags));
}
public void lambda$getSavedReactionTags$442(TLObject tLObject, long j, TLRPC.messages_SavedReactionTags messages_savedreactiontags, TLRPC.TL_messages_getSavedReactionTags tL_messages_getSavedReactionTags) {
if (tLObject instanceof TLRPC.TL_messages_savedReactionsTags) {
TLRPC.TL_messages_savedReactionsTags tL_messages_savedReactionsTags = (TLRPC.TL_messages_savedReactionsTags) tLObject;
this.reactionTags.put(j, tL_messages_savedReactionsTags);
getNotificationCenter().postNotificationName(NotificationCenter.savedReactionTagsUpdate, new Object[]{Long.valueOf(j)});
saveSavedReactionsTags(j, tL_messages_savedReactionsTags);
return;
}
if ((tLObject instanceof TLRPC.TL_messages_savedReactionsTagsNotModified) && messages_savedreactiontags == null && tL_messages_getSavedReactionTags.hash == 0) {
TLRPC.TL_messages_savedReactionsTags tL_messages_savedReactionsTags2 = new TLRPC.TL_messages_savedReactionsTags();
this.reactionTags.put(j, tL_messages_savedReactionsTags2);
getNotificationCenter().postNotificationName(NotificationCenter.savedReactionTagsUpdate, new Object[]{Long.valueOf(j)});
saveSavedReactionsTags(j, tL_messages_savedReactionsTags2);
}
}
private void saveSavedReactionsTags(long topic_id, TLRPC.TL_messages_savedReactionsTags res) {
getMessagesStorage().getStorageQueue().postRunnable(new MessagesController$.ExternalSyntheticLambda140(this, topic_id, res));
}
public void lambda$saveSavedReactionsTags$446(long j, TLRPC.TL_messages_savedReactionsTags tL_messages_savedReactionsTags) {
SQLiteDatabase database = getMessagesStorage().getDatabase();
SQLitePreparedStatement sQLitePreparedStatement = null;
try {
try {
database.executeFast("DELETE FROM saved_reaction_tags WHERE topic_id = " + j).stepThis().dispose();
sQLitePreparedStatement = database.executeFast("REPLACE INTO saved_reaction_tags VALUES(?, ?)");
sQLitePreparedStatement.requery();
NativeByteBuffer nativeByteBuffer = new NativeByteBuffer(tL_messages_savedReactionsTags.getObjectSize());
tL_messages_savedReactionsTags.serializeToStream(nativeByteBuffer);
sQLitePreparedStatement.bindLong(1, j);
sQLitePreparedStatement.bindByteBuffer(2, nativeByteBuffer);
sQLitePreparedStatement.step();
} catch (Exception e) {
FileLog.e(e);
if (sQLitePreparedStatement == null) {
return;
}
}
sQLitePreparedStatement.dispose();
} catch (Throwable th) {
if (sQLitePreparedStatement != null) {
sQLitePreparedStatement.dispose();
}
throw th;
}
}
public void checkPeerColors(boolean force) {
PeerColors peerColors;
if (getUserConfig().getCurrentUser() == null) {
return;
}
if (!this.loadingPeerColors && ((peerColors = this.peerColors) == null || peerColors.needUpdate() || force)) {
this.loadingPeerColors = true;
TLRPC.TL_help_getPeerColors tL_help_getPeerColors = new TLRPC.TL_help_getPeerColors();
PeerColors peerColors2 = this.peerColors;
tL_help_getPeerColors.hash = peerColors2 != null ? peerColors2.hash : 0;
if (peerColors2 != null && peerColors2.needUpdate()) {
tL_help_getPeerColors.hash = 0;
}
getConnectionsManager().sendRequest(tL_help_getPeerColors, new MessagesController$.ExternalSyntheticLambda323(this));
}
if (this.loadingProfilePeerColors) {
return;
}
PeerColors peerColors3 = this.profilePeerColors;
if (peerColors3 == null || peerColors3.needUpdate() || force) {
this.loadingProfilePeerColors = true;
TLRPC.TL_help_getPeerProfileColors tL_help_getPeerProfileColors = new TLRPC.TL_help_getPeerProfileColors();
PeerColors peerColors4 = this.profilePeerColors;
tL_help_getPeerProfileColors.hash = peerColors4 != null ? peerColors4.hash : 0;
if (peerColors4 != null && peerColors4.needUpdate()) {
tL_help_getPeerProfileColors.hash = 0;
}
getConnectionsManager().sendRequest(tL_help_getPeerProfileColors, new MessagesController$.ExternalSyntheticLambda329(this));
}
}
public void lambda$checkPeerColors$448(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject instanceof TLRPC.TL_help_peerColors) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda189(this, tLObject));
}
}
public void lambda$checkPeerColors$447(TLObject tLObject) {
this.loadingPeerColors = false;
this.peerColors = PeerColors.fromTL(0, (TLRPC.TL_help_peerColors) tLObject);
this.mainPreferences.edit().putString("peerColors", this.peerColors.toString()).apply();
}
public void lambda$checkPeerColors$450(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tLObject instanceof TLRPC.TL_help_peerColors) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda190(this, tLObject));
}
}
public void lambda$checkPeerColors$449(TLObject tLObject) {
this.loadingProfilePeerColors = false;
this.profilePeerColors = PeerColors.fromTL(1, (TLRPC.TL_help_peerColors) tLObject);
this.mainPreferences.edit().putString("profilePeerColors", this.profilePeerColors.toString()).apply();
}
public void setStoryQuality(boolean full) {
if (this.storyQualityFull != full) {
SharedPreferences.Editor edit = this.mainPreferences.edit();
this.storyQualityFull = full;
edit.putBoolean("storyQualityFull", full).apply();
getNotificationCenter().postNotificationName(NotificationCenter.storyQualityUpdate, new Object[0]);
}
}
public void setSavedViewAs(boolean chats) {
if (this.savedViewAsChats != chats) {
SharedPreferences.Editor edit = this.mainPreferences.edit();
this.savedViewAsChats = chats;
edit.putBoolean("savedViewAsChats", chats).apply();
}
}
public void setFolderTags(boolean value) {
SharedPreferences.Editor edit = this.mainPreferences.edit();
this.folderTags = value;
edit.putBoolean("folderTags", value).apply();
}
public boolean isStoryQualityFullOnAccount() {
return getUserConfig().isPremium() && this.storyQualityFull;
}
public static boolean isStoryQualityFull() {
return getInstance(UserConfig.selectedAccount).isStoryQualityFullOnAccount();
}
public boolean isUserPremiumBlocked(long userId) {
return isUserPremiumBlocked(userId, false);
}
public boolean isUserPremiumBlocked(long userId, boolean cache) {
if (!getUserConfig().isPremium() && getUserConfig().getClientUserId() != userId) {
Boolean bool = this.cachedIsUserPremiumBlocked.get(userId);
if (bool != null) {
return bool.booleanValue();
}
TLRPC$User user = getUser(Long.valueOf(userId));
if (user != null && !user.contact_require_premium) {
return false;
}
TLRPC.UserFull userFull = getUserFull(userId);
if (userFull != null) {
return userFull.contact_require_premium;
}
if (getInputUser(userId) == null || cache) {
return false;
}
this.loadingIsUserPremiumBlocked.add(Long.valueOf(userId));
AndroidUtilities.cancelRunOnUIThread(this.requestIsUserPremiumBlockedRunnable);
AndroidUtilities.runOnUIThread(this.requestIsUserPremiumBlockedRunnable, 60L);
}
return false;
}
public void invalidateUserPremiumBlocked(long userId, int classGuid) {
if (this.loadingFullUsers.contains(Long.valueOf(userId))) {
return;
}
int indexOfKey = this.loadedFullUsers.indexOfKey(userId);
if (indexOfKey >= 0) {
this.loadedFullUsers.removeAt(indexOfKey);
}
loadFullUser(getUser(Long.valueOf(userId)), classGuid, true);
}
public void requestIsUserPremiumBlocked() {
if (this.loadingIsUserPremiumBlocked.isEmpty()) {
return;
}
TLRPC.TL_users_getIsPremiumRequiredToContact tL_users_getIsPremiumRequiredToContact = new TLRPC.TL_users_getIsPremiumRequiredToContact();
ArrayList arrayList = new ArrayList();
Iterator<Long> it = this.loadingIsUserPremiumBlocked.iterator();
while (it.hasNext()) {
long longValue = it.next().longValue();
TLRPC.InputUser inputUser = getInputUser(longValue);
if (inputUser != null) {
tL_users_getIsPremiumRequiredToContact.id.add(inputUser);
arrayList.add(Long.valueOf(longValue));
}
}
this.loadingIsUserPremiumBlocked.clear();
if (tL_users_getIsPremiumRequiredToContact.id.isEmpty()) {
return;
}
getConnectionsManager().sendRequest(tL_users_getIsPremiumRequiredToContact, new MessagesController$.ExternalSyntheticLambda423(this, arrayList));
}
public void lambda$requestIsUserPremiumBlocked$452(ArrayList arrayList, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new MessagesController$.ExternalSyntheticLambda201(this, tLObject, arrayList));
}
public void lambda$requestIsUserPremiumBlocked$451(TLObject tLObject, ArrayList arrayList) {
boolean z;
if (tLObject instanceof TLRPC.Vector) {
ArrayList arrayList2 = ((TLRPC.Vector) tLObject).objects;
z = false;
for (int i = 0; i < Math.min(arrayList.size(), arrayList2.size()); i++) {
long longValue = ((Long) arrayList.get(i)).longValue();
boolean z2 = arrayList2.get(i) instanceof TLRPC.TL_boolTrue;
Boolean bool = this.cachedIsUserPremiumBlocked.get(longValue);
if (bool == null || bool.booleanValue() != z2) {
this.cachedIsUserPremiumBlocked.put(longValue, Boolean.valueOf(z2));
z = true;
}
TLRPC.UserFull userFull = getUserFull(longValue);
if (userFull != null && userFull.contact_require_premium != z2) {
userFull.contact_require_premium = z2;
getMessagesStorage().updateUserInfo(userFull, true);
} else if (userFull == null) {
getMessagesStorage().updateUserInfoPremiumBlocked(longValue, z2);
}
z = true;
}
} else {
z = false;
}
if (z) {
getNotificationCenter().postNotificationName(NotificationCenter.userIsPremiumBlockedUpadted, new Object[0]);
}
}
public void disableAds(boolean send) {
TLRPC.UserFull userFull = getUserFull(getUserConfig().getClientUserId());
if (userFull == null) {
return;
}
userFull.sponsored_enabled = false;
getMessagesStorage().updateUserInfo(userFull, false);
if (send) {
TLRPC.TL_account_toggleSponsoredMessages tL_account_toggleSponsoredMessages = new TLRPC.TL_account_toggleSponsoredMessages();
tL_account_toggleSponsoredMessages.enabled = false;
getConnectionsManager().sendRequest(tL_account_toggleSponsoredMessages, null);
}
}
public boolean isSponsoredDisabled() {
if (getUserFull(getUserConfig().getClientUserId()) == null) {
return false;
}
return !r0.sponsored_enabled;
}
public TLRPC.messages_AvailableEffects getAvailableEffects() {
if (!this.loadingAvailableEffects) {
this.loadingAvailableEffects = true;
this.effectsFetcher.fetch(this.currentAccount, 0, new MessagesController$.ExternalSyntheticLambda317(this));
}
return this.availableEffects;
}
public void lambda$getAvailableEffects$453(TLRPC.messages_AvailableEffects messages_availableeffects) {
if (this.availableEffects != messages_availableeffects) {
this.availableEffects = messages_availableeffects;
if (messages_availableeffects != null) {
AnimatedEmojiDrawable.getDocumentFetcher(this.currentAccount).putDocuments(this.availableEffects.documents);
}
getNotificationCenter().postNotificationName(NotificationCenter.availableEffectsUpdate, new Object[0]);
}
this.loadingAvailableEffects = false;
}
public boolean hasAvailableEffects() {
TLRPC.messages_AvailableEffects messages_availableeffects = this.availableEffects;
return (messages_availableeffects == null || messages_availableeffects.effects.isEmpty()) ? false : true;
}
public TLRPC.TL_availableEffect getEffect(long id) {
getAvailableEffects();
if (this.availableEffects == null) {
return null;
}
for (int i = 0; i < this.availableEffects.effects.size(); i++) {
if (((TLRPC.TL_availableEffect) this.availableEffects.effects.get(i)).id == id) {
return (TLRPC.TL_availableEffect) this.availableEffects.effects.get(i);
}
}
return null;
}
public TLRPC$Document getEffectDocument(long documentId) {
if (this.availableEffects == null) {
return null;
}
for (int i = 0; i < this.availableEffects.documents.size(); i++) {
if (((TLRPC$Document) this.availableEffects.documents.get(i)).id == documentId) {
return (TLRPC$Document) this.availableEffects.documents.get(i);
}
}
return null;
}
}