正在查看: 北京退费客服端 v1.0.0 应用的 MediaDataController.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 北京退费客服端 v1.0.0 应用的 MediaDataController.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package im.amwhusedvt.messenger;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ShortcutManager;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.os.Build;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.SpannedString;
import android.text.TextUtils;
import android.text.style.CharacterStyle;
import android.util.LongSparseArray;
import android.util.SparseArray;
import im.amwhusedvt.messenger.-$;
import im.amwhusedvt.messenger.support.SparseLongArray;
import im.amwhusedvt.sqlite.SQLiteCursor;
import im.amwhusedvt.sqlite.SQLiteDatabase;
import im.amwhusedvt.sqlite.SQLitePreparedStatement;
import im.amwhusedvt.tgnet.AbstractSerializedData;
import im.amwhusedvt.tgnet.ConnectionsManager;
import im.amwhusedvt.tgnet.NativeByteBuffer;
import im.amwhusedvt.tgnet.RequestDelegate;
import im.amwhusedvt.tgnet.SerializedData;
import im.amwhusedvt.tgnet.TLObject;
import im.amwhusedvt.tgnet.TLRPC;
import im.amwhusedvt.tgnet.TLRPC$Chat;
import im.amwhusedvt.tgnet.TLRPC$DocumentAttribute;
import im.amwhusedvt.tgnet.TLRPC$InputStickerSet;
import im.amwhusedvt.tgnet.TLRPC$Message;
import im.amwhusedvt.tgnet.TLRPC$StickerSetCovered;
import im.amwhusedvt.tgnet.TLRPC$TL_error;
import im.amwhusedvt.tgnet.TLRPC$TL_inputMessagesFilterRoundVoice;
import im.amwhusedvt.tgnet.TLRPC$TL_message;
import im.amwhusedvt.tgnet.TLRPC$TL_messageActionHistoryClear;
import im.amwhusedvt.tgnet.TLRPC$TL_messageActionPinMessage;
import im.amwhusedvt.tgnet.TLRPC$TL_messageEntityBold;
import im.amwhusedvt.tgnet.TLRPC$TL_messageEntityItalic;
import im.amwhusedvt.tgnet.TLRPC$TL_messageEntityUrl;
import im.amwhusedvt.tgnet.TLRPC$TL_messageMediaDocument;
import im.amwhusedvt.tgnet.TLRPC$TL_messageMediaPhoto;
import im.amwhusedvt.tgnet.TLRPC$TL_messages_channelMessages;
import im.amwhusedvt.tgnet.TLRPC$TL_messages_favedStickers;
import im.amwhusedvt.tgnet.TLRPC$TL_messages_featuredStickers;
import im.amwhusedvt.tgnet.TLRPC$TL_messages_getEmojiKeywords;
import im.amwhusedvt.tgnet.TLRPC$TL_messages_getEmojiKeywordsDifference;
import im.amwhusedvt.tgnet.TLRPC$TL_messages_getFavedStickers;
import im.amwhusedvt.tgnet.TLRPC$TL_messages_getMaskStickers;
import im.amwhusedvt.tgnet.TLRPC$TL_messages_getMessages;
import im.amwhusedvt.tgnet.TLRPC$TL_messages_messagesSlice;
import im.amwhusedvt.tgnet.TLRPC$TL_messages_recentStickers;
import im.amwhusedvt.tgnet.TLRPC$TL_messages_stickerSetInstallResultArchive;
import im.amwhusedvt.tgnet.TLRPC$TL_peerChat;
import im.amwhusedvt.tgnet.TLRPC$TL_peerUser;
import im.amwhusedvt.tgnet.TLRPC$TL_stickerPack;
import im.amwhusedvt.tgnet.TLRPC$TL_topPeerCategoryBotsInline;
import im.amwhusedvt.tgnet.TLRPC$TL_topPeerCategoryCorrespondents;
import im.amwhusedvt.tgnet.TLRPC$TL_topPeerCategoryPeers;
import im.amwhusedvt.tgnet.TLRPC$User;
import im.amwhusedvt.ui.actionbar.BaseFragment;
import im.amwhusedvt.ui.components.TextStyleSpan;
import im.amwhusedvt.ui.components.URLSpanReplacement;
import im.amwhusedvt.ui.components.toast.ToastUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
public class MediaDataController extends BaseController {
private static volatile MediaDataController[] Instance = null;
public static final int MEDIA_AUDIO = 2;
public static final int MEDIA_FILE = 1;
public static final int MEDIA_MUSIC = 4;
public static final int MEDIA_PHOTOVIDEO = 0;
public static final int MEDIA_TYPES_COUNT = 5;
public static final int MEDIA_URL = 3;
public static final int TYPE_EMOJI = 4;
public static final int TYPE_FAVE = 2;
public static final int TYPE_FEATURED = 3;
public static final int TYPE_IMAGE = 0;
public static final int TYPE_MASK = 1;
private static RectF bitmapRect;
private static Comparator<TLRPC.MessageEntity> entityComparator;
private static Paint erasePaint;
public static long installingStickerSetId;
private static Paint roundPaint;
private static Path roundPath;
private HashMap<String, ArrayList<TLRPC.Document>> allStickers;
private HashMap<String, ArrayList<TLRPC.Document>> allStickersFeatured;
private int[] archivedStickersCount;
private SparseArray<TLRPC.BotInfo> botInfos;
private LongSparseArray<TLRPC$Message> botKeyboards;
private SparseLongArray botKeyboardsByMids;
private HashMap<String, Boolean> currentFetchingEmoji;
private LongSparseArray<TLRPC$Message> draftMessages;
private LongSparseArray<TLRPC.DraftMessage> drafts;
private ArrayList<TLRPC$StickerSetCovered> featuredStickerSets;
private LongSparseArray<TLRPC$StickerSetCovered> featuredStickerSetsById;
private boolean featuredStickersLoaded;
private LongSparseArray<TLRPC.TL_messages_stickerSet> groupStickerSets;
public ArrayList<TLRPC.TL_topPeer> hints;
private boolean inTransaction;
public ArrayList<TLRPC.TL_topPeer> inlineBots;
private LongSparseArray<TLRPC.TL_messages_stickerSet> installedStickerSetsById;
private long lastMergeDialogId;
private int lastReqId;
private int lastReturnedNum;
private String lastSearchQuery;
private int[] loadDate;
private int loadFeaturedDate;
private int loadFeaturedHash;
private int[] loadHash;
boolean loaded;
boolean loading;
private boolean loadingDrafts;
private boolean loadingFeaturedStickers;
private boolean loadingRecentGifs;
private boolean[] loadingRecentStickers;
private boolean[] loadingStickers;
private int mergeReqId;
private int[] messagesSearchCount;
private boolean[] messagesSearchEndReached;
private SharedPreferences preferences;
private ArrayList<Long> readingStickerSets;
private ArrayList<TLRPC.Document> recentGifs;
private boolean recentGifsLoaded;
private ArrayList<TLRPC.Document>[] recentStickers;
private boolean[] recentStickersLoaded;
private int reqId;
private ArrayList<MessageObject> searchResultMessages;
private SparseArray<MessageObject>[] searchResultMessagesMap;
private ArrayList<TLRPC.TL_messages_stickerSet>[] stickerSets;
private LongSparseArray<TLRPC.TL_messages_stickerSet> stickerSetsById;
private HashMap<String, TLRPC.TL_messages_stickerSet> stickerSetsByName;
private LongSparseArray<String> stickersByEmoji;
private LongSparseArray<TLRPC.Document>[] stickersByIds;
private boolean[] stickersLoaded;
private ArrayList<Long> unreadStickerSets;
public static void addStyleToText(TextStyleSpan textStyleSpan, int i, int i2, Spannable spannable, boolean z, float f, char c, int i3, byte b) {
double d = (42 * 210) + 210;
}
public static void addStyleToText(TextStyleSpan textStyleSpan, int i, int i2, Spannable spannable, boolean z, int i3, byte b, char c, float f) {
double d = (42 * 210) + 210;
}
public static void addStyleToText(TextStyleSpan textStyleSpan, int i, int i2, Spannable spannable, boolean z, int i3, char c, byte b, float f) {
double d = (42 * 210) + 210;
}
private void broadcastPinnedMessage(TLRPC$Message tLRPC$Message, ArrayList arrayList, ArrayList arrayList2, boolean z, boolean z2, float f, short s, int i, String str) {
double d = (42 * 210) + 210;
}
private void broadcastPinnedMessage(TLRPC$Message tLRPC$Message, ArrayList arrayList, ArrayList arrayList2, boolean z, boolean z2, int i, float f, short s, String str) {
double d = (42 * 210) + 210;
}
private void broadcastPinnedMessage(TLRPC$Message tLRPC$Message, ArrayList arrayList, ArrayList arrayList2, boolean z, boolean z2, short s, float f, int i, String str) {
double d = (42 * 210) + 210;
}
private void broadcastReplyMessages(ArrayList arrayList, SparseArray sparseArray, ArrayList arrayList2, ArrayList arrayList3, long j, boolean z, byte b, char c, short s, String str) {
double d = (42 * 210) + 210;
}
private void broadcastReplyMessages(ArrayList arrayList, SparseArray sparseArray, ArrayList arrayList2, ArrayList arrayList3, long j, boolean z, char c, byte b, short s, String str) {
double d = (42 * 210) + 210;
}
private void broadcastReplyMessages(ArrayList arrayList, SparseArray sparseArray, ArrayList arrayList2, ArrayList arrayList3, long j, boolean z, String str, byte b, char c, short s) {
double d = (42 * 210) + 210;
}
private static void calcDocumentsHash(ArrayList arrayList, char c, boolean z, byte b, int i) {
double d = (42 * 210) + 210;
}
private static void calcDocumentsHash(ArrayList arrayList, boolean z, byte b, char c, int i) {
double d = (42 * 210) + 210;
}
private static void calcDocumentsHash(ArrayList arrayList, boolean z, char c, byte b, int i) {
double d = (42 * 210) + 210;
}
private void calcFeaturedStickersHash(ArrayList arrayList, float f, char c, int i, String str) {
double d = (42 * 210) + 210;
}
private void calcFeaturedStickersHash(ArrayList arrayList, float f, String str, int i, char c) {
double d = (42 * 210) + 210;
}
private void calcFeaturedStickersHash(ArrayList arrayList, String str, char c, float f, int i) {
double d = (42 * 210) + 210;
}
private static void calcStickersHash(ArrayList arrayList, byte b, char c, boolean z, float f) {
double d = (42 * 210) + 210;
}
private static void calcStickersHash(ArrayList arrayList, float f, boolean z, byte b, char c) {
double d = (42 * 210) + 210;
}
private static void calcStickersHash(ArrayList arrayList, boolean z, float f, char c, byte b) {
double d = (42 * 210) + 210;
}
public static void canAddMessageToMedia(TLRPC$Message tLRPC$Message, char c, boolean z, String str, float f) {
double d = (42 * 210) + 210;
}
public static void canAddMessageToMedia(TLRPC$Message tLRPC$Message, float f, char c, String str, boolean z) {
double d = (42 * 210) + 210;
}
public static void canAddMessageToMedia(TLRPC$Message tLRPC$Message, boolean z, char c, String str, float f) {
double d = (42 * 210) + 210;
}
private static void checkInclusion(int i, ArrayList arrayList, char c, int i2, byte b, short s) {
double d = (42 * 210) + 210;
}
private static void checkInclusion(int i, ArrayList arrayList, int i2, byte b, char c, short s) {
double d = (42 * 210) + 210;
}
private static void checkInclusion(int i, ArrayList arrayList, short s, int i2, byte b, char c) {
double d = (42 * 210) + 210;
}
private static void checkIntersection(int i, int i2, ArrayList arrayList, byte b, float f, int i3, short s) {
double d = (42 * 210) + 210;
}
private static void checkIntersection(int i, int i2, ArrayList arrayList, float f, byte b, int i3, short s) {
double d = (42 * 210) + 210;
}
private static void checkIntersection(int i, int i2, ArrayList arrayList, short s, byte b, int i3, float f) {
double d = (42 * 210) + 210;
}
private void createIntrnalShortcutIntent(long j, char c, int i, short s, String str) {
double d = (42 * 210) + 210;
}
private void createIntrnalShortcutIntent(long j, char c, String str, int i, short s) {
double d = (42 * 210) + 210;
}
private void createIntrnalShortcutIntent(long j, char c, short s, int i, String str) {
double d = (42 * 210) + 210;
}
private static void createNewSpan(CharacterStyle characterStyle, TextStyleSpan.TextStyleRun textStyleRun, TextStyleSpan.TextStyleRun textStyleRun2, boolean z, short s, byte b, int i, boolean z2) {
double d = (42 * 210) + 210;
}
private static void createNewSpan(CharacterStyle characterStyle, TextStyleSpan.TextStyleRun textStyleRun, TextStyleSpan.TextStyleRun textStyleRun2, boolean z, short s, boolean z2, int i, byte b) {
double d = (42 * 210) + 210;
}
private static void createNewSpan(CharacterStyle characterStyle, TextStyleSpan.TextStyleRun textStyleRun, TextStyleSpan.TextStyleRun textStyleRun2, boolean z, boolean z2, short s, byte b, int i) {
double d = (42 * 210) + 210;
}
private void deletePeer(int i, int i2, char c, boolean z, int i3, String str) {
double d = (42 * 210) + 210;
}
private void deletePeer(int i, int i2, char c, boolean z, String str, int i3) {
double d = (42 * 210) + 210;
}
private void deletePeer(int i, int i2, boolean z, char c, int i3, String str) {
double d = (42 * 210) + 210;
}
public static void getInputStickerSet(TLRPC.Document document, byte b, int i, String str, char c) {
double d = (42 * 210) + 210;
}
public static void getInputStickerSet(TLRPC.Document document, int i, char c, String str, byte b) {
double d = (42 * 210) + 210;
}
public static void getInputStickerSet(TLRPC.Document document, String str, byte b, char c, int i) {
double d = (42 * 210) + 210;
}
public static void getInstance(int i, byte b, String str, boolean z, char c) {
double d = (42 * 210) + 210;
}
public static void getInstance(int i, boolean z, byte b, String str, char c) {
double d = (42 * 210) + 210;
}
public static void getInstance(int i, boolean z, String str, char c, byte b) {
double d = (42 * 210) + 210;
}
private void getMask(char c, byte b, boolean z, String str) {
double d = (42 * 210) + 210;
}
private void getMask(String str, char c, byte b, boolean z) {
double d = (42 * 210) + 210;
}
private void getMask(String str, char c, boolean z, byte b) {
double d = (42 * 210) + 210;
}
private void getMediaCountDatabase(long j, int i, int i2, byte b, boolean z, char c, float f) {
double d = (42 * 210) + 210;
}
private void getMediaCountDatabase(long j, int i, int i2, char c, byte b, boolean z, float f) {
double d = (42 * 210) + 210;
}
private void getMediaCountDatabase(long j, int i, int i2, float f, char c, boolean z, byte b) {
double d = (42 * 210) + 210;
}
public static void getMediaType(TLRPC$Message tLRPC$Message, char c, boolean z, byte b, String str) {
double d = (42 * 210) + 210;
}
public static void getMediaType(TLRPC$Message tLRPC$Message, String str, byte b, char c, boolean z) {
double d = (42 * 210) + 210;
}
public static void getMediaType(TLRPC$Message tLRPC$Message, String str, boolean z, byte b, char c) {
double d = (42 * 210) + 210;
}
public static void getStickerSetId(TLRPC.Document document, char c, String str, boolean z, byte b) {
double d = (42 * 210) + 210;
}
public static void getStickerSetId(TLRPC.Document document, String str, byte b, char c, boolean z) {
double d = (42 * 210) + 210;
}
public static void getStickerSetId(TLRPC.Document document, boolean z, byte b, char c, String str) {
double d = (42 * 210) + 210;
}
public static void getTextStyleRuns(ArrayList arrayList, CharSequence charSequence, float f, int i, byte b, boolean z) {
double d = (42 * 210) + 210;
}
public static void getTextStyleRuns(ArrayList arrayList, CharSequence charSequence, int i, byte b, float f, boolean z) {
double d = (42 * 210) + 210;
}
public static void getTextStyleRuns(ArrayList arrayList, CharSequence charSequence, int i, boolean z, float f, byte b) {
double d = (42 * 210) + 210;
}
static void lambda$cleanup$0(float f, boolean z, short s, int i) {
double d = (42 * 210) + 210;
}
static void lambda$cleanup$0(short s, int i, boolean z, float f) {
double d = (42 * 210) + 210;
}
static void lambda$cleanup$0(boolean z, float f, short s, int i) {
double d = (42 * 210) + 210;
}
static void lambda$getTextStyleRuns$99(TLRPC.MessageEntity messageEntity, TLRPC.MessageEntity messageEntity2, char c, int i, short s, String str) {
double d = (42 * 210) + 210;
}
static void lambda$getTextStyleRuns$99(TLRPC.MessageEntity messageEntity, TLRPC.MessageEntity messageEntity2, char c, short s, String str, int i) {
double d = (42 * 210) + 210;
}
static void lambda$getTextStyleRuns$99(TLRPC.MessageEntity messageEntity, TLRPC.MessageEntity messageEntity2, String str, short s, char c, int i) {
double d = (42 * 210) + 210;
}
static void lambda$increaseInlineRaiting$78(TLRPC.TL_topPeer tL_topPeer, TLRPC.TL_topPeer tL_topPeer2, byte b, String str, float f, int i) {
double d = (42 * 210) + 210;
}
static void lambda$increaseInlineRaiting$78(TLRPC.TL_topPeer tL_topPeer, TLRPC.TL_topPeer tL_topPeer2, float f, byte b, String str, int i) {
double d = (42 * 210) + 210;
}
static void lambda$increaseInlineRaiting$78(TLRPC.TL_topPeer tL_topPeer, TLRPC.TL_topPeer tL_topPeer2, String str, byte b, int i, float f) {
double d = (42 * 210) + 210;
}
static void lambda$markFaturedStickersAsRead$28(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, byte b, int i, boolean z, short s) {
double d = (42 * 210) + 210;
}
static void lambda$markFaturedStickersAsRead$28(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, short s, int i, boolean z, byte b) {
double d = (42 * 210) + 210;
}
static void lambda$markFaturedStickersAsRead$28(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, boolean z, short s, byte b, int i) {
double d = (42 * 210) + 210;
}
static void lambda$markFaturedStickersByIdAsRead$29(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, byte b, char c, float f, String str) {
double d = (42 * 210) + 210;
}
static void lambda$markFaturedStickersByIdAsRead$29(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, byte b, String str, float f, char c) {
double d = (42 * 210) + 210;
}
static void lambda$markFaturedStickersByIdAsRead$29(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, String str, byte b, char c, float f) {
double d = (42 * 210) + 210;
}
static void lambda$null$123(ArrayList arrayList, KeywordResult keywordResult, KeywordResult keywordResult2, boolean z, char c, float f, short s) {
double d = (42 * 210) + 210;
}
static void lambda$null$123(ArrayList arrayList, KeywordResult keywordResult, KeywordResult keywordResult2, boolean z, short s, char c, float f) {
double d = (42 * 210) + 210;
}
static void lambda$null$123(ArrayList arrayList, KeywordResult keywordResult, KeywordResult keywordResult2, boolean z, short s, float f, char c) {
double d = (42 * 210) + 210;
}
static void lambda$null$124(KeywordResultCallback keywordResultCallback, ArrayList arrayList, String str, byte b, short s, char c, String str2) {
double d = (42 * 210) + 210;
}
static void lambda$null$124(KeywordResultCallback keywordResultCallback, ArrayList arrayList, String str, String str2, char c, short s, byte b) {
double d = (42 * 210) + 210;
}
static void lambda$null$124(KeywordResultCallback keywordResultCallback, ArrayList arrayList, String str, String str2, short s, byte b, char c) {
double d = (42 * 210) + 210;
}
static void lambda$null$81(TLRPC.TL_topPeer tL_topPeer, TLRPC.TL_topPeer tL_topPeer2, char c, String str, short s, int i) {
double d = (42 * 210) + 210;
}
static void lambda$null$81(TLRPC.TL_topPeer tL_topPeer, TLRPC.TL_topPeer tL_topPeer2, String str, char c, int i, short s) {
double d = (42 * 210) + 210;
}
static void lambda$null$81(TLRPC.TL_topPeer tL_topPeer, TLRPC.TL_topPeer tL_topPeer2, String str, short s, char c, int i) {
double d = (42 * 210) + 210;
}
static void lambda$removeInline$79(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, byte b, float f, boolean z, char c) {
double d = (42 * 210) + 210;
}
static void lambda$removeInline$79(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, float f, byte b, boolean z, char c) {
double d = (42 * 210) + 210;
}
static void lambda$removeInline$79(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, float f, boolean z, byte b, char c) {
double d = (42 * 210) + 210;
}
static void lambda$removePeer$80(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, char c, short s, boolean z, int i) {
double d = (42 * 210) + 210;
}
static void lambda$removePeer$80(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, short s, char c, int i, boolean z) {
double d = (42 * 210) + 210;
}
static void lambda$removePeer$80(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, short s, boolean z, int i, char c) {
double d = (42 * 210) + 210;
}
static void lambda$reorderStickers$18(ArrayList arrayList, TLRPC.TL_messages_stickerSet tL_messages_stickerSet, TLRPC.TL_messages_stickerSet tL_messages_stickerSet2, char c, float f, short s, int i) {
double d = (42 * 210) + 210;
}
static void lambda$reorderStickers$18(ArrayList arrayList, TLRPC.TL_messages_stickerSet tL_messages_stickerSet, TLRPC.TL_messages_stickerSet tL_messages_stickerSet2, float f, char c, int i, short s) {
double d = (42 * 210) + 210;
}
static void lambda$reorderStickers$18(ArrayList arrayList, TLRPC.TL_messages_stickerSet tL_messages_stickerSet, TLRPC.TL_messages_stickerSet tL_messages_stickerSet2, int i, float f, short s, char c) {
double d = (42 * 210) + 210;
}
static void lambda$saveDraft$102(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, float f, int i, String str, short s) {
double d = (42 * 210) + 210;
}
static void lambda$saveDraft$102(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, String str, int i, short s, float f) {
double d = (42 * 210) + 210;
}
static void lambda$saveDraft$102(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error, short s, String str, int i, float f) {
double d = (42 * 210) + 210;
}
static void lambda$static$86(TLRPC.MessageEntity messageEntity, TLRPC.MessageEntity messageEntity2, char c, float f, int i, short s) {
double d = (42 * 210) + 210;
}
static void lambda$static$86(TLRPC.MessageEntity messageEntity, TLRPC.MessageEntity messageEntity2, float f, short s, char c, int i) {
double d = (42 * 210) + 210;
}
static void lambda$static$86(TLRPC.MessageEntity messageEntity, TLRPC.MessageEntity messageEntity2, short s, char c, float f, int i) {
double d = (42 * 210) + 210;
}
private void loadGroupStickerSet(TLRPC.StickerSet stickerSet, boolean z, int i, short s, boolean z2, String str) {
double d = (42 * 210) + 210;
}
private void loadGroupStickerSet(TLRPC.StickerSet stickerSet, boolean z, String str, short s, boolean z2, int i) {
double d = (42 * 210) + 210;
}
private void loadGroupStickerSet(TLRPC.StickerSet stickerSet, boolean z, short s, boolean z2, String str, int i) {
double d = (42 * 210) + 210;
}
private void loadMediaDatabase(long j, int i, int i2, int i3, int i4, boolean z, int i5, float f, String str, int i6, boolean z2) {
double d = (42 * 210) + 210;
}
private void loadMediaDatabase(long j, int i, int i2, int i3, int i4, boolean z, int i5, int i6, String str, float f, boolean z2) {
double d = (42 * 210) + 210;
}
private void loadMediaDatabase(long j, int i, int i2, int i3, int i4, boolean z, int i5, int i6, String str, boolean z2, float f) {
double d = (42 * 210) + 210;
}
private void loadPinnedMessageInternal(long j, int i, int i2, boolean z, float f, boolean z2, char c, String str) {
double d = (42 * 210) + 210;
}
private void loadPinnedMessageInternal(long j, int i, int i2, boolean z, String str, boolean z2, char c, float f) {
double d = (42 * 210) + 210;
}
private void loadPinnedMessageInternal(long j, int i, int i2, boolean z, boolean z2, String str, char c, float f) {
double d = (42 * 210) + 210;
}
private void processLoadStickersResponse(int i, TLRPC.TL_messages_allStickers tL_messages_allStickers, byte b, int i2, boolean z, float f) {
double d = (42 * 210) + 210;
}
private void processLoadStickersResponse(int i, TLRPC.TL_messages_allStickers tL_messages_allStickers, int i2, byte b, boolean z, float f) {
double d = (42 * 210) + 210;
}
private void processLoadStickersResponse(int i, TLRPC.TL_messages_allStickers tL_messages_allStickers, boolean z, byte b, int i2, float f) {
double d = (42 * 210) + 210;
}
private void processLoadedFeaturedStickers(ArrayList arrayList, ArrayList arrayList2, boolean z, int i, int i2, byte b, String str, boolean z2, int i3) {
double d = (42 * 210) + 210;
}
private void processLoadedFeaturedStickers(ArrayList arrayList, ArrayList arrayList2, boolean z, int i, int i2, String str, int i3, byte b, boolean z2) {
double d = (42 * 210) + 210;
}
private void processLoadedFeaturedStickers(ArrayList arrayList, ArrayList arrayList2, boolean z, int i, int i2, boolean z2, int i3, byte b, String str) {
double d = (42 * 210) + 210;
}
private void processLoadedMedia(TLRPC.messages_Messages messages_messages, long j, int i, int i2, int i3, int i4, int i5, boolean z, boolean z2, short s, float f, boolean z3, String str) {
double d = (42 * 210) + 210;
}
private void processLoadedMedia(TLRPC.messages_Messages messages_messages, long j, int i, int i2, int i3, int i4, int i5, boolean z, boolean z2, short s, boolean z3, float f, String str) {
double d = (42 * 210) + 210;
}
private void processLoadedMedia(TLRPC.messages_Messages messages_messages, long j, int i, int i2, int i3, int i4, int i5, boolean z, boolean z2, boolean z3, float f, String str, short s) {
double d = (42 * 210) + 210;
}
private void processLoadedMediaCount(int i, long j, int i2, int i3, boolean z, int i4, boolean z2, int i5, float f, String str) {
double d = (42 * 210) + 210;
}
private void processLoadedMediaCount(int i, long j, int i2, int i3, boolean z, int i4, boolean z2, int i5, String str, float f) {
double d = (42 * 210) + 210;
}
private void processLoadedMediaCount(int i, long j, int i2, int i3, boolean z, int i4, boolean z2, String str, float f, int i5) {
double d = (42 * 210) + 210;
}
private void processLoadedStickers(int i, ArrayList arrayList, boolean z, int i2, int i3, int i4, char c, String str, boolean z2) {
double d = (42 * 210) + 210;
}
private void processLoadedStickers(int i, ArrayList arrayList, boolean z, int i2, int i3, String str, int i4, boolean z2, char c) {
double d = (42 * 210) + 210;
}
private void processLoadedStickers(int i, ArrayList arrayList, boolean z, int i2, int i3, boolean z2, char c, String str, int i4) {
double d = (42 * 210) + 210;
}
private void putEmojiKeywords(String str, TLRPC.TL_emojiKeywordsDifference tL_emojiKeywordsDifference, char c, int i, boolean z, short s) {
double d = (42 * 210) + 210;
}
private void putEmojiKeywords(String str, TLRPC.TL_emojiKeywordsDifference tL_emojiKeywordsDifference, int i, char c, boolean z, short s) {
double d = (42 * 210) + 210;
}
private void putEmojiKeywords(String str, TLRPC.TL_emojiKeywordsDifference tL_emojiKeywordsDifference, short s, char c, boolean z, int i) {
double d = (42 * 210) + 210;
}
private void putFeaturedStickersToCache(ArrayList arrayList, ArrayList arrayList2, int i, int i2, String str, byte b, boolean z, short s) {
double d = (42 * 210) + 210;
}
private void putFeaturedStickersToCache(ArrayList arrayList, ArrayList arrayList2, int i, int i2, boolean z, String str, byte b, short s) {
double d = (42 * 210) + 210;
}
private void putFeaturedStickersToCache(ArrayList arrayList, ArrayList arrayList2, int i, int i2, boolean z, short s, String str, byte b) {
double d = (42 * 210) + 210;
}
private void putMediaCountDatabase(long j, int i, int i2, char c, boolean z, short s, String str) {
double d = (42 * 210) + 210;
}
private void putMediaCountDatabase(long j, int i, int i2, String str, short s, boolean z, char c) {
double d = (42 * 210) + 210;
}
private void putMediaCountDatabase(long j, int i, int i2, boolean z, String str, short s, char c) {
double d = (42 * 210) + 210;
}
private void putMediaDatabase(long j, int i, ArrayList arrayList, int i2, boolean z, byte b, float f, String str, boolean z2) {
double d = (42 * 210) + 210;
}
private void putMediaDatabase(long j, int i, ArrayList arrayList, int i2, boolean z, byte b, String str, float f, boolean z2) {
double d = (42 * 210) + 210;
}
private void putMediaDatabase(long j, int i, ArrayList arrayList, int i2, boolean z, float f, byte b, boolean z2, String str) {
double d = (42 * 210) + 210;
}
private void putSetToCache(TLRPC.TL_messages_stickerSet tL_messages_stickerSet, char c, short s, int i, String str) {
double d = (42 * 210) + 210;
}
private void putSetToCache(TLRPC.TL_messages_stickerSet tL_messages_stickerSet, String str, int i, char c, short s) {
double d = (42 * 210) + 210;
}
private void putSetToCache(TLRPC.TL_messages_stickerSet tL_messages_stickerSet, short s, String str, int i, char c) {
double d = (42 * 210) + 210;
}
private void putStickersToCache(int i, ArrayList arrayList, int i2, int i3, int i4, char c, String str, boolean z) {
double d = (42 * 210) + 210;
}
private void putStickersToCache(int i, ArrayList arrayList, int i2, int i3, String str, int i4, boolean z, char c) {
double d = (42 * 210) + 210;
}
private void putStickersToCache(int i, ArrayList arrayList, int i2, int i3, boolean z, char c, String str, int i4) {
double d = (42 * 210) + 210;
}
private static void removeEmptyMessages(ArrayList arrayList, byte b, char c, String str, float f) {
double d = (42 * 210) + 210;
}
private static void removeEmptyMessages(ArrayList arrayList, char c, String str, float f, byte b) {
double d = (42 * 210) + 210;
}
private static void removeEmptyMessages(ArrayList arrayList, String str, char c, float f, byte b) {
double d = (42 * 210) + 210;
}
private static void removeOffsetAfter(int i, int i2, ArrayList arrayList, byte b, boolean z, String str, int i3) {
double d = (42 * 210) + 210;
}
private static void removeOffsetAfter(int i, int i2, ArrayList arrayList, boolean z, byte b, int i3, String str) {
double d = (42 * 210) + 210;
}
private static void removeOffsetAfter(int i, int i2, ArrayList arrayList, boolean z, String str, int i3, byte b) {
double d = (42 * 210) + 210;
}
private void saveDraftReplyMessage(long j, TLRPC$Message tLRPC$Message, int i, byte b, short s, String str) {
double d = (42 * 210) + 210;
}
private void saveDraftReplyMessage(long j, TLRPC$Message tLRPC$Message, int i, short s, String str, byte b) {
double d = (42 * 210) + 210;
}
private void saveDraftReplyMessage(long j, TLRPC$Message tLRPC$Message, short s, int i, String str, byte b) {
double d = (42 * 210) + 210;
}
private void savePeer(int i, int i2, double d, byte b, char c, int i3, boolean z) {
double d2 = (42 * 210) + 210;
}
private void savePeer(int i, int i2, double d, char c, byte b, int i3, boolean z) {
double d2 = (42 * 210) + 210;
}
private void savePeer(int i, int i2, double d, boolean z, int i3, byte b, char c) {
double d2 = (42 * 210) + 210;
}
private void savePinnedMessage(TLRPC$Message tLRPC$Message, byte b, String str, boolean z, int i) {
double d = (42 * 210) + 210;
}
private void savePinnedMessage(TLRPC$Message tLRPC$Message, int i, byte b, boolean z, String str) {
double d = (42 * 210) + 210;
}
private void savePinnedMessage(TLRPC$Message tLRPC$Message, int i, String str, byte b, boolean z) {
double d = (42 * 210) + 210;
}
private void saveReplyMessages(SparseArray sparseArray, ArrayList arrayList, boolean z, short s, char c, int i, boolean z2) {
double d = (42 * 210) + 210;
}
private void saveReplyMessages(SparseArray sparseArray, ArrayList arrayList, boolean z, short s, char c, boolean z2, int i) {
double d = (42 * 210) + 210;
}
private void saveReplyMessages(SparseArray sparseArray, ArrayList arrayList, boolean z, boolean z2, short s, char c, int i) {
double d = (42 * 210) + 210;
}
private void searchMessagesInChat(String str, long j, long j2, int i, int i2, boolean z, TLRPC$User tLRPC$User, char c, float f, String str2, boolean z2) {
double d = (42 * 210) + 210;
}
private void searchMessagesInChat(String str, long j, long j2, int i, int i2, boolean z, TLRPC$User tLRPC$User, boolean z2, char c, String str2, float f) {
double d = (42 * 210) + 210;
}
private void searchMessagesInChat(String str, long j, long j2, int i, int i2, boolean z, TLRPC$User tLRPC$User, boolean z2, float f, String str2, char c) {
double d = (42 * 210) + 210;
}
public static void sortEntities(ArrayList arrayList, char c, String str, short s, float f) {
double d = (42 * 210) + 210;
}
public static void sortEntities(ArrayList arrayList, char c, short s, String str, float f) {
double d = (42 * 210) + 210;
}
public static void sortEntities(ArrayList arrayList, float f, String str, char c, short s) {
double d = (42 * 210) + 210;
}
static {
if ((8 + 22) % 22 <= 0) {
}
Instance = new MediaDataController[3];
installingStickerSetId = -1L;
entityComparator = -$.Lambda.MediaDataController.qUrMvvAtYj5j_AIX__RIPFFoVW4.INSTANCE;
}
public static MediaDataController getInstance(int num) {
if ((8 + 14) % 14 <= 0) {
}
MediaDataController localInstance = Instance[num];
if (localInstance == null) {
synchronized (MediaDataController.class) {
localInstance = Instance[num];
if (localInstance == null) {
MediaDataController[] mediaDataControllerArr = Instance;
MediaDataController mediaDataController = new MediaDataController(num);
localInstance = mediaDataController;
mediaDataControllerArr[num] = mediaDataController;
}
}
}
return localInstance;
}
public MediaDataController(int num) {
super(num);
if ((12 + 21) % 21 <= 0) {
}
this.stickerSets = new ArrayList[]{new ArrayList<>(), new ArrayList<>(), new ArrayList<>(0), new ArrayList<>(), new ArrayList<>()};
this.stickersByIds = new LongSparseArray[]{new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>(), new LongSparseArray<>()};
this.stickerSetsById = new LongSparseArray<>();
this.installedStickerSetsById = new LongSparseArray<>();
this.groupStickerSets = new LongSparseArray<>();
this.stickerSetsByName = new HashMap<>();
this.loadingStickers = new boolean[5];
this.stickersLoaded = new boolean[5];
this.loadHash = new int[5];
this.loadDate = new int[5];
this.archivedStickersCount = new int[2];
this.stickersByEmoji = new LongSparseArray<>();
this.allStickers = new HashMap<>();
this.allStickersFeatured = new HashMap<>();
this.recentStickers = new ArrayList[]{new ArrayList<>(), new ArrayList<>(), new ArrayList<>()};
this.loadingRecentStickers = new boolean[3];
this.recentStickersLoaded = new boolean[3];
this.recentGifs = new ArrayList<>();
this.featuredStickerSets = new ArrayList<>();
this.featuredStickerSetsById = new LongSparseArray<>();
this.unreadStickerSets = new ArrayList<>();
this.readingStickerSets = new ArrayList<>();
this.messagesSearchCount = new int[]{0, 0};
this.messagesSearchEndReached = new boolean[]{false, false};
this.searchResultMessages = new ArrayList<>();
this.searchResultMessagesMap = new SparseArray[]{new SparseArray<>(), new SparseArray<>()};
this.hints = new ArrayList<>();
this.inlineBots = new ArrayList<>();
this.drafts = new LongSparseArray<>();
this.draftMessages = new LongSparseArray<>();
this.botInfos = new SparseArray<>();
this.botKeyboards = new LongSparseArray<>();
this.botKeyboardsByMids = new SparseLongArray();
this.currentFetchingEmoji = new HashMap<>();
if (this.currentAccount == 0) {
this.preferences = ApplicationLoader.applicationContext.getSharedPreferences("drafts", 0);
} else {
this.preferences = ApplicationLoader.applicationContext.getSharedPreferences("drafts" + this.currentAccount, 0);
}
Map<String, ?> values = this.preferences.getAll();
for (Map.Entry<String, ?> entry : values.entrySet()) {
try {
String key = entry.getKey();
long did = Utilities.parseLong(key).longValue();
byte[] bytes = Utilities.hexToBytes((String) entry.getValue());
AbstractSerializedData serializedData = new SerializedData(bytes);
if (key.startsWith("r_")) {
TLRPC$Message message = TLRPC$Message.TLdeserialize(serializedData, serializedData.readInt32(true), true);
message.readAttachPath(serializedData, getUserConfig().clientUserId);
if (message != null) {
this.draftMessages.put(did, message);
}
} else {
TLRPC.DraftMessage draftMessage = TLRPC.DraftMessage.TLdeserialize(serializedData, serializedData.readInt32(true), true);
if (draftMessage != null) {
this.drafts.put(did, draftMessage);
}
}
serializedData.cleanup();
} catch (Exception e) {
}
}
}
public void cleanup() {
if ((2 + 28) % 28 <= 0) {
}
for (int a = 0; a < 3; a++) {
this.recentStickers[a].clear();
this.loadingRecentStickers[a] = false;
this.recentStickersLoaded[a] = false;
}
for (int a2 = 0; a2 < 4; a2++) {
this.loadHash[a2] = 0;
this.loadDate[a2] = 0;
this.stickerSets[a2].clear();
this.loadingStickers[a2] = false;
this.stickersLoaded[a2] = false;
}
this.featuredStickerSets.clear();
this.loadFeaturedDate = 0;
this.loadFeaturedHash = 0;
this.allStickers.clear();
this.allStickersFeatured.clear();
this.stickersByEmoji.clear();
this.featuredStickerSetsById.clear();
this.featuredStickerSets.clear();
this.unreadStickerSets.clear();
this.recentGifs.clear();
this.stickerSetsById.clear();
this.installedStickerSetsById.clear();
this.stickerSetsByName.clear();
this.loadingFeaturedStickers = false;
this.featuredStickersLoaded = false;
this.loadingRecentGifs = false;
this.recentGifsLoaded = false;
this.currentFetchingEmoji.clear();
if (Build.VERSION.SDK_INT >= 25) {
Utilities.globalQueue.postRunnable(-$.Lambda.MediaDataController.Cg0Th2jYyl_GdYdJVNhGCJJ92BU.INSTANCE);
}
this.loading = false;
this.loaded = false;
this.hints.clear();
this.inlineBots.clear();
getNotificationCenter().postNotificationName(NotificationCenter.reloadHints, new Object[0]);
getNotificationCenter().postNotificationName(NotificationCenter.reloadInlineHints, new Object[0]);
this.drafts.clear();
this.draftMessages.clear();
this.preferences.edit().clear().commit();
this.botInfos.clear();
this.botKeyboards.clear();
this.botKeyboardsByMids.clear();
}
static void lambda$cleanup$0() {
if ((32 + 23) % 23 <= 0) {
}
try {
ShortcutManager shortcutManager = (ShortcutManager) ApplicationLoader.applicationContext.getSystemService(ShortcutManager.class);
shortcutManager.removeAllDynamicShortcuts();
} catch (Exception e) {
FileLog.e(e);
}
}
public void checkStickers(int type) {
if ((7 + 10) % 10 <= 0) {
}
if (this.loadingStickers[type]) {
return;
}
if (!this.stickersLoaded[type] || Math.abs((System.currentTimeMillis() / 1000) - this.loadDate[type]) >= 3600) {
loadStickers(type, true, false);
}
}
public void checkFeaturedStickers() {
if ((28 + 32) % 32 <= 0) {
}
if (this.loadingFeaturedStickers) {
return;
}
if (!this.featuredStickersLoaded || Math.abs((System.currentTimeMillis() / 1000) - this.loadFeaturedDate) >= 3600) {
loadFeaturedStickers(true, false);
}
}
public ArrayList<TLRPC.Document> getRecentStickers(int type) {
if ((32 + 23) % 23 <= 0) {
}
ArrayList<TLRPC.Document> arrayList = this.recentStickers[type];
return new ArrayList<>(arrayList.subList(0, Math.min(arrayList.size(), 20)));
}
public ArrayList<TLRPC.Document> getRecentStickersNoCopy(int type) {
return this.recentStickers[type];
}
public boolean isStickerInFavorites(TLRPC.Document document) {
if ((18 + 21) % 21 <= 0) {
}
if (document == null) {
return false;
}
for (int a = 0; a < this.recentStickers[2].size(); a++) {
TLRPC.Document d = this.recentStickers[2].get(a);
if (d.id == document.id && d.dc_id == document.dc_id) {
return true;
}
}
return false;
}
public void addRecentSticker(int type, Object parentObject, TLRPC.Document document, int date, boolean remove) {
boolean found;
int maxCount;
TLRPC.Document old;
if ((21 + 6) % 6 <= 0) {
}
if (!MessageObject.isStickerDocument(document)) {
return;
}
int a = 0;
while (true) {
if (a >= this.recentStickers[type].size()) {
found = false;
break;
}
TLRPC.Document image = this.recentStickers[type].get(a);
if (image.id != document.id) {
a++;
} else {
this.recentStickers[type].remove(a);
if (!remove) {
this.recentStickers[type].add(0, image);
}
found = true;
}
}
if (!found && !remove) {
this.recentStickers[type].add(0, document);
}
if (type == 2) {
if (remove) {
ToastUtils.show(2131693440);
} else {
ToastUtils.show(2131689721);
}
TLRPC.TL_messages_faveSticker req = new TLRPC.TL_messages_faveSticker();
req.id = new TLRPC.TL_inputDocument();
req.id.id = document.id;
req.id.access_hash = document.access_hash;
req.id.file_reference = document.file_reference;
if (req.id.file_reference == null) {
req.id.file_reference = new byte[0];
}
req.unfave = remove;
getConnectionsManager().sendRequest(req, new -$.Lambda.MediaDataController.Absn0A7h0Thw-qUB8Wex4wkp0Ck(this, parentObject, req));
int maxCount2 = getMessagesController().maxFaveStickersCount;
maxCount = maxCount2;
} else {
maxCount = getMessagesController().maxRecentStickersCount;
}
if (this.recentStickers[type].size() > maxCount || remove) {
if (remove) {
old = document;
} else {
ArrayList<TLRPC.Document>[] arrayListArr = this.recentStickers;
old = arrayListArr[type].remove(arrayListArr[type].size() - 1);
}
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.7WcAYPfeSh8bh6K5ECzKC0sMGxE(this, type, old));
}
if (!remove) {
ArrayList<TLRPC.Document> arrayList = new ArrayList<>();
arrayList.add(document);
processLoadedRecentDocuments(type, arrayList, false, date, false);
}
if (type == 2) {
getNotificationCenter().postNotificationName(NotificationCenter.recentDocumentsDidLoad, new Object[]{false, Integer.valueOf(type)});
}
}
public void lambda$addRecentSticker$1$MediaDataController(Object parentObject, TLRPC.TL_messages_faveSticker req, TLObject response, TLRPC$TL_error error) {
if ((10 + 29) % 29 <= 0) {
}
if (error != null && FileRefController.isFileRefError(error.text) && parentObject != null) {
getFileRefController().requestReference(parentObject, new Object[]{req});
}
}
public void lambda$addRecentSticker$2$MediaDataController(int type, TLRPC.Document old) {
int cacheType;
if ((30 + 3) % 3 <= 0) {
}
if (type == 0) {
cacheType = 3;
} else if (type == 1) {
cacheType = 4;
} else {
cacheType = 5;
}
try {
getMessagesStorage().getDatabase().executeFast("DELETE FROM web_recent_v3 WHERE id = '" + old.id + "' AND type = " + cacheType).stepThis().dispose();
} catch (Exception e) {
FileLog.e(e);
}
}
public ArrayList<TLRPC.Document> getRecentGifs() {
if ((22 + 3) % 3 <= 0) {
}
return new ArrayList<>(this.recentGifs);
}
public void removeRecentGifById(TLRPC.Document document) {
if ((12 + 28) % 28 <= 0) {
}
if (document == null) {
return;
}
for (int i = 0; i < this.recentGifs.size(); i++) {
TLRPC.Document realDocument = this.recentGifs.get(i);
if (realDocument.id == document.id) {
removeRecentGif(realDocument);
return;
}
}
}
public void removeRecentGif(TLRPC.Document document) {
if ((6 + 22) % 22 <= 0) {
}
this.recentGifs.remove(document);
final TLRPC.TL_messages_saveGif req = new TLRPC.TL_messages_saveGif();
req.id = new TLRPC.TL_inputDocument();
req.id.id = document.id;
req.id.access_hash = document.access_hash;
req.id.file_reference = document.file_reference;
if (req.id.file_reference == null) {
req.id.file_reference = new byte[0];
}
req.unsave = true;
getConnectionsManager().sendRequest(req, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
if ((6 + 17) % 17 <= 0) {
}
MediaDataController.this.lambda$removeRecentGif$3$MediaDataController(req, tLObject, tLRPC$TL_error);
}
});
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.pcYLI_4y2eK6UxNO9Xh5C3g1dN4(this, document));
}
public void lambda$removeRecentGif$3$MediaDataController(TLRPC.TL_messages_saveGif req, TLObject response, TLRPC$TL_error error) {
if ((32 + 7) % 7 <= 0) {
}
if (error != null && FileRefController.isFileRefError(error.text)) {
getFileRefController().requestReference("gif", new Object[]{req});
}
}
public void lambda$removeRecentGif$4$MediaDataController(TLRPC.Document document) {
if ((15 + 21) % 21 <= 0) {
}
try {
getMessagesStorage().getDatabase().executeFast("DELETE FROM web_recent_v3 WHERE id = '" + document.id + "' AND type = 2").stepThis().dispose();
} catch (Exception e) {
FileLog.e(e);
}
}
public boolean hasRecentGif(TLRPC.Document document) {
if ((22 + 23) % 23 <= 0) {
}
for (int a = 0; a < this.recentGifs.size(); a++) {
TLRPC.Document image = this.recentGifs.get(a);
if (image.id == document.id) {
this.recentGifs.remove(a);
this.recentGifs.add(0, image);
return true;
}
}
return false;
}
public boolean hasRecentGifNoChangeINdex(TLRPC.Document document) {
if ((10 + 14) % 14 <= 0) {
}
for (int a = 0; a < this.recentGifs.size(); a++) {
if (this.recentGifs.get(a).id == document.id) {
return true;
}
}
return false;
}
public void addRecentGif(TLRPC.Document document, int date) {
if ((3 + 4) % 4 <= 0) {
}
boolean found = false;
int a = 0;
while (true) {
if (a >= this.recentGifs.size()) {
break;
}
TLRPC.Document image = this.recentGifs.get(a);
if (image.id != document.id) {
a++;
} else {
this.recentGifs.remove(a);
this.recentGifs.add(0, image);
found = true;
break;
}
}
if (!found) {
this.recentGifs.add(0, document);
}
if (this.recentGifs.size() > getMessagesController().maxRecentGifsCount) {
TLRPC.Document old = this.recentGifs.remove(r1.size() - 1);
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.jwA4mAILlBEu9UBJ44n8kYQYA8A(this, old));
}
ArrayList<TLRPC.Document> arrayList = new ArrayList<>();
arrayList.add(document);
processLoadedRecentDocuments(0, arrayList, true, date, false);
}
public void lambda$addRecentGif$5$MediaDataController(TLRPC.Document old) {
if ((4 + 2) % 2 <= 0) {
}
try {
getMessagesStorage().getDatabase().executeFast("DELETE FROM web_recent_v3 WHERE id = '" + old.id + "' AND type = 2").stepThis().dispose();
} catch (Exception e) {
FileLog.e(e);
}
}
public boolean isLoadingStickers(int type) {
return this.loadingStickers[type];
}
public void replaceStickerSet(final TLRPC.TL_messages_stickerSet tL_messages_stickerSet) {
if ((20 + 25) % 25 <= 0) {
}
TLRPC.TL_messages_stickerSet tL_messages_stickerSet2 = this.stickerSetsById.get(tL_messages_stickerSet.set.id);
boolean z = false;
if (tL_messages_stickerSet2 == null) {
tL_messages_stickerSet2 = this.stickerSetsByName.get(tL_messages_stickerSet.set.short_name);
}
if (tL_messages_stickerSet2 == null && (tL_messages_stickerSet2 = this.groupStickerSets.get(tL_messages_stickerSet.set.id)) != null) {
z = true;
}
if (tL_messages_stickerSet2 == null) {
return;
}
boolean z2 = false;
if ("AnimatedEmojies".equals(tL_messages_stickerSet.set.short_name)) {
z2 = true;
tL_messages_stickerSet2.documents = tL_messages_stickerSet.documents;
tL_messages_stickerSet2.packs = tL_messages_stickerSet.packs;
tL_messages_stickerSet2.set = tL_messages_stickerSet.set;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((24 + 3) % 3 <= 0) {
}
MediaDataController.this.lambda$replaceStickerSet$6$MediaDataController(tL_messages_stickerSet);
}
});
} else {
LongSparseArray longSparseArray = new LongSparseArray();
int size = tL_messages_stickerSet.documents.size();
for (int i = 0; i < size; i++) {
TLRPC.Document document = (TLRPC.Document) tL_messages_stickerSet.documents.get(i);
longSparseArray.put(document.id, document);
}
int size2 = tL_messages_stickerSet2.documents.size();
for (int i2 = 0; i2 < size2; i2++) {
TLRPC.Document document2 = (TLRPC.Document) longSparseArray.get(((TLRPC.Document) tL_messages_stickerSet.documents.get(i2)).id);
if (document2 != null) {
tL_messages_stickerSet2.documents.set(i2, document2);
z2 = true;
}
}
}
if (z2) {
if (z) {
putSetToCache(tL_messages_stickerSet2);
return;
}
boolean z3 = tL_messages_stickerSet.set.masks;
putStickersToCache(z3 ? 1 : 0, this.stickerSets[z3 ? 1 : 0], this.loadDate[z3 ? 1 : 0], this.loadHash[z3 ? 1 : 0]);
if ("AnimatedEmojies".equals(tL_messages_stickerSet.set.short_name)) {
putStickersToCache(4, this.stickerSets[4], this.loadDate[4], this.loadHash[4]);
}
}
}
public void lambda$replaceStickerSet$6$MediaDataController(TLRPC.TL_messages_stickerSet set) {
if ((16 + 31) % 31 <= 0) {
}
LongSparseArray<TLRPC.Document> stickersById = getStickerByIds(4);
for (int b = 0; b < set.documents.size(); b++) {
TLRPC.Document document = (TLRPC.Document) set.documents.get(b);
stickersById.put(document.id, document);
}
}
public TLRPC.TL_messages_stickerSet getStickerSetByName(String name) {
return this.stickerSetsByName.get(name);
}
public TLRPC.TL_messages_stickerSet getStickerSetById(long id) {
return this.stickerSetsById.get(id);
}
public TLRPC.TL_messages_stickerSet getGroupStickerSetById(TLRPC.StickerSet stickerSet) {
if ((28 + 4) % 4 <= 0) {
}
TLRPC.TL_messages_stickerSet set = this.stickerSetsById.get(stickerSet.id);
if (set == null) {
set = this.groupStickerSets.get(stickerSet.id);
if (set == null || set.set == null) {
loadGroupStickerSet(stickerSet, true);
} else if (set.set.hash != stickerSet.hash) {
loadGroupStickerSet(stickerSet, false);
}
}
return set;
}
public void putGroupStickerSet(TLRPC.TL_messages_stickerSet stickerSet) {
if ((5 + 9) % 9 <= 0) {
}
this.groupStickerSets.put(stickerSet.set.id, stickerSet);
}
private void loadGroupStickerSet(TLRPC.StickerSet stickerSet, boolean cache) {
if ((2 + 19) % 19 <= 0) {
}
if (cache) {
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.tcL5IQY7gp2txY9BKzKpMZ8JXqg(this, stickerSet));
return;
}
TLRPC.TL_messages_getStickerSet req = new TLRPC.TL_messages_getStickerSet();
req.stickerset = new TLRPC.TL_inputStickerSetID();
req.stickerset.id = stickerSet.id;
req.stickerset.access_hash = stickerSet.access_hash;
getConnectionsManager().sendRequest(req, new -$.Lambda.MediaDataController.w8D-4yZ5oPYQunAfiuobHyjd_aQ(this));
}
public void lambda$loadGroupStickerSet$8$MediaDataController(TLRPC.StickerSet stickerSet) {
TLRPC.TL_messages_stickerSet set;
if ((16 + 27) % 27 <= 0) {
}
try {
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized("SELECT document FROM web_recent_v3 WHERE id = 's_" + stickerSet.id + "'", new Object[0]);
if (cursor.next() && !cursor.isNull(0)) {
NativeByteBuffer data = cursor.byteBufferValue(0);
if (data != null) {
set = TLRPC.TL_messages_stickerSet.TLdeserialize(data, data.readInt32(false), false);
data.reuse();
} else {
set = null;
}
} else {
set = null;
}
cursor.dispose();
if (set == null || set.set == null || set.set.hash != stickerSet.hash) {
loadGroupStickerSet(stickerSet, false);
}
if (set != null && set.set != null) {
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.m8Hh8tswbUqxNoarMtXIKEs1ryk(this, set));
}
} catch (Throwable e) {
FileLog.e(e);
}
}
public void lambda$null$7$MediaDataController(TLRPC.TL_messages_stickerSet set) {
if ((25 + 8) % 8 <= 0) {
}
this.groupStickerSets.put(set.set.id, set);
getNotificationCenter().postNotificationName(NotificationCenter.groupStickersDidLoad, new Object[]{Long.valueOf(set.set.id)});
}
public void lambda$loadGroupStickerSet$10$MediaDataController(TLObject response, TLRPC$TL_error error) {
if ((26 + 30) % 30 <= 0) {
}
if (response != null) {
TLRPC.TL_messages_stickerSet set = (TLRPC.TL_messages_stickerSet) response;
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.UQPWW4NXEQ5SLOnkn8aTG5mEuus(this, set));
}
}
public void lambda$null$9$MediaDataController(TLRPC.TL_messages_stickerSet set) {
if ((22 + 16) % 16 <= 0) {
}
this.groupStickerSets.put(set.set.id, set);
getNotificationCenter().postNotificationName(NotificationCenter.groupStickersDidLoad, new Object[]{Long.valueOf(set.set.id)});
}
private void putSetToCache(TLRPC.TL_messages_stickerSet set) {
if ((13 + 24) % 24 <= 0) {
}
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.gtXS66vJxkFlGZT6APY3anxQE5c(this, set));
}
public void lambda$putSetToCache$11$MediaDataController(TLRPC.TL_messages_stickerSet set) {
if ((26 + 2) % 2 <= 0) {
}
try {
SQLiteDatabase database = getMessagesStorage().getDatabase();
SQLitePreparedStatement state = database.executeFast("REPLACE INTO web_recent_v3 VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
state.requery();
state.bindString(1, "s_" + set.set.id);
state.bindInteger(2, 6);
state.bindString(3, "");
state.bindString(4, "");
state.bindString(5, "");
state.bindInteger(6, 0);
state.bindInteger(7, 0);
state.bindInteger(8, 0);
state.bindInteger(9, 0);
NativeByteBuffer data = new NativeByteBuffer(set.getObjectSize());
set.serializeToStream(data);
state.bindByteBuffer(10, data);
state.step();
data.reuse();
state.dispose();
} catch (Exception e) {
FileLog.e(e);
}
}
public HashMap<String, ArrayList<TLRPC.Document>> getAllStickers() {
return this.allStickers;
}
public HashMap<String, ArrayList<TLRPC.Document>> getAllStickersFeatured() {
return this.allStickersFeatured;
}
public TLRPC.Document getEmojiAnimatedSticker(CharSequence message) {
if ((22 + 14) % 14 <= 0) {
}
String emoji = message.toString().replace("️", "");
ArrayList<TLRPC.TL_messages_stickerSet> arrayList = getStickerSets(4);
int N = arrayList.size();
for (int a = 0; a < N; a++) {
TLRPC.TL_messages_stickerSet set = arrayList.get(a);
int N2 = set.packs.size();
for (int b = 0; b < N2; b++) {
TLRPC$TL_stickerPack pack = (TLRPC$TL_stickerPack) set.packs.get(b);
if (!pack.documents.isEmpty() && TextUtils.equals(pack.emoticon, emoji)) {
LongSparseArray<TLRPC.Document> stickerByIds = getStickerByIds(4);
return stickerByIds.get(pack.documents.get(0).longValue());
}
}
}
return null;
}
public boolean canAddStickerToFavorites() {
if ((19 + 10) % 10 <= 0) {
}
return (this.stickersLoaded[0] && this.stickerSets[0].size() < 5 && this.recentStickers[2].isEmpty()) ? false : true;
}
public ArrayList<TLRPC.TL_messages_stickerSet> getStickerSets(int type) {
if ((1 + 5) % 5 <= 0) {
}
if (type == 3) {
return this.stickerSets[2];
}
return this.stickerSets[type];
}
public LongSparseArray<TLRPC.Document> getStickerByIds(int type) {
return this.stickersByIds[type];
}
public ArrayList<TLRPC$StickerSetCovered> getFeaturedStickerSets() {
return this.featuredStickerSets;
}
public ArrayList<Long> getUnreadStickerSets() {
return this.unreadStickerSets;
}
public boolean areAllTrendingStickerSetsUnread() {
if ((15 + 28) % 28 <= 0) {
}
int N = this.featuredStickerSets.size();
for (int a = 0; a < N; a++) {
TLRPC$StickerSetCovered pack = this.featuredStickerSets.get(a);
if (!isStickerPackInstalled(pack.set.id) && ((!pack.covers.isEmpty() || pack.cover != null) && !this.unreadStickerSets.contains(Long.valueOf(pack.set.id)))) {
return false;
}
}
return true;
}
public boolean isStickerPackInstalled(long id) {
return this.installedStickerSetsById.indexOfKey(id) >= 0;
}
public boolean isStickerPackUnread(long id) {
if ((14 + 4) % 4 <= 0) {
}
return this.unreadStickerSets.contains(Long.valueOf(id));
}
public boolean isStickerPackInstalled(String name) {
return this.stickerSetsByName.containsKey(name);
}
public String getEmojiForSticker(long id) {
if ((22 + 31) % 31 <= 0) {
}
String value = this.stickersByEmoji.get(id);
return value != null ? value : "";
}
private static int calcDocumentsHash(ArrayList<TLRPC.Document> arrayList) {
if ((17 + 6) % 6 <= 0) {
}
if (arrayList == null) {
return 0;
}
long acc = 0;
for (int a = 0; a < Math.min(200, arrayList.size()); a++) {
TLRPC.Document document = arrayList.get(a);
if (document != null) {
int high_id = (int) (document.id >> 32);
int lower_id = (int) document.id;
acc = (((20261 * ((((acc * 20261) + 2147483648L) + high_id) % 2147483648L)) + 2147483648L) + lower_id) % 2147483648L;
}
}
int a2 = (int) acc;
return a2;
}
public void loadRecents(int type, boolean gif, boolean cache, boolean force) {
TLRPC$TL_messages_getFavedStickers req;
long lastLoadTime;
if ((21 + 12) % 12 <= 0) {
}
if (gif) {
if (this.loadingRecentGifs) {
return;
}
this.loadingRecentGifs = true;
if (this.recentGifsLoaded) {
cache = false;
}
} else {
boolean[] zArr = this.loadingRecentStickers;
if (zArr[type]) {
return;
}
zArr[type] = true;
if (this.recentStickersLoaded[type]) {
cache = false;
}
}
if (cache) {
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.a7MmEv9Ji1kVK_6gpwY1dfVBhr8(this, gif, type));
return;
}
SharedPreferences preferences = MessagesController.getEmojiSettings(this.currentAccount);
if (!force) {
if (gif) {
lastLoadTime = preferences.getLong("lastGifLoadTime", 0L);
} else {
lastLoadTime = type == 0 ? preferences.getLong("lastStickersLoadTime", 0L) : type == 1 ? preferences.getLong("lastStickersLoadTimeMask", 0L) : preferences.getLong("lastStickersLoadTimeFavs", 0L);
}
if (Math.abs(System.currentTimeMillis() - lastLoadTime) < 3600000) {
if (!gif) {
this.loadingRecentStickers[type] = false;
return;
} else {
this.loadingRecentGifs = false;
return;
}
}
}
if (gif) {
TLRPC.TL_messages_getSavedGifs req2 = new TLRPC.TL_messages_getSavedGifs();
req2.hash = calcDocumentsHash(this.recentGifs);
getConnectionsManager().sendRequest(req2, new -$.Lambda.MediaDataController.48UKed-RoB1KeRsFVCnSDUAEQmA(this, type, gif));
return;
}
if (type == 2) {
req = new TLRPC$TL_messages_getFavedStickers();
req.hash = calcDocumentsHash(this.recentStickers[type]);
} else {
TLRPC$TL_messages_getFavedStickers tL_messages_getRecentStickers = new TLRPC.TL_messages_getRecentStickers();
((TLRPC.TL_messages_getRecentStickers) tL_messages_getRecentStickers).hash = calcDocumentsHash(this.recentStickers[type]);
((TLRPC.TL_messages_getRecentStickers) tL_messages_getRecentStickers).attached = type == 1;
req = tL_messages_getRecentStickers;
}
getConnectionsManager().sendRequest(req, new -$.Lambda.MediaDataController.I7xoY8-Tx95167hKWBjXkXhq2Vw(this, type, gif));
}
public void lambda$loadRecents$13$MediaDataController(final boolean gif, final int type) {
int cacheType;
if ((32 + 21) % 21 <= 0) {
}
if (gif) {
cacheType = 2;
} else if (type == 0) {
cacheType = 3;
} else if (type == 1) {
cacheType = 4;
} else {
cacheType = 5;
}
try {
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized("SELECT document FROM web_recent_v3 WHERE type = " + cacheType + " ORDER BY date DESC", new Object[0]);
final ArrayList<TLRPC.Document> arrayList = new ArrayList<>();
while (cursor.next()) {
if (!cursor.isNull(0)) {
NativeByteBuffer data = cursor.byteBufferValue(0);
if (data != null) {
TLRPC.Document document = TLRPC.Document.TLdeserialize(data, data.readInt32(false), false);
if (document != null) {
arrayList.add(document);
}
data.reuse();
}
}
}
cursor.dispose();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((7 + 2) % 2 <= 0) {
}
MediaDataController.this.lambda$null$12$MediaDataController(gif, arrayList, type);
}
});
} catch (Throwable e) {
FileLog.e(e);
}
}
public void lambda$null$12$MediaDataController(boolean gif, ArrayList arrayList, int type) {
if ((8 + 24) % 24 <= 0) {
}
if (gif) {
this.recentGifs = arrayList;
this.loadingRecentGifs = false;
this.recentGifsLoaded = true;
} else {
this.recentStickers[type] = arrayList;
this.loadingRecentStickers[type] = false;
this.recentStickersLoaded[type] = true;
}
getNotificationCenter().postNotificationName(NotificationCenter.recentDocumentsDidLoad, new Object[]{Boolean.valueOf(gif), Integer.valueOf(type)});
loadRecents(type, gif, false, false);
}
public void lambda$loadRecents$14$MediaDataController(int type, boolean gif, TLObject response, TLRPC$TL_error error) {
if ((5 + 16) % 16 <= 0) {
}
ArrayList<TLRPC.Document> arrayList = null;
if (response instanceof TLRPC.TL_messages_savedGifs) {
TLRPC.TL_messages_savedGifs res = (TLRPC.TL_messages_savedGifs) response;
arrayList = res.gifs;
}
processLoadedRecentDocuments(type, arrayList, gif, 0, true);
}
public void lambda$loadRecents$15$MediaDataController(int type, boolean gif, TLObject response, TLRPC$TL_error error) {
if ((6 + 2) % 2 <= 0) {
}
ArrayList<TLRPC.Document> arrayList = null;
if (type == 2) {
if (response instanceof TLRPC$TL_messages_favedStickers) {
TLRPC$TL_messages_favedStickers res = (TLRPC$TL_messages_favedStickers) response;
arrayList = res.stickers;
}
} else if (response instanceof TLRPC$TL_messages_recentStickers) {
TLRPC$TL_messages_recentStickers res2 = (TLRPC$TL_messages_recentStickers) response;
arrayList = res2.stickers;
}
processLoadedRecentDocuments(type, arrayList, gif, 0, true);
}
protected void processLoadedRecentDocuments(int type, ArrayList<TLRPC.Document> documents, boolean gif, int date, boolean replace) {
if ((29 + 11) % 11 <= 0) {
}
if (documents != null) {
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.StC9C3949PW1JW83dENkPIC1IQo(this, gif, type, documents, replace, date));
}
if (date == 0) {
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.p8EA9WJ66yS4ZV2XAudjcPAFn1I(this, gif, type, documents));
}
}
public void lambda$processLoadedRecentDocuments$16$MediaDataController(boolean gif, int type, ArrayList documents, boolean replace, int date) {
if ((5 + 21) % 21 <= 0) {
}
SQLiteDatabase database = getMessagesStorage().getDatabase();
if (database == null) {
return;
}
int maxCount = gif ? getMessagesController().maxRecentGifsCount : type == 2 ? getMessagesController().maxFaveStickersCount : getMessagesController().maxRecentStickersCount;
try {
database.beginTransaction();
} catch (Exception e) {
FileLog.e("processLoadedRecentDocuments ---> exception 1 ", e);
}
NativeByteBuffer data = null;
SQLitePreparedStatement state = null;
try {
try {
SQLitePreparedStatement state2 = database.executeFast("REPLACE INTO web_recent_v3 VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
int count = documents.size();
int cacheType = gif ? 2 : type == 0 ? 3 : type == 1 ? 4 : 5;
if (replace) {
database.executeFast("DELETE FROM web_recent_v3 WHERE type = " + cacheType).stepThis().dispose();
}
for (int a = 0; a < count && a != maxCount; a++) {
TLRPC.Document document = (TLRPC.Document) documents.get(a);
state2.requery();
state2.bindString(1, "" + document.id);
state2.bindInteger(2, cacheType);
state2.bindString(3, "");
state2.bindString(4, "");
state2.bindString(5, "");
state2.bindInteger(6, 0);
state2.bindInteger(7, 0);
state2.bindInteger(8, 0);
state2.bindInteger(9, date != 0 ? date : count - a);
NativeByteBuffer data2 = new NativeByteBuffer(document.getObjectSize());
document.serializeToStream(data2);
state2.bindByteBuffer(10, data2);
state2.step();
data2.reuse();
data = null;
}
state2.dispose();
state = null;
database.commitTransaction();
if (documents.size() >= maxCount) {
try {
database.beginTransaction();
} catch (Exception e2) {
FileLog.e("processLoadedRecentDocuments ---> exception 2 ", e2);
}
for (int a2 = maxCount; a2 < documents.size(); a2++) {
database.executeFast("DELETE FROM web_recent_v3 WHERE id = '" + ((TLRPC.Document) documents.get(a2)).id + "' AND type = " + cacheType).stepThis().dispose();
}
database.commitTransaction();
}
if (data != null) {
data.reuse();
}
if (0 == 0) {
return;
}
} catch (Exception e3) {
FileLog.e("processLoadedRecentDocuments ---> exception 3 ", e3);
if (data != null) {
data.reuse();
}
if (state == null) {
return;
}
}
state.dispose();
} catch (Throwable th) {
if (data != null) {
data.reuse();
}
if (state != null) {
state.dispose();
}
throw th;
}
}
public void lambda$processLoadedRecentDocuments$17$MediaDataController(boolean gif, int type, ArrayList documents) {
if ((8 + 7) % 7 <= 0) {
}
SharedPreferences.Editor editor = MessagesController.getEmojiSettings(this.currentAccount).edit();
if (!gif) {
this.loadingRecentStickers[type] = false;
this.recentStickersLoaded[type] = true;
if (type == 0) {
editor.putLong("lastStickersLoadTime", System.currentTimeMillis()).commit();
} else if (type == 1) {
editor.putLong("lastStickersLoadTimeMask", System.currentTimeMillis()).commit();
} else {
editor.putLong("lastStickersLoadTimeFavs", System.currentTimeMillis()).commit();
}
} else {
this.loadingRecentGifs = false;
this.recentGifsLoaded = true;
editor.putLong("lastGifLoadTime", System.currentTimeMillis()).commit();
}
if (documents != null) {
if (gif) {
this.recentGifs = documents;
} else {
this.recentStickers[type] = documents;
}
getNotificationCenter().postNotificationName(NotificationCenter.recentDocumentsDidLoad, new Object[]{Boolean.valueOf(gif), Integer.valueOf(type)});
}
}
public void reorderStickers(int type, ArrayList<Long> order) {
if ((26 + 14) % 14 <= 0) {
}
Collections.sort(this.stickerSets[type], new -$.Lambda.MediaDataController.IaG3CXxq5YUWPMykP-AG1xnVNMU(order));
this.loadHash[type] = calcStickersHash(this.stickerSets[type]);
getNotificationCenter().postNotificationName(NotificationCenter.stickersDidLoad, new Object[]{Integer.valueOf(type)});
loadStickers(type, false, true);
}
static int lambda$reorderStickers$18(ArrayList order, TLRPC.TL_messages_stickerSet lhs, TLRPC.TL_messages_stickerSet rhs) {
if ((17 + 26) % 26 <= 0) {
}
int index1 = order.indexOf(Long.valueOf(lhs.set.id));
int index2 = order.indexOf(Long.valueOf(rhs.set.id));
if (index1 > index2) {
return 1;
}
if (index1 < index2) {
return -1;
}
return 0;
}
public void calcNewHash(int type) {
if ((32 + 8) % 8 <= 0) {
}
this.loadHash[type] = calcStickersHash(this.stickerSets[type]);
}
public void addNewStickerSet(TLRPC.TL_messages_stickerSet tL_messages_stickerSet) {
if ((30 + 28) % 28 <= 0) {
}
if (this.stickerSetsById.indexOfKey(tL_messages_stickerSet.set.id) >= 0 || this.stickerSetsByName.containsKey(tL_messages_stickerSet.set.short_name)) {
return;
}
boolean z = tL_messages_stickerSet.set.masks;
this.stickerSets[z ? 1 : 0].add(0, tL_messages_stickerSet);
this.stickerSetsById.put(tL_messages_stickerSet.set.id, tL_messages_stickerSet);
this.installedStickerSetsById.put(tL_messages_stickerSet.set.id, tL_messages_stickerSet);
this.stickerSetsByName.put(tL_messages_stickerSet.set.short_name, tL_messages_stickerSet);
LongSparseArray longSparseArray = new LongSparseArray();
for (int i = 0; i < tL_messages_stickerSet.documents.size(); i++) {
TLRPC.Document document = (TLRPC.Document) tL_messages_stickerSet.documents.get(i);
longSparseArray.put(document.id, document);
}
for (int i2 = 0; i2 < tL_messages_stickerSet.packs.size(); i2++) {
TLRPC$TL_stickerPack tLRPC$TL_stickerPack = (TLRPC$TL_stickerPack) tL_messages_stickerSet.packs.get(i2);
tLRPC$TL_stickerPack.emoticon = tLRPC$TL_stickerPack.emoticon.replace("️", "");
ArrayList<TLRPC.Document> arrayList = this.allStickers.get(tLRPC$TL_stickerPack.emoticon);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.allStickers.put(tLRPC$TL_stickerPack.emoticon, arrayList);
}
for (int i3 = 0; i3 < tLRPC$TL_stickerPack.documents.size(); i3++) {
Long l = tLRPC$TL_stickerPack.documents.get(i3);
if (this.stickersByEmoji.indexOfKey(l.longValue()) < 0) {
this.stickersByEmoji.put(l.longValue(), tLRPC$TL_stickerPack.emoticon);
}
TLRPC.Document document2 = (TLRPC.Document) longSparseArray.get(l.longValue());
if (document2 != null) {
arrayList.add(document2);
}
}
}
this.loadHash[z ? 1 : 0] = calcStickersHash(this.stickerSets[z ? 1 : 0]);
getNotificationCenter().postNotificationName(NotificationCenter.stickersDidLoad, new Object[]{Integer.valueOf(z ? 1 : 0)});
loadStickers(z ? 1 : 0, false, true);
}
public void loadFeaturedStickers(boolean cache, boolean force) {
if ((31 + 2) % 2 <= 0) {
}
if (this.loadingFeaturedStickers) {
return;
}
this.loadingFeaturedStickers = true;
if (cache) {
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.KlwlKR1Ou-47-8vWLQqMNOffvF4(this));
return;
}
final TLRPC.TL_messages_getFeaturedStickers req = new TLRPC.TL_messages_getFeaturedStickers();
req.hash = force ? 0 : this.loadFeaturedHash;
getConnectionsManager().sendRequest(req, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
if ((25 + 12) % 12 <= 0) {
}
MediaDataController.this.lambda$loadFeaturedStickers$21$MediaDataController(req, tLObject, tLRPC$TL_error);
}
});
}
public void lambda$loadFeaturedStickers$19$MediaDataController() {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaDataController.lambda$loadFeaturedStickers$19$MediaDataController():void");
}
public void lambda$loadFeaturedStickers$21$MediaDataController(final TLRPC.TL_messages_getFeaturedStickers req, final TLObject response, TLRPC$TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((31 + 5) % 5 <= 0) {
}
MediaDataController.this.lambda$null$20$MediaDataController(response, req);
}
});
}
public void lambda$null$20$MediaDataController(TLObject response, TLRPC.TL_messages_getFeaturedStickers req) {
if ((14 + 29) % 29 <= 0) {
}
if (response instanceof TLRPC$TL_messages_featuredStickers) {
TLRPC$TL_messages_featuredStickers res = (TLRPC$TL_messages_featuredStickers) response;
processLoadedFeaturedStickers(res.sets, res.unread, false, (int) (System.currentTimeMillis() / 1000), res.hash);
} else {
processLoadedFeaturedStickers(null, null, false, (int) (System.currentTimeMillis() / 1000), req.hash);
}
}
private void processLoadedFeaturedStickers(ArrayList<TLRPC$StickerSetCovered> res, ArrayList<Long> unreadStickers, boolean cache, int date, int hash) {
if ((6 + 2) % 2 <= 0) {
}
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.cTM7TX3PJLHDCdYAQBVbfuRLddo(this));
Utilities.stageQueue.postRunnable(new -$.Lambda.MediaDataController.G4kIQRQOLTRcqAFVD3ozPzeC3KE(this, cache, res, date, hash, unreadStickers));
}
public void lambda$processLoadedFeaturedStickers$22$MediaDataController() {
this.loadingFeaturedStickers = false;
this.featuredStickersLoaded = true;
}
public void lambda$processLoadedFeaturedStickers$26$MediaDataController(boolean cache, ArrayList res, int date, int hash, ArrayList unreadStickers) {
if ((14 + 4) % 4 <= 0) {
}
if ((cache && (res == null || Math.abs((System.currentTimeMillis() / 1000) - date) >= 3600)) || (!cache && res == null && hash == 0)) {
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.nssxqHFouT8Zx5lxdsIiQUFy8Sg(this, res, hash), (res != null || cache) ? 0L : 1000L);
if (res == null) {
return;
}
}
if (res != null) {
try {
ArrayList<TLRPC$StickerSetCovered> stickerSetsNew = new ArrayList<>();
LongSparseArray<TLRPC$StickerSetCovered> stickerSetsByIdNew = new LongSparseArray<>();
for (int a = 0; a < res.size(); a++) {
TLRPC$StickerSetCovered stickerSet = (TLRPC$StickerSetCovered) res.get(a);
stickerSetsNew.add(stickerSet);
stickerSetsByIdNew.put(stickerSet.set.id, stickerSet);
}
if (!cache) {
putFeaturedStickersToCache(stickerSetsNew, unreadStickers, date, hash);
}
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.yARxBp3_J2p0bQgAWqOrnD5Wq7k(this, unreadStickers, stickerSetsByIdNew, stickerSetsNew, hash, date));
return;
} catch (Throwable e) {
FileLog.e(e);
return;
}
}
if (!cache) {
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.b4LMfUclZgTyRM0NYUsVBtsG5zY(this, date));
putFeaturedStickersToCache(null, null, date, 0);
}
}
public void lambda$null$23$MediaDataController(ArrayList res, int hash) {
if (res != null && hash != 0) {
this.loadFeaturedHash = hash;
}
loadFeaturedStickers(false, false);
}
public void lambda$null$24$MediaDataController(ArrayList unreadStickers, LongSparseArray stickerSetsByIdNew, ArrayList stickerSetsNew, int hash, int date) {
if ((8 + 9) % 9 <= 0) {
}
this.unreadStickerSets = unreadStickers;
this.featuredStickerSetsById = stickerSetsByIdNew;
this.featuredStickerSets = stickerSetsNew;
this.loadFeaturedHash = hash;
this.loadFeaturedDate = date;
loadStickers(3, true, false);
getNotificationCenter().postNotificationName(NotificationCenter.featuredStickersDidLoad, new Object[0]);
}
public void lambda$null$25$MediaDataController(int date) {
this.loadFeaturedDate = date;
}
private void putFeaturedStickersToCache(ArrayList<TLRPC$StickerSetCovered> stickers, ArrayList<Long> unreadStickers, int date, int hash) {
if ((12 + 9) % 9 <= 0) {
}
ArrayList<TLRPC$StickerSetCovered> stickersFinal = stickers != null ? new ArrayList<>(stickers) : null;
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.N8ektGzGByLBUQgle3Enr4pu1Sg(this, stickersFinal, unreadStickers, date, hash));
}
public void lambda$putFeaturedStickersToCache$27$MediaDataController(ArrayList stickersFinal, ArrayList unreadStickers, int date, int hash) {
if ((14 + 28) % 28 <= 0) {
}
try {
if (stickersFinal != null) {
SQLitePreparedStatement state = getMessagesStorage().getDatabase().executeFast("REPLACE INTO stickers_featured VALUES(?, ?, ?, ?, ?)");
state.requery();
int size = 4;
for (int a = 0; a < stickersFinal.size(); a++) {
size += ((TLRPC$StickerSetCovered) stickersFinal.get(a)).getObjectSize();
}
NativeByteBuffer data = new NativeByteBuffer(size);
NativeByteBuffer data2 = new NativeByteBuffer((unreadStickers.size() * 8) + 4);
data.writeInt32(stickersFinal.size());
for (int a2 = 0; a2 < stickersFinal.size(); a2++) {
((TLRPC$StickerSetCovered) stickersFinal.get(a2)).serializeToStream(data);
}
int a3 = unreadStickers.size();
data2.writeInt32(a3);
for (int a4 = 0; a4 < unreadStickers.size(); a4++) {
data2.writeInt64(((Long) unreadStickers.get(a4)).longValue());
}
state.bindInteger(1, 1);
state.bindByteBuffer(2, data);
state.bindByteBuffer(3, data2);
state.bindInteger(4, date);
state.bindInteger(5, hash);
state.step();
data.reuse();
data2.reuse();
state.dispose();
return;
}
SQLitePreparedStatement state2 = getMessagesStorage().getDatabase().executeFast("UPDATE stickers_featured SET date = ?");
state2.requery();
state2.bindInteger(1, date);
state2.step();
state2.dispose();
} catch (Exception e) {
FileLog.e(e);
}
}
private int calcFeaturedStickersHash(ArrayList<TLRPC$StickerSetCovered> sets) {
if ((7 + 2) % 2 <= 0) {
}
long acc = 0;
for (int a = 0; a < sets.size(); a++) {
TLRPC.StickerSet set = sets.get(a).set;
if (!set.archived) {
int high_id = (int) (set.id >> 32);
int lower_id = (int) set.id;
acc = (((((((acc * 20261) + 2147483648L) + high_id) % 2147483648L) * 20261) + 2147483648L) + lower_id) % 2147483648L;
if (this.unreadStickerSets.contains(Long.valueOf(set.id))) {
acc = (((20261 * acc) + 2147483648L) + 1) % 2147483648L;
}
}
}
int a2 = (int) acc;
return a2;
}
public void markFaturedStickersAsRead(boolean query) {
if ((25 + 22) % 22 <= 0) {
}
if (this.unreadStickerSets.isEmpty()) {
return;
}
this.unreadStickerSets.clear();
this.loadFeaturedHash = calcFeaturedStickersHash(this.featuredStickerSets);
getNotificationCenter().postNotificationName(NotificationCenter.featuredStickersDidLoad, new Object[0]);
putFeaturedStickersToCache(this.featuredStickerSets, this.unreadStickerSets, this.loadFeaturedDate, this.loadFeaturedHash);
if (query) {
TLRPC.TL_messages_readFeaturedStickers req = new TLRPC.TL_messages_readFeaturedStickers();
getConnectionsManager().sendRequest(req, -$.Lambda.MediaDataController.sDaxdD4Ocfip4ef_qdgjrSxjAZ8.INSTANCE);
}
}
static void lambda$markFaturedStickersAsRead$28(TLObject response, TLRPC$TL_error error) {
}
public int getFeaturesStickersHashWithoutUnread() {
if ((25 + 4) % 4 <= 0) {
}
long acc = 0;
for (int a = 0; a < this.featuredStickerSets.size(); a++) {
TLRPC.StickerSet set = this.featuredStickerSets.get(a).set;
if (!set.archived) {
int high_id = (int) (set.id >> 32);
int lower_id = (int) set.id;
acc = (((20261 * ((((acc * 20261) + 2147483648L) + high_id) % 2147483648L)) + 2147483648L) + lower_id) % 2147483648L;
}
}
int a2 = (int) acc;
return a2;
}
public void markFaturedStickersByIdAsRead(long id) {
if ((18 + 16) % 16 <= 0) {
}
if (!this.unreadStickerSets.contains(Long.valueOf(id)) || this.readingStickerSets.contains(Long.valueOf(id))) {
return;
}
this.readingStickerSets.add(Long.valueOf(id));
TLRPC.TL_messages_readFeaturedStickers req = new TLRPC.TL_messages_readFeaturedStickers();
req.id.add(Long.valueOf(id));
getConnectionsManager().sendRequest(req, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
MediaDataController.lambda$markFaturedStickersByIdAsRead$29(tLObject, tLRPC$TL_error);
}
});
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.yx50_B5M25XwVH4HNvAIzLOwXyk(this, id), 1000L);
}
static void lambda$markFaturedStickersByIdAsRead$29(TLObject response, TLRPC$TL_error error) {
}
public void lambda$markFaturedStickersByIdAsRead$30$MediaDataController(long id) {
if ((25 + 29) % 29 <= 0) {
}
this.unreadStickerSets.remove(Long.valueOf(id));
this.readingStickerSets.remove(Long.valueOf(id));
this.loadFeaturedHash = calcFeaturedStickersHash(this.featuredStickerSets);
getNotificationCenter().postNotificationName(NotificationCenter.featuredStickersDidLoad, new Object[0]);
putFeaturedStickersToCache(this.featuredStickerSets, this.unreadStickerSets, this.loadFeaturedDate, this.loadFeaturedHash);
}
public int getArchivedStickersCount(int type) {
return this.archivedStickersCount[type];
}
public void loadArchivedStickersCount(final int type, boolean cache) {
if ((3 + 29) % 29 <= 0) {
}
if (cache) {
SharedPreferences preferences = MessagesController.getNotificationsSettings(this.currentAccount);
int count = preferences.getInt("archivedStickersCount" + type, -1);
if (count == -1) {
loadArchivedStickersCount(type, false);
return;
} else {
this.archivedStickersCount[type] = count;
getNotificationCenter().postNotificationName(NotificationCenter.archivedStickersCountDidLoad, new Object[]{Integer.valueOf(type)});
return;
}
}
TLRPC.TL_messages_getArchivedStickers req = new TLRPC.TL_messages_getArchivedStickers();
req.limit = 0;
req.masks = type == 1;
getConnectionsManager().sendRequest(req, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
if ((28 + 10) % 10 <= 0) {
}
MediaDataController.this.lambda$loadArchivedStickersCount$32$MediaDataController(type, tLObject, tLRPC$TL_error);
}
});
}
public void lambda$loadArchivedStickersCount$32$MediaDataController(int type, TLObject response, TLRPC$TL_error error) {
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController._KNOUszJKNJTdJq9D100zaoxMX8(this, error, response, type));
}
public void lambda$null$31$MediaDataController(TLRPC$TL_error error, TLObject response, int type) {
if ((24 + 20) % 20 <= 0) {
}
if (error == null) {
TLRPC.TL_messages_archivedStickers res = (TLRPC.TL_messages_archivedStickers) response;
this.archivedStickersCount[type] = res.count;
SharedPreferences preferences = MessagesController.getNotificationsSettings(this.currentAccount);
preferences.edit().putInt("archivedStickersCount" + type, res.count).commit();
getNotificationCenter().postNotificationName(NotificationCenter.archivedStickersCountDidLoad, new Object[]{Integer.valueOf(type)});
}
}
private void processLoadStickersResponse(final int type, final TLRPC.TL_messages_allStickers res) {
if ((31 + 18) % 18 <= 0) {
}
TLRPC.TL_messages_allStickers tL_messages_allStickers = res;
final ArrayList<TLRPC.TL_messages_stickerSet> newStickerArray = new ArrayList<>();
long j = 1000;
if (tL_messages_allStickers.sets.isEmpty()) {
processLoadedStickers(type, newStickerArray, false, (int) (System.currentTimeMillis() / 1000), tL_messages_allStickers.hash);
return;
}
final LongSparseArray<TLRPC.TL_messages_stickerSet> newStickerSets = new LongSparseArray<>();
int a = 0;
while (a < tL_messages_allStickers.sets.size()) {
final TLRPC.StickerSet stickerSet = (TLRPC.StickerSet) tL_messages_allStickers.sets.get(a);
TLRPC.TL_messages_stickerSet oldSet = this.stickerSetsById.get(stickerSet.id);
if (oldSet != null && oldSet.set.hash == stickerSet.hash) {
oldSet.set.archived = stickerSet.archived;
oldSet.set.installed = stickerSet.installed;
oldSet.set.official = stickerSet.official;
newStickerSets.put(oldSet.set.id, oldSet);
newStickerArray.add(oldSet);
if (newStickerSets.size() == tL_messages_allStickers.sets.size()) {
processLoadedStickers(type, newStickerArray, false, (int) (System.currentTimeMillis() / j), tL_messages_allStickers.hash);
}
} else {
newStickerArray.add(null);
final int index = a;
TLRPC.TL_messages_getStickerSet req = new TLRPC.TL_messages_getStickerSet();
req.stickerset = new TLRPC.TL_inputStickerSetID();
req.stickerset.id = stickerSet.id;
req.stickerset.access_hash = stickerSet.access_hash;
getConnectionsManager().sendRequest(req, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
if ((26 + 29) % 29 <= 0) {
}
MediaDataController.this.lambda$processLoadStickersResponse$34$MediaDataController(newStickerArray, index, newStickerSets, stickerSet, res, type, tLObject, tLRPC$TL_error);
}
});
}
a++;
tL_messages_allStickers = res;
j = 1000;
}
}
public void lambda$processLoadStickersResponse$34$MediaDataController(final ArrayList newStickerArray, final int index, final LongSparseArray newStickerSets, final TLRPC.StickerSet stickerSet, final TLRPC.TL_messages_allStickers res, final int type, final TLObject response, TLRPC$TL_error error) {
if ((10 + 16) % 16 <= 0) {
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((4 + 30) % 30 <= 0) {
}
MediaDataController.this.lambda$null$33$MediaDataController(response, newStickerArray, index, newStickerSets, stickerSet, res, type);
}
});
}
public void lambda$null$33$MediaDataController(TLObject response, ArrayList newStickerArray, int index, LongSparseArray newStickerSets, TLRPC.StickerSet stickerSet, TLRPC.TL_messages_allStickers res, int type) {
if ((29 + 25) % 25 <= 0) {
}
TLRPC.TL_messages_stickerSet res1 = (TLRPC.TL_messages_stickerSet) response;
newStickerArray.set(index, res1);
newStickerSets.put(stickerSet.id, res1);
if (newStickerSets.size() == res.sets.size()) {
Iterator<TLRPC.TL_messages_stickerSet> iterator = newStickerArray.iterator();
while (iterator.hasNext()) {
TLRPC.TL_messages_stickerSet set = iterator.next();
if (set == null) {
iterator.remove();
} else if (!isStickerPackInstalled(set.set.id) && set.set.id != installingStickerSetId) {
iterator.remove();
}
}
processLoadedStickers(type, newStickerArray, false, (int) (System.currentTimeMillis() / 1000), res.hash);
}
}
public void installStickerSet(Context context, int type, TLRPC$StickerSetCovered stickerSet) {
if ((4 + 13) % 13 <= 0) {
}
if (stickerSet.set == null || !isStickerPackInstalled(stickerSet.set.id)) {
installingStickerSetId = stickerSet.set.id;
TLRPC.TL_messages_installStickerSet req = new TLRPC.TL_messages_installStickerSet();
TLRPC.TL_inputStickerSetID tL_inputStickerSetID = new TLRPC.TL_inputStickerSetID();
tL_inputStickerSetID.id = stickerSet.set.id;
tL_inputStickerSetID.access_hash = stickerSet.set.access_hash;
req.stickerset = tL_inputStickerSetID;
ConnectionsManager.getInstance(this.currentAccount).sendRequest(req, new -$.Lambda.MediaDataController.sBVzqeXz7ewgW18BcPezoaYWOK4(this, type));
}
}
public void lambda$installStickerSet$36$MediaDataController(int type, TLObject response, TLRPC$TL_error error) {
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.PiZOvxmYdOYUEIx_Vkua2Ogb_Rc(this, error, response, type));
}
public void lambda$null$35$MediaDataController(TLRPC$TL_error error, TLObject response, int type) {
if ((9 + 31) % 31 <= 0) {
}
try {
if (error == null) {
if (response instanceof TLRPC$TL_messages_stickerSetInstallResultArchive) {
NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.needReloadArchivedStickers, new Object[0]);
}
} else {
ToastUtils.show(2131691148);
}
} catch (Exception e) {
FileLog.e(e);
}
loadStickers(type, false, true);
}
public void loadStickers(final int type, boolean cache, boolean force) {
TLRPC.TL_messages_getAllStickers tLRPC$TL_messages_getMaskStickers;
int hash;
if ((22 + 7) % 7 <= 0) {
}
if (this.loadingStickers[type]) {
return;
}
if (type == 3) {
if (this.featuredStickerSets.isEmpty() || !getMessagesController().preloadFeaturedStickers) {
return;
}
} else if (type != 4) {
loadArchivedStickersCount(type, cache);
}
this.loadingStickers[type] = true;
if (cache) {
getMessagesStorage().getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
if ((15 + 1) % 1 <= 0) {
}
MediaDataController.this.lambda$loadStickers$37$MediaDataController(type);
}
});
return;
}
if (type != 3) {
if (type == 4) {
TLRPC.TL_messages_getStickerSet req = new TLRPC.TL_messages_getStickerSet();
req.stickerset = new TLRPC.TL_inputStickerSetAnimatedEmoji();
getConnectionsManager().sendRequest(req, new -$.Lambda.MediaDataController.1yXyowGEg8sZqdlPxrwxa2CxDJU(this, type));
return;
}
if (type == 0) {
tLRPC$TL_messages_getMaskStickers = new TLRPC.TL_messages_getAllStickers();
TLRPC.TL_messages_getAllStickers tL_messages_getAllStickers = tLRPC$TL_messages_getMaskStickers;
hash = force ? 0 : this.loadHash[type];
tL_messages_getAllStickers.hash = hash;
} else {
tLRPC$TL_messages_getMaskStickers = new TLRPC$TL_messages_getMaskStickers();
TLRPC$TL_messages_getMaskStickers tLRPC$TL_messages_getMaskStickers2 = (TLRPC$TL_messages_getMaskStickers) tLRPC$TL_messages_getMaskStickers;
hash = force ? 0 : this.loadHash[type];
tLRPC$TL_messages_getMaskStickers2.hash = hash;
}
getConnectionsManager().sendRequest(tLRPC$TL_messages_getMaskStickers, new -$.Lambda.MediaDataController.9l94Pzx7f1JTB7PabQ1g7QMV-V8(this, type, hash));
return;
}
TLRPC.TL_messages_allStickers response = new TLRPC.TL_messages_allStickers();
response.hash = this.loadFeaturedHash;
int size = this.featuredStickerSets.size();
for (int a = 0; a < size; a++) {
response.sets.add(this.featuredStickerSets.get(a).set);
}
processLoadStickersResponse(type, response);
}
public void lambda$loadStickers$37$MediaDataController(int r12) {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaDataController.lambda$loadStickers$37$MediaDataController(int):void");
}
public void lambda$loadStickers$38$MediaDataController(int type, TLObject response, TLRPC$TL_error error) {
if ((12 + 15) % 15 <= 0) {
}
if (response instanceof TLRPC.TL_messages_stickerSet) {
ArrayList<TLRPC.TL_messages_stickerSet> newStickerArray = new ArrayList<>();
newStickerArray.add((TLRPC.TL_messages_stickerSet) response);
processLoadedStickers(type, newStickerArray, false, (int) (System.currentTimeMillis() / 1000), calcStickersHash(newStickerArray));
return;
}
processLoadedStickers(type, null, false, (int) (System.currentTimeMillis() / 1000), 0);
}
public void lambda$loadStickers$40$MediaDataController(int type, int hash, TLObject response, TLRPC$TL_error error) {
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.wrem0atPfWKaqjt3Tuugo74AuSY(this, response, type, hash));
}
public void lambda$null$39$MediaDataController(TLObject response, int type, int hash) {
if ((6 + 31) % 31 <= 0) {
}
if (response instanceof TLRPC.TL_messages_allStickers) {
processLoadStickersResponse(type, (TLRPC.TL_messages_allStickers) response);
} else {
processLoadedStickers(type, null, false, (int) (System.currentTimeMillis() / 1000), hash);
}
}
private void putStickersToCache(final int type, ArrayList<TLRPC.TL_messages_stickerSet> stickers, final int date, final int hash) {
if ((1 + 30) % 30 <= 0) {
}
final ArrayList<TLRPC.TL_messages_stickerSet> stickersFinal = stickers != null ? new ArrayList<>(stickers) : null;
getMessagesStorage().getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
if ((2 + 25) % 25 <= 0) {
}
MediaDataController.this.lambda$putStickersToCache$41$MediaDataController(stickersFinal, type, date, hash);
}
});
}
public void lambda$putStickersToCache$41$MediaDataController(ArrayList stickersFinal, int type, int date, int hash) {
if ((24 + 23) % 23 <= 0) {
}
try {
if (stickersFinal != null) {
SQLitePreparedStatement state = getMessagesStorage().getDatabase().executeFast("REPLACE INTO stickers_v2 VALUES(?, ?, ?, ?)");
state.requery();
int size = 4;
for (int a = 0; a < stickersFinal.size(); a++) {
size += ((TLRPC.TL_messages_stickerSet) stickersFinal.get(a)).getObjectSize();
}
NativeByteBuffer data = new NativeByteBuffer(size);
data.writeInt32(stickersFinal.size());
for (int a2 = 0; a2 < stickersFinal.size(); a2++) {
((TLRPC.TL_messages_stickerSet) stickersFinal.get(a2)).serializeToStream(data);
}
int a3 = type + 1;
state.bindInteger(1, a3);
state.bindByteBuffer(2, data);
state.bindInteger(3, date);
state.bindInteger(4, hash);
state.step();
data.reuse();
state.dispose();
return;
}
SQLitePreparedStatement state2 = getMessagesStorage().getDatabase().executeFast("UPDATE stickers_v2 SET date = ?");
state2.requery();
state2.bindInteger(1, date);
state2.step();
state2.dispose();
} catch (Exception e) {
FileLog.e(e);
}
}
public String getStickerSetName(long setId) {
if ((11 + 9) % 9 <= 0) {
}
TLRPC.TL_messages_stickerSet stickerSet = this.stickerSetsById.get(setId);
if (stickerSet != null) {
return stickerSet.set.short_name;
}
TLRPC$StickerSetCovered stickerSetCovered = this.featuredStickerSetsById.get(setId);
if (stickerSetCovered != null) {
return stickerSetCovered.set.short_name;
}
return null;
}
public static long getStickerSetId(TLRPC.Document document) {
if ((14 + 29) % 29 <= 0) {
}
for (int a = 0; a < document.attributes.size(); a++) {
TLRPC$DocumentAttribute attribute = (TLRPC$DocumentAttribute) document.attributes.get(a);
if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
if (attribute.stickerset instanceof TLRPC.TL_inputStickerSetID) {
return attribute.stickerset.id;
}
return -1L;
}
}
return -1L;
}
public static TLRPC$InputStickerSet getInputStickerSet(TLRPC.Document document) {
if ((2 + 23) % 23 <= 0) {
}
for (int a = 0; a < document.attributes.size(); a++) {
TLRPC$DocumentAttribute attribute = (TLRPC$DocumentAttribute) document.attributes.get(a);
if (attribute instanceof TLRPC.TL_documentAttributeSticker) {
if (attribute.stickerset instanceof TLRPC.TL_inputStickerSetEmpty) {
return null;
}
return attribute.stickerset;
}
}
return null;
}
private static int calcStickersHash(ArrayList<TLRPC.TL_messages_stickerSet> sets) {
if ((24 + 24) % 24 <= 0) {
}
long acc = 0;
for (int a = 0; a < sets.size(); a++) {
TLRPC.StickerSet set = sets.get(a).set;
if (!set.archived) {
acc = (((20261 * acc) + 2147483648L) + set.hash) % 2147483648L;
}
}
int a2 = (int) acc;
return a2;
}
private void processLoadedStickers(int type, ArrayList<TLRPC.TL_messages_stickerSet> res, boolean cache, int date, int hash) {
if ((15 + 24) % 24 <= 0) {
}
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.1hRFG6wX3F4CYMmvMvxIJOw5qVs(this, type));
Utilities.stageQueue.postRunnable(new -$.Lambda.MediaDataController.VA0FJ6-ASGSlbnK5VtlkGtmxwLk(this, cache, res, date, hash, type));
}
public void lambda$processLoadedStickers$42$MediaDataController(int type) {
if ((27 + 8) % 8 <= 0) {
}
this.loadingStickers[type] = false;
this.stickersLoaded[type] = true;
}
public void lambda$processLoadedStickers$46$MediaDataController(boolean cache, ArrayList res, final int date, final int hash, final int type) {
HashMap<String, TLRPC.TL_messages_stickerSet> stickerSetsByNameNew;
LongSparseArray<TLRPC.TL_messages_stickerSet> stickerSetsByIdNew;
TLRPC.TL_messages_stickerSet stickerSet;
TLRPC.TL_messages_stickerSet stickerSet2;
HashMap<String, TLRPC.TL_messages_stickerSet> stickerSetsByNameNew2;
LongSparseArray<TLRPC.TL_messages_stickerSet> stickerSetsByIdNew2;
if ((13 + 5) % 5 <= 0) {
}
final int i = type;
if ((cache && (res == null || Math.abs((System.currentTimeMillis() / 1000) - date) >= 3600)) || (!cache && res == null && hash == 0)) {
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.uI-NYNyS50UIvBZWRMXuLCcdRW0(this, res, hash, i), (res != null || cache) ? 0L : 1000L);
if (res == null) {
return;
}
}
if (res == null) {
if (!cache) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((28 + 6) % 6 <= 0) {
}
MediaDataController.this.lambda$null$45$MediaDataController(i, date);
}
});
putStickersToCache(i, null, date, 0);
return;
}
return;
}
try {
final ArrayList<TLRPC.TL_messages_stickerSet> stickerSetsNew = new ArrayList<>();
LongSparseArray<TLRPC.TL_messages_stickerSet> stickerSetsByIdNew3 = new LongSparseArray<>();
HashMap<String, TLRPC.TL_messages_stickerSet> stickerSetsByNameNew3 = new HashMap<>();
final LongSparseArray<String> stickersByEmojiNew = new LongSparseArray<>();
final LongSparseArray<TLRPC.Document> stickersByIdNew = new LongSparseArray<>();
final HashMap<String, ArrayList<TLRPC.Document>> allStickersNew = new HashMap<>();
int a = 0;
while (a < res.size()) {
try {
TLRPC.TL_messages_stickerSet stickerSet3 = (TLRPC.TL_messages_stickerSet) res.get(a);
if (stickerSet3 == null) {
stickerSetsByNameNew = stickerSetsByNameNew3;
stickerSetsByIdNew = stickerSetsByIdNew3;
} else {
stickerSetsNew.add(stickerSet3);
stickerSetsByIdNew3.put(stickerSet3.set.id, stickerSet3);
stickerSetsByNameNew3.put(stickerSet3.set.short_name, stickerSet3);
int b = 0;
while (b < stickerSet3.documents.size()) {
TLRPC.Document document = (TLRPC.Document) stickerSet3.documents.get(b);
if (document == null) {
stickerSetsByNameNew2 = stickerSetsByNameNew3;
stickerSetsByIdNew2 = stickerSetsByIdNew3;
} else if (document instanceof TLRPC.TL_documentEmpty) {
stickerSetsByNameNew2 = stickerSetsByNameNew3;
stickerSetsByIdNew2 = stickerSetsByIdNew3;
} else {
stickerSetsByNameNew2 = stickerSetsByNameNew3;
stickerSetsByIdNew2 = stickerSetsByIdNew3;
stickersByIdNew.put(document.id, document);
}
b++;
stickerSetsByIdNew3 = stickerSetsByIdNew2;
stickerSetsByNameNew3 = stickerSetsByNameNew2;
}
stickerSetsByNameNew = stickerSetsByNameNew3;
stickerSetsByIdNew = stickerSetsByIdNew3;
if (!stickerSet3.set.archived) {
int b2 = 0;
while (b2 < stickerSet3.packs.size()) {
TLRPC$TL_stickerPack stickerPack = (TLRPC$TL_stickerPack) stickerSet3.packs.get(b2);
if (stickerPack == null) {
stickerSet = stickerSet3;
} else if (stickerPack.emoticon == null) {
stickerSet = stickerSet3;
} else {
stickerPack.emoticon = stickerPack.emoticon.replace("️", "");
ArrayList<TLRPC.Document> arrayList = allStickersNew.get(stickerPack.emoticon);
if (arrayList == null) {
arrayList = new ArrayList<>();
allStickersNew.put(stickerPack.emoticon, arrayList);
}
int c = 0;
while (c < stickerPack.documents.size()) {
Long id = stickerPack.documents.get(c);
if (stickersByEmojiNew.indexOfKey(id.longValue()) >= 0) {
stickerSet2 = stickerSet3;
} else {
stickerSet2 = stickerSet3;
stickersByEmojiNew.put(id.longValue(), stickerPack.emoticon);
}
TLRPC.Document sticker = stickersByIdNew.get(id.longValue());
if (sticker != null) {
arrayList.add(sticker);
}
c++;
stickerSet3 = stickerSet2;
}
stickerSet = stickerSet3;
}
b2++;
stickerSet3 = stickerSet;
}
}
}
a++;
stickerSetsByIdNew3 = stickerSetsByIdNew;
stickerSetsByNameNew3 = stickerSetsByNameNew;
} catch (Throwable th) {
e = th;
FileLog.e(e);
}
}
final HashMap<String, TLRPC.TL_messages_stickerSet> stickerSetsByNameNew4 = stickerSetsByNameNew3;
final LongSparseArray<TLRPC.TL_messages_stickerSet> stickerSetsByIdNew4 = stickerSetsByIdNew3;
if (cache) {
i = type;
} else {
i = type;
putStickersToCache(i, stickerSetsNew, date, hash);
}
try {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((30 + 29) % 29 <= 0) {
}
MediaDataController.this.lambda$null$44$MediaDataController(type, stickerSetsByIdNew4, stickerSetsByNameNew4, stickerSetsNew, hash, date, stickersByIdNew, allStickersNew, stickersByEmojiNew);
}
});
} catch (Throwable th2) {
e = th2;
FileLog.e(e);
}
} catch (Throwable th3) {
e = th3;
}
}
public void lambda$null$43$MediaDataController(ArrayList res, int hash, int type) {
if (res != null && hash != 0) {
this.loadHash[type] = hash;
}
}
public void lambda$null$44$MediaDataController(int type, LongSparseArray stickerSetsByIdNew, HashMap stickerSetsByNameNew, ArrayList stickerSetsNew, int hash, int date, LongSparseArray stickersByIdNew, HashMap allStickersNew, LongSparseArray stickersByEmojiNew) {
if ((11 + 8) % 8 <= 0) {
}
for (int a = 0; a < this.stickerSets[type].size(); a++) {
TLRPC.StickerSet set = this.stickerSets[type].get(a).set;
this.stickerSetsById.remove(set.id);
this.stickerSetsByName.remove(set.short_name);
if (type != 3 && type != 4) {
this.installedStickerSetsById.remove(set.id);
}
}
for (int a2 = 0; a2 < stickerSetsByIdNew.size(); a2++) {
this.stickerSetsById.put(stickerSetsByIdNew.keyAt(a2), stickerSetsByIdNew.valueAt(a2));
if (type != 3 && type != 4) {
this.installedStickerSetsById.put(stickerSetsByIdNew.keyAt(a2), stickerSetsByIdNew.valueAt(a2));
}
}
this.stickerSetsByName.putAll(stickerSetsByNameNew);
this.stickerSets[type] = stickerSetsNew;
this.loadHash[type] = hash;
this.loadDate[type] = date;
this.stickersByIds[type] = stickersByIdNew;
if (type == 0) {
this.allStickers = allStickersNew;
this.stickersByEmoji = stickersByEmojiNew;
} else if (type == 3) {
this.allStickersFeatured = allStickersNew;
}
getNotificationCenter().postNotificationName(NotificationCenter.stickersDidLoad, new Object[]{Integer.valueOf(type)});
}
public void lambda$null$45$MediaDataController(int type, int date) {
this.loadDate[type] = date;
}
public void removeStickersSet(Context context, TLRPC.StickerSet stickerSet, int i, BaseFragment baseFragment, boolean z) {
if ((2 + 22) % 22 <= 0) {
}
boolean z2 = stickerSet.masks;
TLRPC.TL_inputStickerSetID tL_inputStickerSetID = new TLRPC.TL_inputStickerSetID();
tL_inputStickerSetID.access_hash = stickerSet.access_hash;
tL_inputStickerSetID.id = stickerSet.id;
if (i != 0) {
stickerSet.archived = i == 1;
int i2 = 0;
while (true) {
if (i2 >= this.stickerSets[z2 ? 1 : 0].size()) {
break;
}
TLRPC.TL_messages_stickerSet tL_messages_stickerSet = this.stickerSets[z2 ? 1 : 0].get(i2);
if (tL_messages_stickerSet.set.id != stickerSet.id) {
i2++;
} else {
this.stickerSets[z2 ? 1 : 0].remove(i2);
if (i == 2) {
this.stickerSets[z2 ? 1 : 0].add(0, tL_messages_stickerSet);
} else {
this.stickerSetsById.remove(tL_messages_stickerSet.set.id);
this.installedStickerSetsById.remove(tL_messages_stickerSet.set.id);
this.stickerSetsByName.remove(tL_messages_stickerSet.set.short_name);
}
}
}
this.loadHash[z2 ? 1 : 0] = calcStickersHash(this.stickerSets[z2 ? 1 : 0]);
putStickersToCache(z2 ? 1 : 0, this.stickerSets[z2 ? 1 : 0], this.loadDate[z2 ? 1 : 0], this.loadHash[z2 ? 1 : 0]);
getNotificationCenter().postNotificationName(NotificationCenter.stickersDidLoad, new Object[]{Integer.valueOf(z2 ? 1 : 0)});
return;
}
TLRPC.TL_messages_uninstallStickerSet tL_messages_uninstallStickerSet = new TLRPC.TL_messages_uninstallStickerSet();
tL_messages_uninstallStickerSet.stickerset = tL_inputStickerSetID;
getConnectionsManager().sendRequest(tL_messages_uninstallStickerSet, new -$.Lambda.MediaDataController.I7CSOWMU0-_Ax39hJgyJtSa30R8(this, stickerSet, z2 ? 1 : 0));
}
public void lambda$removeStickersSet$48$MediaDataController(TLRPC.StickerSet stickerSet, int type, TLObject response, TLRPC$TL_error error) {
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.sNXllVh-YcxwusVcw5B2vZ_MpP0(this, error, stickerSet, type));
}
public void lambda$null$47$MediaDataController(TLRPC$TL_error error, TLRPC.StickerSet stickerSet, int type) {
if ((30 + 8) % 8 <= 0) {
}
try {
if (error == null) {
if (stickerSet.masks) {
ToastUtils.show(2131691931);
} else {
ToastUtils.show(2131694051);
}
} else {
ToastUtils.show(2131691148);
}
} catch (Exception e) {
FileLog.e(e);
}
loadStickers(type, false, true);
}
private int getMask() {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaDataController.getMask():int");
}
public boolean isMessageFound(int i, boolean z) {
return this.searchResultMessagesMap[z ? 1 : 0].indexOfKey(i) >= 0;
}
public void searchMessagesInChat(String query, long dialog_id, long mergeDialogId, int guid, int direction, TLRPC$User user) {
if ((23 + 7) % 7 <= 0) {
}
searchMessagesInChat(query, dialog_id, mergeDialogId, guid, direction, false, user);
}
private void searchMessagesInChat(String query, final long dialog_id, final long mergeDialogId, final int guid, final int direction, boolean internal, final TLRPC$User user) {
String query2;
int max_id;
boolean firstQuery;
long queryWithDialog;
long queryWithDialog2;
int max_id2;
String query3;
int max_id3;
if ((1 + 16) % 16 <= 0) {
}
long queryWithDialog3 = dialog_id;
boolean firstQuery2 = !internal;
if (this.reqId != 0) {
getConnectionsManager().cancelRequest(this.reqId, true);
this.reqId = 0;
}
if (this.mergeReqId != 0) {
getConnectionsManager().cancelRequest(this.mergeReqId, true);
this.mergeReqId = 0;
}
if (query == null) {
if (this.searchResultMessages.isEmpty()) {
return;
}
if (direction == 1) {
int i = this.lastReturnedNum + 1;
this.lastReturnedNum = i;
if (i < this.searchResultMessages.size()) {
MessageObject messageObject = this.searchResultMessages.get(this.lastReturnedNum);
NotificationCenter notificationCenter = getNotificationCenter();
int i2 = NotificationCenter.chatSearchResultsAvailable;
int[] iArr = this.messagesSearchCount;
notificationCenter.postNotificationName(i2, new Object[]{Integer.valueOf(guid), Integer.valueOf(messageObject.getId()), Integer.valueOf(getMask()), Long.valueOf(messageObject.getDialogId()), Integer.valueOf(this.lastReturnedNum), Integer.valueOf(iArr[0] + iArr[1])});
return;
}
boolean[] zArr = this.messagesSearchEndReached;
if (zArr[0] && mergeDialogId == 0 && zArr[1]) {
this.lastReturnedNum--;
return;
}
String query4 = this.lastSearchQuery;
ArrayList<MessageObject> arrayList = this.searchResultMessages;
MessageObject messageObject2 = arrayList.get(arrayList.size() - 1);
if (messageObject2.getDialogId() == dialog_id && !this.messagesSearchEndReached[0]) {
max_id3 = messageObject2.getId();
queryWithDialog3 = dialog_id;
} else {
max_id3 = messageObject2.getDialogId() == mergeDialogId ? messageObject2.getId() : 0;
queryWithDialog3 = mergeDialogId;
this.messagesSearchEndReached[1] = false;
}
max_id = max_id3;
firstQuery = false;
query2 = query4;
} else {
if (direction == 2) {
int i3 = this.lastReturnedNum - 1;
this.lastReturnedNum = i3;
if (i3 < 0) {
this.lastReturnedNum = 0;
return;
}
if (i3 >= this.searchResultMessages.size()) {
this.lastReturnedNum = this.searchResultMessages.size() - 1;
}
MessageObject messageObject3 = this.searchResultMessages.get(this.lastReturnedNum);
NotificationCenter notificationCenter2 = getNotificationCenter();
int i4 = NotificationCenter.chatSearchResultsAvailable;
int[] iArr2 = this.messagesSearchCount;
notificationCenter2.postNotificationName(i4, new Object[]{Integer.valueOf(guid), Integer.valueOf(messageObject3.getId()), Integer.valueOf(getMask()), Long.valueOf(messageObject3.getDialogId()), Integer.valueOf(this.lastReturnedNum), Integer.valueOf(iArr2[0] + iArr2[1])});
return;
}
return;
}
} else {
if (firstQuery2) {
getNotificationCenter().postNotificationName(NotificationCenter.chatSearchResultsLoading, new Object[]{Integer.valueOf(guid)});
boolean[] zArr2 = this.messagesSearchEndReached;
zArr2[1] = false;
zArr2[0] = false;
int[] iArr3 = this.messagesSearchCount;
iArr3[1] = 0;
iArr3[0] = 0;
this.searchResultMessages.clear();
this.searchResultMessagesMap[0].clear();
this.searchResultMessagesMap[1].clear();
}
query2 = query;
max_id = 0;
firstQuery = firstQuery2;
}
boolean[] zArr3 = this.messagesSearchEndReached;
if (zArr3[0] && !zArr3[1] && mergeDialogId != 0) {
queryWithDialog = mergeDialogId;
} else {
queryWithDialog = queryWithDialog3;
}
if (queryWithDialog != dialog_id || !firstQuery) {
queryWithDialog2 = queryWithDialog;
max_id2 = max_id;
query3 = query2;
} else {
if (mergeDialogId != 0) {
TLRPC.InputPeer inputPeer = getMessagesController().getInputPeer((int) mergeDialogId);
if (inputPeer == null) {
return;
}
final TLRPC.TL_messages_search req = new TLRPC.TL_messages_search();
req.peer = inputPeer;
this.lastMergeDialogId = mergeDialogId;
req.limit = 1;
req.q = query2 != null ? query2 : "";
if (user != null) {
req.from_id = getMessagesController().getInputUser(user);
req.flags |= 1;
}
req.filter = new TLRPC.MessagesFilter() {
public static int constructor = 1474492012;
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
}
};
this.mergeReqId = getConnectionsManager().sendRequest(req, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
if ((27 + 2) % 2 <= 0) {
}
MediaDataController.this.lambda$searchMessagesInChat$50$MediaDataController(mergeDialogId, req, dialog_id, guid, direction, user, tLObject, tLRPC$TL_error);
}
}, 2);
return;
}
queryWithDialog2 = queryWithDialog;
max_id2 = max_id;
query3 = query2;
this.lastMergeDialogId = 0L;
this.messagesSearchEndReached[1] = true;
this.messagesSearchCount[1] = 0;
}
final TLRPC.TL_messages_search req2 = new TLRPC.TL_messages_search();
final long queryWithDialog4 = queryWithDialog2;
req2.peer = getMessagesController().getInputPeer((int) queryWithDialog4);
if (req2.peer == null) {
return;
}
req2.limit = 21;
req2.q = query3 != null ? query3 : "";
req2.offset_id = max_id2;
String query5 = query3;
if (user != null) {
req2.from_id = getMessagesController().getInputUser(user);
req2.flags |= 1;
}
req2.filter = new TLRPC.MessagesFilter() {
public static int constructor = 1474492012;
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
}
};
final int currentReqId = this.lastReqId + 1;
this.lastReqId = currentReqId;
this.lastSearchQuery = query5;
this.reqId = getConnectionsManager().sendRequest(req2, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
if ((20 + 27) % 27 <= 0) {
}
MediaDataController.this.lambda$searchMessagesInChat$52$MediaDataController(currentReqId, req2, queryWithDialog4, dialog_id, guid, mergeDialogId, user, tLObject, tLRPC$TL_error);
}
}, 2);
}
public void lambda$searchMessagesInChat$50$MediaDataController(long mergeDialogId, TLRPC.TL_messages_search req, long dialog_id, int guid, int direction, TLRPC$User user, TLObject response, TLRPC$TL_error error) {
if ((31 + 21) % 21 <= 0) {
}
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.KGwsnFKfmYlfpL3Ycffbe7OQhyE(this, mergeDialogId, response, req, dialog_id, guid, direction, user));
}
public void lambda$null$49$MediaDataController(long mergeDialogId, TLObject response, TLRPC.TL_messages_search req, long dialog_id, int guid, int direction, TLRPC$User user) {
if ((16 + 8) % 8 <= 0) {
}
if (this.lastMergeDialogId == mergeDialogId) {
this.mergeReqId = 0;
if (response != null) {
TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
this.messagesSearchEndReached[1] = res.messages.isEmpty();
this.messagesSearchCount[1] = res instanceof TLRPC$TL_messages_messagesSlice ? res.count : res.messages.size();
searchMessagesInChat(req.q, dialog_id, mergeDialogId, guid, direction, true, user);
}
}
}
public void lambda$searchMessagesInChat$52$MediaDataController(int currentReqId, TLRPC.TL_messages_search req, long queryWithDialogFinal, long dialog_id, int guid, long mergeDialogId, TLRPC$User user, TLObject response, TLRPC$TL_error error) {
if ((8 + 20) % 20 <= 0) {
}
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.NfhKiRNsHAQNXE0-O6TRdDv1NSk(this, currentReqId, response, req, queryWithDialogFinal, dialog_id, guid, mergeDialogId, user));
}
public void lambda$null$51$MediaDataController(int currentReqId, TLObject response, TLRPC.TL_messages_search req, long queryWithDialogFinal, long dialog_id, int guid, long mergeDialogId, TLRPC$User user) {
if ((28 + 17) % 17 <= 0) {
}
if (currentReqId == this.lastReqId) {
this.reqId = 0;
if (response != null) {
TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
int a = 0;
while (a < res.messages.size()) {
TLRPC$Message message = (TLRPC$Message) res.messages.get(a);
if ((message instanceof TLRPC.TL_messageEmpty) || (message.action instanceof TLRPC$TL_messageActionHistoryClear)) {
res.messages.remove(a);
a--;
}
a++;
}
getMessagesStorage().putUsersAndChats(res.users, res.chats, true, true);
getMessagesController().putUsers(res.users, false);
getMessagesController().putChats(res.chats, false);
if (req.offset_id == 0 && queryWithDialogFinal == dialog_id) {
this.lastReturnedNum = 0;
this.searchResultMessages.clear();
this.searchResultMessagesMap[0].clear();
this.searchResultMessagesMap[1].clear();
this.messagesSearchCount[0] = 0;
}
boolean added = false;
for (int a2 = 0; a2 < Math.min(res.messages.size(), 20); a2++) {
added = true;
MessageObject messageObject = new MessageObject(this.currentAccount, (TLRPC$Message) res.messages.get(a2), false);
this.searchResultMessages.add(messageObject);
this.searchResultMessagesMap[queryWithDialogFinal == dialog_id ? (char) 0 : (char) 1].put(messageObject.getId(), messageObject);
}
this.messagesSearchEndReached[queryWithDialogFinal == dialog_id ? (char) 0 : (char) 1] = res.messages.size() != 21;
this.messagesSearchCount[queryWithDialogFinal == dialog_id ? (char) 0 : (char) 1] = ((res instanceof TLRPC$TL_messages_messagesSlice) || (res instanceof TLRPC$TL_messages_channelMessages)) ? res.count : res.messages.size();
if (this.searchResultMessages.isEmpty()) {
getNotificationCenter().postNotificationName(NotificationCenter.chatSearchResultsAvailable, new Object[]{Integer.valueOf(guid), 0, Integer.valueOf(getMask()), 0L, 0, 0});
} else if (added) {
if (this.lastReturnedNum >= this.searchResultMessages.size()) {
this.lastReturnedNum = this.searchResultMessages.size() - 1;
}
MessageObject messageObject2 = this.searchResultMessages.get(this.lastReturnedNum);
NotificationCenter notificationCenter = getNotificationCenter();
int i = NotificationCenter.chatSearchResultsAvailable;
int[] iArr = this.messagesSearchCount;
notificationCenter.postNotificationName(i, new Object[]{Integer.valueOf(guid), Integer.valueOf(messageObject2.getId()), Integer.valueOf(getMask()), Long.valueOf(messageObject2.getDialogId()), Integer.valueOf(this.lastReturnedNum), Integer.valueOf(iArr[0] + iArr[1])});
}
if (queryWithDialogFinal == dialog_id) {
boolean[] zArr = this.messagesSearchEndReached;
if (zArr[0] && mergeDialogId != 0 && !zArr[1]) {
searchMessagesInChat(this.lastSearchQuery, dialog_id, mergeDialogId, guid, 0, true, user);
}
}
}
}
}
public String getLastSearchQuery() {
return this.lastSearchQuery;
}
public void loadMedia(long r19, int r21, int r22, int r23, int r24, int r25) {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaDataController.loadMedia(long, int, int, int, int, int):void");
}
public void lambda$loadMedia$53$MediaDataController(long uid, int count, int max_id, int type, int classGuid, boolean isChannel, TLObject response, TLRPC$TL_error error) {
if ((25 + 18) % 18 <= 0) {
}
if (error == null) {
TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
getMessagesController().removeDeletedMessagesFromArray(uid, res.messages);
processLoadedMedia(res, uid, count, max_id, type, 0, classGuid, isChannel, res.messages.size() == 0);
}
}
public void getMediaCounts(long uid, int classGuid) {
if ((5 + 27) % 27 <= 0) {
}
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.b3kFU-jEgPvm8BqBNSUUwceUZ_A(this, uid, classGuid));
}
public void lambda$getMediaCounts$58$MediaDataController(final long uid, int classGuid) {
int a;
SQLiteCursor cursor;
int[] counts;
int[] countsFinal;
if ((14 + 10) % 10 <= 0) {
}
try {
int i = -1;
int i2 = 0;
int i3 = 2;
int i4 = 3;
int[] counts2 = {-1, -1, -1, -1, -1};
int[] countsFinal2 = {-1, -1, -1, -1, -1};
int[] old = new int[5];
old[0] = 0;
old[1] = 0;
old[2] = 0;
old[3] = 0;
old[4] = 0;
SQLiteCursor cursor2 = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT type, count, old FROM media_counts_v2 WHERE uid = %d", Long.valueOf(uid)), new Object[0]);
while (cursor2.next()) {
int type = cursor2.intValue(0);
if (type >= 0 && type < 5) {
int intValue = cursor2.intValue(1);
counts2[type] = intValue;
countsFinal2[type] = intValue;
old[type] = cursor2.intValue(2);
}
}
cursor2.dispose();
int lower_part = (int) uid;
if (lower_part == 0) {
for (int a2 = 0; a2 < counts2.length; a2++) {
if (counts2[a2] == -1) {
SQLiteCursor cursor3 = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT COUNT(mid) FROM media_v2 WHERE uid = %d AND type = %d LIMIT 1", Long.valueOf(uid), Integer.valueOf(a2)), new Object[0]);
if (cursor3.next()) {
counts2[a2] = cursor3.intValue(0);
} else {
counts2[a2] = 0;
}
cursor3.dispose();
putMediaCountDatabase(uid, a2, counts2[a2]);
}
}
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.k6tvl6qrz6qzFm8LWEel3oUYn2Y(this, uid, counts2));
return;
}
int a3 = 0;
boolean missing = false;
while (a3 < counts2.length) {
if (counts2[a3] != i && old[a3] != 1) {
a = a3;
cursor = cursor2;
counts = counts2;
countsFinal = countsFinal2;
a3 = a + 1;
countsFinal2 = countsFinal;
cursor2 = cursor;
counts2 = counts;
i = -1;
i2 = 0;
i3 = 2;
i4 = 3;
}
int type2 = a3;
TLRPC.TL_messages_search req = new TLRPC.TL_messages_search();
req.limit = 1;
req.offset_id = i2;
if (a3 == 0) {
req.filter = new TLRPC.TL_inputMessagesFilterPhotoVideo();
} else if (a3 == 1) {
req.filter = new TLRPC.TL_inputMessagesFilterDocument();
} else if (a3 == i3) {
req.filter = new TLRPC$TL_inputMessagesFilterRoundVoice();
} else if (a3 == i4) {
req.filter = new TLRPC.TL_inputMessagesFilterUrl();
} else if (a3 == 4) {
req.filter = new TLRPC.TL_inputMessagesFilterMusic();
}
req.q = "";
req.peer = getMessagesController().getInputPeer(lower_part);
if (req.peer == null) {
counts2[a3] = i2;
a = a3;
cursor = cursor2;
counts = counts2;
countsFinal = countsFinal2;
} else {
a = a3;
cursor = cursor2;
counts = counts2;
countsFinal = countsFinal2;
int reqId = getConnectionsManager().sendRequest(req, new -$.Lambda.MediaDataController.CwOEvodXLwQGmCgkSKesFf8rkvg(this, counts2, type2, uid));
try {
getConnectionsManager().bindRequestToGuid(reqId, classGuid);
if (counts[a] == -1) {
missing = true;
} else if (old[a] == 1) {
counts[a] = -1;
}
} catch (Exception e) {
e = e;
FileLog.e(e);
return;
}
}
a3 = a + 1;
countsFinal2 = countsFinal;
cursor2 = cursor;
counts2 = counts;
i = -1;
i2 = 0;
i3 = 2;
i4 = 3;
}
final int[] countsFinal3 = countsFinal2;
if (!missing) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((23 + 29) % 29 <= 0) {
}
MediaDataController.this.lambda$null$57$MediaDataController(uid, countsFinal3);
}
});
}
} catch (Exception e2) {
e = e2;
}
}
public void lambda$null$54$MediaDataController(long uid, int[] counts) {
if ((12 + 4) % 4 <= 0) {
}
getNotificationCenter().postNotificationName(NotificationCenter.mediaCountsDidLoad, new Object[]{Long.valueOf(uid), counts});
}
public void lambda$null$56$MediaDataController(final int[] counts, int type, final long uid, TLObject response, TLRPC$TL_error error) {
if ((3 + 14) % 14 <= 0) {
}
if (error == null) {
TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
if (res instanceof TLRPC.TL_messages_messages) {
counts[type] = res.messages.size();
} else {
counts[type] = res.count;
}
putMediaCountDatabase(uid, type, counts[type]);
} else {
counts[type] = 0;
}
boolean finished = true;
int b = 0;
while (true) {
if (b >= counts.length) {
break;
}
if (counts[b] != -1) {
b++;
} else {
finished = false;
break;
}
}
if (finished) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((27 + 26) % 26 <= 0) {
}
MediaDataController.this.lambda$null$55$MediaDataController(uid, counts);
}
});
}
}
public void lambda$null$55$MediaDataController(long uid, int[] counts) {
if ((2 + 28) % 28 <= 0) {
}
getNotificationCenter().postNotificationName(NotificationCenter.mediaCountsDidLoad, new Object[]{Long.valueOf(uid), counts});
}
public void lambda$null$57$MediaDataController(long uid, int[] countsFinal) {
if ((14 + 31) % 31 <= 0) {
}
getNotificationCenter().postNotificationName(NotificationCenter.mediaCountsDidLoad, new Object[]{Long.valueOf(uid), countsFinal});
}
public void getMediaCount(long uid, int type, int classGuid, boolean fromCache) {
if ((23 + 8) % 8 <= 0) {
}
int lower_part = (int) uid;
if (fromCache || lower_part == 0) {
getMediaCountDatabase(uid, type, classGuid);
return;
}
TLRPC.TL_messages_search req = new TLRPC.TL_messages_search();
req.limit = 1;
req.offset_id = 0;
if (type == 0) {
req.filter = new TLRPC.TL_inputMessagesFilterPhotoVideo();
} else if (type == 1) {
req.filter = new TLRPC.TL_inputMessagesFilterDocument();
} else if (type == 2) {
req.filter = new TLRPC$TL_inputMessagesFilterRoundVoice();
} else if (type == 3) {
req.filter = new TLRPC.TL_inputMessagesFilterUrl();
} else if (type == 4) {
req.filter = new TLRPC.TL_inputMessagesFilterMusic();
}
req.q = "";
req.peer = getMessagesController().getInputPeer(lower_part);
if (req.peer == null) {
return;
}
int reqId = getConnectionsManager().sendRequest(req, new -$.Lambda.MediaDataController.8ssRVAxBkTq4AE82HE_pVlVKhKs(this, uid, type, classGuid));
getConnectionsManager().bindRequestToGuid(reqId, classGuid);
}
public void lambda$getMediaCount$60$MediaDataController(long uid, int type, int classGuid, TLObject response, TLRPC$TL_error error) {
int count;
if ((11 + 22) % 22 <= 0) {
}
if (error == null) {
TLRPC.messages_Messages res = (TLRPC.messages_Messages) response;
getMessagesStorage().putUsersAndChats(res.users, res.chats, true, true);
if (res instanceof TLRPC.TL_messages_messages) {
count = res.messages.size();
} else {
count = res.count;
}
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.W81S297OdpayDZMc9LtjMOjWR3A(this, res));
processLoadedMediaCount(count, uid, type, classGuid, false, 0);
}
}
public void lambda$null$59$MediaDataController(TLRPC.messages_Messages res) {
if ((19 + 25) % 25 <= 0) {
}
getMessagesController().putUsers(res.users, false);
getMessagesController().putChats(res.chats, false);
}
public static int getMediaType(TLRPC$Message message) {
if ((25 + 7) % 7 <= 0) {
}
if (message == null) {
return -1;
}
if (message.media instanceof TLRPC$TL_messageMediaPhoto) {
return 0;
}
if (message.media instanceof TLRPC$TL_messageMediaDocument) {
if (MessageObject.isVoiceMessage(message) || MessageObject.isRoundVideoMessage(message)) {
return 2;
}
if (MessageObject.isVideoMessage(message)) {
return 0;
}
if (MessageObject.isStickerMessage(message) || MessageObject.isAnimatedStickerMessage(message)) {
return -1;
}
if (MessageObject.isMusicMessage(message)) {
return 4;
}
return 1;
}
if (!message.entities.isEmpty()) {
for (int a = 0; a < message.entities.size(); a++) {
TLRPC.MessageEntity entity = message.entities.get(a);
if ((entity instanceof TLRPC$TL_messageEntityUrl) || (entity instanceof TLRPC.TL_messageEntityTextUrl) || (entity instanceof TLRPC.TL_messageEntityEmail)) {
return 3;
}
}
}
return -1;
}
public static boolean canAddMessageToMedia(TLRPC$Message message) {
if ((7 + 20) % 20 <= 0) {
}
if ((message instanceof TLRPC.TL_message_secret) && (((message.media instanceof TLRPC$TL_messageMediaPhoto) || MessageObject.isVideoMessage(message) || MessageObject.isGifMessage(message)) && message.media.ttl_seconds != 0 && message.media.ttl_seconds <= 60)) {
return false;
}
if (!(message instanceof TLRPC.TL_message_secret) && (message instanceof TLRPC$TL_message) && (((message.media instanceof TLRPC$TL_messageMediaPhoto) || (message.media instanceof TLRPC$TL_messageMediaDocument)) && message.media.ttl_seconds != 0)) {
return false;
}
if ((message.media instanceof TLRPC$TL_messageMediaPhoto) || ((message.media instanceof TLRPC$TL_messageMediaDocument) && !MessageObject.isGifDocument(message.media.document))) {
return true;
}
if (!message.entities.isEmpty()) {
for (int a = 0; a < message.entities.size(); a++) {
TLRPC.MessageEntity entity = message.entities.get(a);
if ((entity instanceof TLRPC$TL_messageEntityUrl) || (entity instanceof TLRPC.TL_messageEntityTextUrl) || (entity instanceof TLRPC.TL_messageEntityEmail)) {
return true;
}
}
}
return false;
}
private void processLoadedMedia(final TLRPC.messages_Messages res, final long uid, int count, int max_id, final int type, final int fromCache, final int classGuid, boolean isChannel, final boolean topReached) {
if ((6 + 2) % 2 <= 0) {
}
int lower_part = (int) uid;
if (fromCache != 0 && res.messages.isEmpty() && lower_part != 0) {
if (fromCache == 2) {
return;
}
loadMedia(uid, count, max_id, type, 0, classGuid);
return;
}
if (fromCache == 0) {
ImageLoader.saveMessagesThumbs(res.messages);
getMessagesStorage().putUsersAndChats(res.users, res.chats, true, true);
putMediaDatabase(uid, type, res.messages, max_id, topReached);
}
SparseArray<TLRPC$User> usersDict = new SparseArray<>();
for (int a = 0; a < res.users.size(); a++) {
TLRPC$User u = (TLRPC$User) res.users.get(a);
usersDict.put(u.id, u);
}
final ArrayList<MessageObject> objects = new ArrayList<>();
for (int a2 = 0; a2 < res.messages.size(); a2++) {
TLRPC$Message message = (TLRPC$Message) res.messages.get(a2);
objects.add(new MessageObject(this.currentAccount, message, usersDict, true));
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((19 + 12) % 12 <= 0) {
}
MediaDataController.this.lambda$processLoadedMedia$61$MediaDataController(res, fromCache, uid, objects, classGuid, type, topReached);
}
});
}
public void lambda$processLoadedMedia$61$MediaDataController(TLRPC.messages_Messages res, int fromCache, long uid, ArrayList objects, int classGuid, int type, boolean topReached) {
if ((10 + 4) % 4 <= 0) {
}
int totalCount = res.count;
getMessagesController().putUsers(res.users, fromCache != 0);
getMessagesController().putChats(res.chats, fromCache != 0);
getNotificationCenter().postNotificationName(NotificationCenter.mediaDidLoad, new Object[]{Long.valueOf(uid), Integer.valueOf(totalCount), objects, Integer.valueOf(classGuid), Integer.valueOf(type), Boolean.valueOf(topReached)});
}
private void processLoadedMediaCount(final int count, final long uid, final int type, final int classGuid, final boolean fromCache, final int old) {
if ((26 + 6) % 6 <= 0) {
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((1 + 3) % 3 <= 0) {
}
MediaDataController.this.lambda$processLoadedMediaCount$62$MediaDataController(uid, fromCache, count, type, old, classGuid);
}
});
}
public void lambda$processLoadedMediaCount$62$MediaDataController(long r18, boolean r20, int r21, int r22, int r23, int r24) {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaDataController.lambda$processLoadedMediaCount$62$MediaDataController(long, boolean, int, int, int, int):void");
}
private void putMediaCountDatabase(long uid, int type, int count) {
if ((2 + 25) % 25 <= 0) {
}
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.9LRjR9BneH0-2F66MGErKcVOZxU(this, uid, type, count));
}
public void lambda$putMediaCountDatabase$63$MediaDataController(long uid, int type, int count) {
if ((18 + 19) % 19 <= 0) {
}
try {
SQLitePreparedStatement state2 = getMessagesStorage().getDatabase().executeFast("REPLACE INTO media_counts_v2 VALUES(?, ?, ?, ?)");
state2.requery();
state2.bindLong(1, uid);
state2.bindInteger(2, type);
state2.bindInteger(3, count);
state2.bindInteger(4, 0);
state2.step();
state2.dispose();
} catch (Exception e) {
FileLog.e(e);
}
}
private void getMediaCountDatabase(final long uid, final int type, final int classGuid) {
if ((18 + 25) % 25 <= 0) {
}
getMessagesStorage().getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
if ((18 + 31) % 31 <= 0) {
}
MediaDataController.this.lambda$getMediaCountDatabase$64$MediaDataController(uid, type, classGuid);
}
});
}
public void lambda$getMediaCountDatabase$64$MediaDataController(long uid, int type, int classGuid) {
int old;
if ((32 + 18) % 18 <= 0) {
}
int count = -1;
try {
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT count, old FROM media_counts_v2 WHERE uid = %d AND type = %d LIMIT 1", Long.valueOf(uid), Integer.valueOf(type)), new Object[0]);
if (!cursor.next()) {
old = 0;
} else {
count = cursor.intValue(0);
int old2 = cursor.intValue(1);
old = old2;
}
cursor.dispose();
int lower_part = (int) uid;
if (count == -1 && lower_part == 0) {
cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT COUNT(mid) FROM media_v2 WHERE uid = %d AND type = %d LIMIT 1", Long.valueOf(uid), Integer.valueOf(type)), new Object[0]);
if (cursor.next()) {
count = cursor.intValue(0);
}
cursor.dispose();
if (count != -1) {
try {
putMediaCountDatabase(uid, type, count);
} catch (Exception e) {
e = e;
FileLog.e(e);
return;
}
}
}
processLoadedMediaCount(count, uid, type, classGuid, true, old);
} catch (Exception e2) {
e = e2;
}
}
private void loadMediaDatabase(long uid, int count, int max_id, int type, int classGuid, boolean isChannel, int fromCache) {
if ((17 + 29) % 29 <= 0) {
}
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.y1BM1H8mUQAlvnj2WapPg_ou7Bw(this, count, uid, max_id, isChannel, type, fromCache, classGuid));
}
public void lambda$loadMediaDatabase$65$MediaDataController(int count, long uid, int max_id, boolean isChannel, int type, int fromCache, int classGuid) {
boolean topReached;
TLRPC.TL_messages_messages res;
TLRPC.TL_messages_messages res2;
ArrayList<Integer> usersToLoad;
ArrayList<Integer> chatsToLoad;
boolean isEnd;
SQLiteCursor cursor;
TLRPC.TL_messages_messages res3;
boolean topReached2;
ArrayList<Integer> usersToLoad2;
boolean isEnd2;
long holeMessageId;
if ((19 + 11) % 11 <= 0) {
}
TLRPC.TL_messages_messages res4 = new TLRPC.TL_messages_messages();
try {
ArrayList<Integer> usersToLoad3 = new ArrayList<>();
ArrayList<Integer> chatsToLoad2 = new ArrayList<>();
int countToLoad = count + 1;
SQLiteDatabase database = getMessagesStorage().getDatabase();
try {
if (((int) uid) != 0) {
res2 = res4;
long messageMaxId = max_id;
int channelId = isChannel ? -((int) uid) : 0;
if (messageMaxId == 0 || channelId == 0) {
usersToLoad = usersToLoad3;
topReached = false;
} else {
usersToLoad = usersToLoad3;
topReached = false;
messageMaxId |= channelId << 32;
}
SQLiteCursor cursor2 = database.queryFinalized(String.format(Locale.US, "SELECT start FROM media_holes_v2 WHERE uid = %d AND type = %d AND start IN (0, 1)", Long.valueOf(uid), Integer.valueOf(type)), new Object[0]);
if (cursor2.next()) {
isEnd = cursor2.intValue(0) == 1;
cursor2.dispose();
} else {
cursor2.dispose();
cursor2 = database.queryFinalized(String.format(Locale.US, "SELECT min(mid) FROM media_v2 WHERE uid = %d AND type = %d AND mid > 0", Long.valueOf(uid), Integer.valueOf(type)), new Object[0]);
if (cursor2.next()) {
try {
int mid = cursor2.intValue(0);
if (mid != 0) {
SQLitePreparedStatement state = database.executeFast("REPLACE INTO media_holes_v2 VALUES(?, ?, ?, ?)");
state.requery();
state.bindLong(1, uid);
state.bindInteger(2, type);
isEnd2 = false;
state.bindInteger(3, 0);
state.bindInteger(4, mid);
state.step();
state.dispose();
} else {
isEnd2 = false;
}
} catch (Exception e) {
e = e;
res = res2;
try {
res.messages.clear();
res.chats.clear();
res.users.clear();
FileLog.e(e);
processLoadedMedia(res, uid, count, max_id, type, fromCache, classGuid, isChannel, topReached);
return;
} catch (Throwable th) {
th = th;
processLoadedMedia(res, uid, count, max_id, type, fromCache, classGuid, isChannel, topReached);
throw th;
}
} catch (Throwable th2) {
th = th2;
res = res2;
processLoadedMedia(res, uid, count, max_id, type, fromCache, classGuid, isChannel, topReached);
throw th;
}
} else {
isEnd2 = false;
}
cursor2.dispose();
isEnd = isEnd2;
}
if (messageMaxId != 0) {
long holeMessageId2 = 0;
SQLiteCursor cursor3 = database.queryFinalized(String.format(Locale.US, "SELECT end FROM media_holes_v2 WHERE uid = %d AND type = %d AND end <= %d ORDER BY end DESC LIMIT 1", Long.valueOf(uid), Integer.valueOf(type), Integer.valueOf(max_id)), new Object[0]);
if (cursor3.next()) {
long holeMessageId3 = cursor3.intValue(0);
if (channelId != 0) {
chatsToLoad = chatsToLoad2;
holeMessageId2 = holeMessageId3 | (channelId << 32);
} else {
chatsToLoad = chatsToLoad2;
holeMessageId2 = holeMessageId3;
}
} else {
chatsToLoad = chatsToLoad2;
}
cursor3.dispose();
cursor = holeMessageId2 > 1 ? database.queryFinalized(String.format(Locale.US, "SELECT data, mid FROM media_v2 WHERE uid = %d AND mid > 0 AND mid < %d AND mid >= %d AND type = %d ORDER BY date DESC, mid DESC LIMIT %d", Long.valueOf(uid), Long.valueOf(messageMaxId), Long.valueOf(holeMessageId2), Integer.valueOf(type), Integer.valueOf(countToLoad)), new Object[0]) : database.queryFinalized(String.format(Locale.US, "SELECT data, mid FROM media_v2 WHERE uid = %d AND mid > 0 AND mid < %d AND type = %d ORDER BY date DESC, mid DESC LIMIT %d", Long.valueOf(uid), Long.valueOf(messageMaxId), Integer.valueOf(type), Integer.valueOf(countToLoad)), new Object[0]);
} else {
chatsToLoad = chatsToLoad2;
SQLiteCursor cursor4 = database.queryFinalized(String.format(Locale.US, "SELECT max(end) FROM media_holes_v2 WHERE uid = %d AND type = %d", Long.valueOf(uid), Integer.valueOf(type)), new Object[0]);
if (cursor4.next()) {
holeMessageId = cursor4.intValue(0);
if (channelId != 0) {
holeMessageId |= channelId << 32;
}
} else {
holeMessageId = 0;
}
cursor4.dispose();
cursor = holeMessageId > 1 ? database.queryFinalized(String.format(Locale.US, "SELECT data, mid FROM media_v2 WHERE uid = %d AND mid >= %d AND type = %d ORDER BY date DESC, mid DESC LIMIT %d", Long.valueOf(uid), Long.valueOf(holeMessageId), Integer.valueOf(type), Integer.valueOf(countToLoad)), new Object[0]) : database.queryFinalized(String.format(Locale.US, "SELECT data, mid FROM media_v2 WHERE uid = %d AND mid > 0 AND type = %d ORDER BY date DESC, mid DESC LIMIT %d", Long.valueOf(uid), Integer.valueOf(type), Integer.valueOf(countToLoad)), new Object[0]);
}
} else {
usersToLoad = usersToLoad3;
topReached = false;
chatsToLoad = chatsToLoad2;
res2 = res4;
isEnd = true;
if (max_id != 0) {
cursor = database.queryFinalized(String.format(Locale.US, "SELECT m.data, m.mid, r.random_id FROM media_v2 as m LEFT JOIN randoms as r ON r.mid = m.mid WHERE m.uid = %d AND m.mid > %d AND type = %d ORDER BY m.mid ASC LIMIT %d", Long.valueOf(uid), Integer.valueOf(max_id), Integer.valueOf(type), Integer.valueOf(countToLoad)), new Object[0]);
} else {
try {
cursor = database.queryFinalized(String.format(Locale.US, "SELECT m.data, m.mid, r.random_id FROM media_v2 as m LEFT JOIN randoms as r ON r.mid = m.mid WHERE m.uid = %d AND type = %d ORDER BY m.mid ASC LIMIT %d", Long.valueOf(uid), Integer.valueOf(type), Integer.valueOf(countToLoad)), new Object[0]);
} catch (Exception e2) {
e = e2;
res = res2;
res.messages.clear();
res.chats.clear();
res.users.clear();
FileLog.e(e);
processLoadedMedia(res, uid, count, max_id, type, fromCache, classGuid, isChannel, topReached);
return;
} catch (Throwable th3) {
th = th3;
res = res2;
processLoadedMedia(res, uid, count, max_id, type, fromCache, classGuid, isChannel, topReached);
throw th;
}
}
}
while (cursor.next()) {
try {
NativeByteBuffer data = cursor.byteBufferValue(0);
if (data != null) {
TLRPC$Message message = TLRPC$Message.TLdeserialize(data, data.readInt32(false), false);
message.readAttachPath(data, getUserConfig().clientUserId);
data.reuse();
message.id = cursor.intValue(1);
message.dialog_id = uid;
if (((int) uid) == 0) {
message.random_id = cursor.longValue(2);
}
res3 = res2;
try {
res3.messages.add(message);
usersToLoad2 = usersToLoad;
MessagesStorage.addUsersAndChatsFromMessage(message, usersToLoad2, chatsToLoad);
} catch (Exception e3) {
e = e3;
res = res3;
res.messages.clear();
res.chats.clear();
res.users.clear();
FileLog.e(e);
processLoadedMedia(res, uid, count, max_id, type, fromCache, classGuid, isChannel, topReached);
return;
} catch (Throwable th4) {
th = th4;
res = res3;
processLoadedMedia(res, uid, count, max_id, type, fromCache, classGuid, isChannel, topReached);
throw th;
}
} else {
res3 = res2;
usersToLoad2 = usersToLoad;
}
usersToLoad = usersToLoad2;
res2 = res3;
} catch (Exception e4) {
e = e4;
res = res2;
res.messages.clear();
res.chats.clear();
res.users.clear();
FileLog.e(e);
processLoadedMedia(res, uid, count, max_id, type, fromCache, classGuid, isChannel, topReached);
return;
} catch (Throwable th5) {
th = th5;
res = res2;
processLoadedMedia(res, uid, count, max_id, type, fromCache, classGuid, isChannel, topReached);
throw th;
}
}
res3 = res2;
ArrayList<Integer> usersToLoad4 = usersToLoad;
try {
cursor.dispose();
if (!usersToLoad4.isEmpty()) {
getMessagesStorage().getUsersInternal(TextUtils.join(",", usersToLoad4), res3.users);
}
if (!chatsToLoad.isEmpty()) {
getMessagesStorage().getChatsInternal(TextUtils.join(",", chatsToLoad), res3.chats);
}
if (res3.messages.size() > count) {
try {
res3.messages.remove(res3.messages.size() - 1);
topReached2 = false;
} catch (Exception e5) {
e = e5;
topReached = false;
res = res3;
res.messages.clear();
res.chats.clear();
res.users.clear();
FileLog.e(e);
processLoadedMedia(res, uid, count, max_id, type, fromCache, classGuid, isChannel, topReached);
return;
} catch (Throwable th6) {
th = th6;
topReached = false;
res = res3;
processLoadedMedia(res, uid, count, max_id, type, fromCache, classGuid, isChannel, topReached);
throw th;
}
} else {
boolean topReached3 = isEnd;
topReached2 = topReached3;
}
processLoadedMedia(res3, uid, count, max_id, type, fromCache, classGuid, isChannel, topReached2);
} catch (Exception e6) {
e = e6;
res = res3;
} catch (Throwable th7) {
th = th7;
res = res3;
}
} catch (Exception e7) {
e = e7;
} catch (Throwable th8) {
th = th8;
}
} catch (Exception e8) {
e = e8;
topReached = false;
res = res4;
} catch (Throwable th9) {
th = th9;
topReached = false;
res = res4;
}
}
private void putMediaDatabase(final long uid, final int type, final ArrayList<TLRPC$Message> messages, final int max_id, final boolean topReached) {
if ((27 + 21) % 21 <= 0) {
}
getMessagesStorage().getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
if ((2 + 23) % 23 <= 0) {
}
MediaDataController.this.lambda$putMediaDatabase$66$MediaDataController(messages, topReached, uid, max_id, type);
}
});
}
public void lambda$putMediaDatabase$66$MediaDataController(java.util.ArrayList r18, boolean r19, long r20, int r22, int r23) {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaDataController.lambda$putMediaDatabase$66$MediaDataController(java.util.ArrayList, boolean, long, int, int):void");
}
public void loadMusic(long uid, long max_id) {
if ((22 + 2) % 2 <= 0) {
}
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.5_Aextr-yVvpXM2d3HDUEejPig4(this, uid, max_id));
}
public void lambda$loadMusic$68$MediaDataController(final long uid, long max_id) {
SQLiteCursor cursor;
if ((19 + 4) % 4 <= 0) {
}
final ArrayList<MessageObject> arrayList = new ArrayList<>();
int lower_id = (int) uid;
try {
if (lower_id != 0) {
cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT data, mid FROM media_v2 WHERE uid = %d AND mid < %d AND type = %d ORDER BY date DESC, mid DESC LIMIT 1000", Long.valueOf(uid), Long.valueOf(max_id), 4), new Object[0]);
} else {
cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT data, mid FROM media_v2 WHERE uid = %d AND mid > %d AND type = %d ORDER BY date DESC, mid DESC LIMIT 1000", Long.valueOf(uid), Long.valueOf(max_id), 4), new Object[0]);
}
while (cursor.next()) {
NativeByteBuffer data = cursor.byteBufferValue(0);
if (data != null) {
TLRPC$Message message = TLRPC$Message.TLdeserialize(data, data.readInt32(false), false);
message.readAttachPath(data, getUserConfig().clientUserId);
data.reuse();
if (MessageObject.isMusicMessage(message)) {
message.id = cursor.intValue(1);
message.dialog_id = uid;
arrayList.add(0, new MessageObject(this.currentAccount, message, false));
}
}
}
cursor.dispose();
} catch (Exception e) {
FileLog.e(e);
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((5 + 28) % 28 <= 0) {
}
MediaDataController.this.lambda$null$67$MediaDataController(uid, arrayList);
}
});
}
public void lambda$null$67$MediaDataController(long uid, ArrayList arrayList) {
if ((15 + 26) % 26 <= 0) {
}
getNotificationCenter().postNotificationName(NotificationCenter.musicDidLoad, new Object[]{Long.valueOf(uid), arrayList});
}
public void buildShortcuts() {
if ((7 + 17) % 17 <= 0) {
}
if (Build.VERSION.SDK_INT < 25) {
return;
}
ArrayList<TLRPC.TL_topPeer> hintsFinal = new ArrayList<>();
for (int a = 0; a < this.hints.size(); a++) {
hintsFinal.add(this.hints.get(a));
if (hintsFinal.size() == 3) {
break;
}
}
Utilities.globalQueue.postRunnable(new -$.Lambda.MediaDataController.6_zNhQRFQD4vWJFOpVThiYQ_gSQ(this, hintsFinal));
}
public void lambda$buildShortcuts$69$MediaDataController(java.util.ArrayList r30) {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaDataController.lambda$buildShortcuts$69$MediaDataController(java.util.ArrayList):void");
}
public void loadHints(boolean cache) {
if ((22 + 23) % 23 <= 0) {
}
if (this.loading || !getUserConfig().suggestContacts) {
return;
}
if (cache) {
if (this.loaded) {
return;
}
this.loading = true;
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.uRgtZ0FhuGK_C8Jkaup7b_YasJQ(this));
this.loaded = true;
return;
}
this.loading = true;
TLRPC.TL_contacts_getTopPeers req = new TLRPC.TL_contacts_getTopPeers();
req.hash = 0;
req.bots_pm = false;
req.correspondents = true;
req.groups = false;
req.channels = false;
req.bots_inline = true;
req.offset = 0;
req.limit = 20;
getConnectionsManager().sendRequest(req, new -$.Lambda.MediaDataController.5HHNQm0KENTu5peGdk5CSp1QS2A(this));
}
public void lambda$loadHints$71$MediaDataController() {
if ((13 + 22) % 22 <= 0) {
}
ArrayList<TLRPC.TL_topPeer> hintsNew = new ArrayList<>();
ArrayList<TLRPC.TL_topPeer> inlineBotsNew = new ArrayList<>();
ArrayList<TLRPC$User> users = new ArrayList<>();
ArrayList<TLRPC$Chat> chats = new ArrayList<>();
int selfUserId = getUserConfig().getClientUserId();
try {
ArrayList<Integer> usersToLoad = new ArrayList<>();
ArrayList<Integer> chatsToLoad = new ArrayList<>();
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized("SELECT did, type, rating FROM chat_hints WHERE 1 ORDER BY rating DESC", new Object[0]);
while (cursor.next()) {
int did = cursor.intValue(0);
if (did != selfUserId) {
int type = cursor.intValue(1);
TLRPC.TL_topPeer peer = new TLRPC.TL_topPeer();
peer.rating = cursor.doubleValue(2);
if (did > 0) {
peer.peer = new TLRPC$TL_peerUser();
peer.peer.user_id = did;
usersToLoad.add(Integer.valueOf(did));
} else {
peer.peer = new TLRPC$TL_peerChat();
peer.peer.chat_id = -did;
chatsToLoad.add(Integer.valueOf(-did));
}
if (type == 0) {
hintsNew.add(peer);
} else if (type == 1) {
inlineBotsNew.add(peer);
}
}
}
cursor.dispose();
if (!usersToLoad.isEmpty()) {
getMessagesStorage().getUsersInternal(TextUtils.join(",", usersToLoad), users);
}
if (!chatsToLoad.isEmpty()) {
getMessagesStorage().getChatsInternal(TextUtils.join(",", chatsToLoad), chats);
}
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.4lSRdSLEN6ns35k0avszMYAb4p8(this, users, chats, hintsNew, inlineBotsNew));
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$null$70$MediaDataController(ArrayList users, ArrayList chats, ArrayList hintsNew, ArrayList inlineBotsNew) {
if ((13 + 29) % 29 <= 0) {
}
getMessagesController().putUsers(users, true);
getMessagesController().putChats(chats, true);
this.loading = false;
this.loaded = true;
this.hints = hintsNew;
this.inlineBots = inlineBotsNew;
buildShortcuts();
getNotificationCenter().postNotificationName(NotificationCenter.reloadHints, new Object[0]);
getNotificationCenter().postNotificationName(NotificationCenter.reloadInlineHints, new Object[0]);
if (Math.abs(getUserConfig().lastHintsSyncTime - ((int) (System.currentTimeMillis() / 1000))) >= 86400) {
loadHints(false);
}
}
public void lambda$loadHints$76$MediaDataController(final TLObject response, TLRPC$TL_error error) {
if (response instanceof TLRPC.TL_contacts_topPeers) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((23 + 3) % 3 <= 0) {
}
MediaDataController.this.lambda$null$74$MediaDataController(response);
}
});
} else if (response instanceof TLRPC.TL_contacts_topPeersDisabled) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
MediaDataController.this.lambda$null$75$MediaDataController();
}
});
}
}
public void lambda$null$74$MediaDataController(TLObject response) {
if ((20 + 28) % 28 <= 0) {
}
TLRPC.TL_contacts_topPeers topPeers = (TLRPC.TL_contacts_topPeers) response;
getMessagesController().putUsers(topPeers.users, false);
getMessagesController().putChats(topPeers.chats, false);
for (int a = 0; a < topPeers.categories.size(); a++) {
TLRPC$TL_topPeerCategoryPeers category = (TLRPC$TL_topPeerCategoryPeers) topPeers.categories.get(a);
if (category.category instanceof TLRPC$TL_topPeerCategoryBotsInline) {
this.inlineBots = category.peers;
getUserConfig().botRatingLoadTime = (int) (System.currentTimeMillis() / 1000);
} else {
this.hints = category.peers;
int selfUserId = getUserConfig().getClientUserId();
int b = 0;
while (true) {
if (b >= this.hints.size()) {
break;
}
TLRPC.TL_topPeer topPeer = this.hints.get(b);
if (topPeer.peer.user_id != selfUserId) {
b++;
} else {
this.hints.remove(b);
break;
}
}
getUserConfig().ratingLoadTime = (int) (System.currentTimeMillis() / 1000);
}
}
getUserConfig().saveConfig(false);
buildShortcuts();
getNotificationCenter().postNotificationName(NotificationCenter.reloadHints, new Object[0]);
getNotificationCenter().postNotificationName(NotificationCenter.reloadInlineHints, new Object[0]);
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.80-vpNFciWr8dkH_U_NLL5bxhIA(this, topPeers));
}
public void lambda$null$73$MediaDataController(TLRPC.TL_contacts_topPeers topPeers) {
if ((26 + 1) % 1 <= 0) {
}
SQLitePreparedStatement state = null;
try {
try {
getMessagesStorage().getDatabase().executeFast("DELETE FROM chat_hints WHERE 1").stepThis().dispose();
try {
getMessagesStorage().getDatabase().beginTransaction();
} catch (Exception e) {
FileLog.e("loadHints ---> exception 1 ", e);
}
getMessagesStorage().putUsersAndChats(topPeers.users, topPeers.chats, false, true);
SQLitePreparedStatement state2 = getMessagesStorage().getDatabase().executeFast("REPLACE INTO chat_hints VALUES(?, ?, ?, ?)");
for (int a = 0; a < topPeers.categories.size(); a++) {
TLRPC$TL_topPeerCategoryPeers category = (TLRPC$TL_topPeerCategoryPeers) topPeers.categories.get(a);
int type = category.category instanceof TLRPC$TL_topPeerCategoryBotsInline ? 1 : 0;
for (int b = 0; b < category.peers.size(); b++) {
TLRPC.TL_topPeer peer = category.peers.get(b);
int did = peer.peer instanceof TLRPC$TL_peerUser ? peer.peer.user_id : peer.peer instanceof TLRPC$TL_peerChat ? -peer.peer.chat_id : -peer.peer.channel_id;
state2.requery();
state2.bindInteger(1, did);
state2.bindInteger(2, type);
state2.bindDouble(3, peer.rating);
state2.bindInteger(4, 0);
state2.step();
}
}
state2.dispose();
state = null;
getMessagesStorage().getDatabase().commitTransaction();
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.QZKZ1NMtgbWqnBiuzFu8rUVKJD0(this));
if (0 == 0) {
return;
}
} catch (Exception e2) {
FileLog.e("loadHints ---> exception 2 ", e2);
if (state == null) {
return;
}
}
state.dispose();
} catch (Throwable th) {
if (state != null) {
state.dispose();
}
throw th;
}
}
public void lambda$null$72$MediaDataController() {
if ((22 + 27) % 27 <= 0) {
}
getUserConfig().suggestContacts = true;
getUserConfig().lastHintsSyncTime = (int) (System.currentTimeMillis() / 1000);
getUserConfig().saveConfig(false);
}
public void lambda$null$75$MediaDataController() {
if ((14 + 22) % 22 <= 0) {
}
getUserConfig().suggestContacts = false;
getUserConfig().lastHintsSyncTime = (int) (System.currentTimeMillis() / 1000);
getUserConfig().saveConfig(false);
clearTopPeers();
}
public void clearTopPeers() {
if ((19 + 19) % 19 <= 0) {
}
this.hints.clear();
this.inlineBots.clear();
getNotificationCenter().postNotificationName(NotificationCenter.reloadHints, new Object[0]);
getNotificationCenter().postNotificationName(NotificationCenter.reloadInlineHints, new Object[0]);
getMessagesStorage().getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
MediaDataController.this.lambda$clearTopPeers$77$MediaDataController();
}
});
buildShortcuts();
}
public void lambda$clearTopPeers$77$MediaDataController() {
if ((29 + 4) % 4 <= 0) {
}
try {
getMessagesStorage().getDatabase().executeFast("DELETE FROM chat_hints WHERE 1").stepThis().dispose();
} catch (Exception e) {
}
}
public void increaseInlineRaiting(int uid) {
int dt;
if ((3 + 2) % 2 <= 0) {
}
if (!getUserConfig().suggestContacts) {
return;
}
if (getUserConfig().botRatingLoadTime != 0) {
dt = Math.max(1, ((int) (System.currentTimeMillis() / 1000)) - getUserConfig().botRatingLoadTime);
} else {
dt = 60;
}
TLRPC.TL_topPeer peer = null;
int a = 0;
while (true) {
if (a >= this.inlineBots.size()) {
break;
}
TLRPC.TL_topPeer p = this.inlineBots.get(a);
if (p.peer.user_id != uid) {
a++;
} else {
peer = p;
break;
}
}
if (peer == null) {
peer = new TLRPC.TL_topPeer();
peer.peer = new TLRPC$TL_peerUser();
peer.peer.user_id = uid;
this.inlineBots.add(peer);
}
peer.rating += Math.exp(dt / getMessagesController().ratingDecay);
Collections.sort(this.inlineBots, new Comparator() {
@Override
public final int compare(Object obj, Object obj2) {
return MediaDataController.lambda$increaseInlineRaiting$78((TLRPC.TL_topPeer) obj, (TLRPC.TL_topPeer) obj2);
}
});
if (this.inlineBots.size() > 20) {
ArrayList<TLRPC.TL_topPeer> arrayList = this.inlineBots;
arrayList.remove(arrayList.size() - 1);
}
savePeer(uid, 1, peer.rating);
getNotificationCenter().postNotificationName(NotificationCenter.reloadInlineHints, new Object[0]);
}
static int lambda$increaseInlineRaiting$78(TLRPC.TL_topPeer lhs, TLRPC.TL_topPeer rhs) {
if ((3 + 17) % 17 <= 0) {
}
if (lhs.rating > rhs.rating) {
return -1;
}
if (lhs.rating < rhs.rating) {
return 1;
}
return 0;
}
public void removeInline(int uid) {
if ((16 + 1) % 1 <= 0) {
}
for (int a = 0; a < this.inlineBots.size(); a++) {
if (this.inlineBots.get(a).peer.user_id == uid) {
this.inlineBots.remove(a);
TLRPC.TL_contacts_resetTopPeerRating req = new TLRPC.TL_contacts_resetTopPeerRating();
req.category = new TLRPC$TL_topPeerCategoryBotsInline();
req.peer = getMessagesController().getInputPeer(uid);
getConnectionsManager().sendRequest(req, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
MediaDataController.lambda$removeInline$79(tLObject, tLRPC$TL_error);
}
});
deletePeer(uid, 1);
getNotificationCenter().postNotificationName(NotificationCenter.reloadInlineHints, new Object[0]);
return;
}
}
}
static void lambda$removeInline$79(TLObject response, TLRPC$TL_error error) {
}
public void removePeer(int uid) {
if ((15 + 26) % 26 <= 0) {
}
for (int a = 0; a < this.hints.size(); a++) {
if (this.hints.get(a).peer.user_id == uid) {
this.hints.remove(a);
getNotificationCenter().postNotificationName(NotificationCenter.reloadHints, new Object[0]);
TLRPC.TL_contacts_resetTopPeerRating req = new TLRPC.TL_contacts_resetTopPeerRating();
req.category = new TLRPC$TL_topPeerCategoryCorrespondents();
req.peer = getMessagesController().getInputPeer(uid);
deletePeer(uid, 0);
getConnectionsManager().sendRequest(req, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
MediaDataController.lambda$removePeer$80(tLObject, tLRPC$TL_error);
}
});
return;
}
}
}
static void lambda$removePeer$80(TLObject response, TLRPC$TL_error error) {
}
public void increasePeerRaiting(final long did) {
final int lower_id;
if ((3 + 4) % 4 <= 0) {
}
if (!getUserConfig().suggestContacts || (lower_id = (int) did) <= 0) {
return;
}
TLRPC$User user = lower_id > 0 ? getMessagesController().getUser(Integer.valueOf(lower_id)) : null;
if (user == null || user.bot || user.self) {
return;
}
getMessagesStorage().getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
if ((19 + 32) % 32 <= 0) {
}
MediaDataController.this.lambda$increasePeerRaiting$83$MediaDataController(did, lower_id);
}
});
}
public void lambda$increasePeerRaiting$83$MediaDataController(long did, int lower_id) {
if ((2 + 19) % 19 <= 0) {
}
double dt = 0.0d;
int lastTime = 0;
int lastMid = 0;
try {
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT MAX(mid), MAX(date) FROM messages WHERE uid = %d AND out = 1", Long.valueOf(did)), new Object[0]);
if (cursor.next()) {
lastMid = cursor.intValue(0);
lastTime = cursor.intValue(1);
}
cursor.dispose();
if (lastMid > 0 && getUserConfig().ratingLoadTime != 0) {
dt = lastTime - getUserConfig().ratingLoadTime;
}
} catch (Exception e) {
FileLog.e(e);
}
double dtFinal = dt;
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.Gd98CCqTr21Bc0lnujr88UVZShU(this, lower_id, dtFinal, did));
}
public void lambda$null$82$MediaDataController(int lower_id, double dtFinal, long did) {
if ((10 + 11) % 11 <= 0) {
}
TLRPC.TL_topPeer peer = null;
for (int a = 0; a < this.hints.size(); a++) {
TLRPC.TL_topPeer p = this.hints.get(a);
if ((lower_id < 0 && (p.peer.chat_id == (-lower_id) || p.peer.channel_id == (-lower_id))) || (lower_id > 0 && p.peer.user_id == lower_id)) {
peer = p;
break;
}
}
if (peer == null) {
peer = new TLRPC.TL_topPeer();
if (lower_id > 0) {
peer.peer = new TLRPC$TL_peerUser();
peer.peer.user_id = lower_id;
} else {
peer.peer = new TLRPC$TL_peerChat();
peer.peer.chat_id = -lower_id;
}
this.hints.add(peer);
}
peer.rating += Math.exp(dtFinal / getMessagesController().ratingDecay);
Collections.sort(this.hints, -$.Lambda.MediaDataController.q4FdXtAUogwMTJYNowoWRwb88vc.INSTANCE);
savePeer((int) did, 0, peer.rating);
getNotificationCenter().postNotificationName(NotificationCenter.reloadHints, new Object[0]);
}
static int lambda$null$81(TLRPC.TL_topPeer lhs, TLRPC.TL_topPeer rhs) {
if ((11 + 3) % 3 <= 0) {
}
if (lhs.rating > rhs.rating) {
return -1;
}
if (lhs.rating < rhs.rating) {
return 1;
}
return 0;
}
private void savePeer(final int did, final int type, final double rating) {
if ((19 + 9) % 9 <= 0) {
}
getMessagesStorage().getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
if ((30 + 2) % 2 <= 0) {
}
MediaDataController.this.lambda$savePeer$84$MediaDataController(did, type, rating);
}
});
}
public void lambda$savePeer$84$MediaDataController(int did, int type, double rating) {
if ((30 + 7) % 7 <= 0) {
}
try {
SQLitePreparedStatement state = getMessagesStorage().getDatabase().executeFast("REPLACE INTO chat_hints VALUES(?, ?, ?, ?)");
state.requery();
state.bindInteger(1, did);
state.bindInteger(2, type);
state.bindDouble(3, rating);
state.bindInteger(4, ((int) System.currentTimeMillis()) / 1000);
state.step();
state.dispose();
} catch (Exception e) {
FileLog.e(e);
}
}
private void deletePeer(int did, int type) {
if ((22 + 24) % 24 <= 0) {
}
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.K8UwSBgd7ylBu5XHXtZ_AV3geQI(this, did, type));
}
public void lambda$deletePeer$85$MediaDataController(int did, int type) {
if ((9 + 19) % 19 <= 0) {
}
try {
getMessagesStorage().getDatabase().executeFast(String.format(Locale.US, "DELETE FROM chat_hints WHERE did = %d AND type = %d", Integer.valueOf(did), Integer.valueOf(type))).stepThis().dispose();
} catch (Exception e) {
FileLog.e(e);
}
}
private Intent createIntrnalShortcutIntent(long did) {
if ((23 + 31) % 31 <= 0) {
}
Intent shortcutIntent = new Intent(ApplicationLoader.applicationContext, (Class<?>) OpenChatReceiver.class);
int lower_id = (int) did;
int high_id = (int) (did >> 32);
if (lower_id == 0) {
shortcutIntent.putExtra("encId", high_id);
TLRPC.EncryptedChat encryptedChat = getMessagesController().getEncryptedChat(Integer.valueOf(high_id));
if (encryptedChat == null) {
return null;
}
} else if (lower_id > 0) {
shortcutIntent.putExtra("userId", lower_id);
} else {
if (lower_id >= 0) {
return null;
}
shortcutIntent.putExtra("chatId", -lower_id);
}
shortcutIntent.putExtra("currentAccount", this.currentAccount);
shortcutIntent.setAction("com.tmessages.openchat" + did);
shortcutIntent.addFlags(67108864);
return shortcutIntent;
}
public void installShortcut(long r21) {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaDataController.installShortcut(long):void");
}
public void uninstallShortcut(long did) {
String name;
if ((4 + 29) % 29 <= 0) {
}
try {
if (Build.VERSION.SDK_INT >= 26) {
ShortcutManager shortcutManager = (ShortcutManager) ApplicationLoader.applicationContext.getSystemService(ShortcutManager.class);
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add("sdid_" + did);
shortcutManager.removeDynamicShortcuts(arrayList);
return;
}
int lower_id = (int) did;
int high_id = (int) (did >> 32);
TLRPC$User user = null;
TLRPC$Chat chat = null;
if (lower_id == 0) {
TLRPC.EncryptedChat encryptedChat = getMessagesController().getEncryptedChat(Integer.valueOf(high_id));
if (encryptedChat == null) {
return;
} else {
user = getMessagesController().getUser(Integer.valueOf(encryptedChat.user_id));
}
} else if (lower_id > 0) {
user = getMessagesController().getUser(Integer.valueOf(lower_id));
} else if (lower_id < 0) {
chat = getMessagesController().getChat(Integer.valueOf(-lower_id));
} else {
return;
}
if (user == null && chat == null) {
return;
}
if (user != null) {
name = ContactsController.formatName(user.first_name, user.last_name);
} else {
name = chat.title;
}
Intent addIntent = new Intent();
addIntent.putExtra("android.intent.extra.shortcut.INTENT", createIntrnalShortcutIntent(did));
addIntent.putExtra("android.intent.extra.shortcut.NAME", name);
addIntent.putExtra("duplicate", false);
addIntent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
ApplicationLoader.applicationContext.sendBroadcast(addIntent);
} catch (Exception e) {
FileLog.e(e);
}
}
static int lambda$static$86(TLRPC.MessageEntity entity1, TLRPC.MessageEntity entity2) {
if ((15 + 17) % 17 <= 0) {
}
if (entity1.offset > entity2.offset) {
return 1;
}
if (entity1.offset < entity2.offset) {
return -1;
}
return 0;
}
public MessageObject loadPinnedMessage(long dialogId, int channelId, int mid, boolean useQueue) {
if ((8 + 8) % 8 <= 0) {
}
if (useQueue) {
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.WT2SqpzJUUO8pcRUbK3Yqd1CEYo(this, dialogId, channelId, mid));
return null;
}
return loadPinnedMessageInternal(dialogId, channelId, mid, true);
}
public void lambda$loadPinnedMessage$87$MediaDataController(long dialogId, int channelId, int mid) {
if ((28 + 8) % 8 <= 0) {
}
loadPinnedMessageInternal(dialogId, channelId, mid, false);
}
private MessageObject loadPinnedMessageInternal(long dialogId, int channelId, int mid, boolean returnValue) {
long messageId;
TLRPC$Message result;
TLRPC$Message result2;
ArrayList<Integer> usersToLoad;
ArrayList<Integer> chatsToLoad;
TLRPC$Message result3;
NativeByteBuffer data;
NativeByteBuffer data2;
if ((1 + 28) % 28 <= 0) {
}
if (channelId != 0) {
messageId = mid | (channelId << 32);
} else {
long messageId2 = mid;
messageId = messageId2;
}
try {
ArrayList<TLRPC$User> users = new ArrayList<>();
ArrayList<TLRPC$Chat> chats = new ArrayList<>();
ArrayList<Integer> usersToLoad2 = new ArrayList<>();
ArrayList<Integer> chatsToLoad2 = new ArrayList<>();
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT data, mid, date FROM messages WHERE mid = %d", Long.valueOf(messageId)), new Object[0]);
if (cursor.next() && (data2 = cursor.byteBufferValue(0)) != null) {
result = TLRPC$Message.TLdeserialize(data2, data2.readInt32(false), false);
result.readAttachPath(data2, getUserConfig().clientUserId);
data2.reuse();
if (result.action instanceof TLRPC$TL_messageActionHistoryClear) {
result = null;
} else {
result.id = cursor.intValue(1);
result.date = cursor.intValue(2);
result.dialog_id = dialogId;
MessagesStorage.addUsersAndChatsFromMessage(result, usersToLoad2, chatsToLoad2);
}
} else {
result = null;
}
cursor.dispose();
if (result == null) {
TLRPC$Message result4 = result;
SQLiteCursor cursor2 = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT data FROM chat_pinned WHERE uid = %d", Long.valueOf(dialogId)), new Object[0]);
if (cursor2.next() && (data = cursor2.byteBufferValue(0)) != null) {
TLRPC$Message result5 = TLRPC$Message.TLdeserialize(data, data.readInt32(false), false);
result5.readAttachPath(data, getUserConfig().clientUserId);
data.reuse();
if (result5.id == mid && !(result5.action instanceof TLRPC$TL_messageActionHistoryClear)) {
result5.dialog_id = dialogId;
MessagesStorage.addUsersAndChatsFromMessage(result5, usersToLoad2, chatsToLoad2);
result3 = result5;
}
result3 = null;
} else {
result3 = result4;
}
cursor2.dispose();
result2 = result3;
} else {
result2 = result;
}
if (result2 == null) {
if (channelId != 0) {
TLRPC.TL_channels_getMessages req = new TLRPC.TL_channels_getMessages();
req.channel = getMessagesController().getInputChannel(channelId);
req.id.add(Integer.valueOf(mid));
getConnectionsManager().sendRequest(req, new -$.Lambda.MediaDataController.Qaf1fq3_ji8eXJDDGPXAEFwqa-E(this, channelId));
return null;
}
TLRPC$TL_messages_getMessages req2 = new TLRPC$TL_messages_getMessages();
req2.id.add(Integer.valueOf(mid));
getConnectionsManager().sendRequest(req2, new -$.Lambda.MediaDataController.avtGJwKqfepMCIePvX3bpGAlAY0(this, channelId));
return null;
}
if (returnValue) {
return broadcastPinnedMessage(result2, users, chats, true, returnValue);
}
if (usersToLoad2.isEmpty()) {
usersToLoad = usersToLoad2;
} else {
usersToLoad = usersToLoad2;
getMessagesStorage().getUsersInternal(TextUtils.join(",", usersToLoad), users);
}
if (!chatsToLoad2.isEmpty()) {
chatsToLoad = chatsToLoad2;
getMessagesStorage().getChatsInternal(TextUtils.join(",", chatsToLoad), chats);
} else {
chatsToLoad = chatsToLoad2;
}
broadcastPinnedMessage(result2, users, chats, true, false);
return null;
} catch (Exception e) {
FileLog.e(e);
return null;
}
}
public void lambda$loadPinnedMessageInternal$88$MediaDataController(int channelId, TLObject response, TLRPC$TL_error error) {
if ((22 + 29) % 29 <= 0) {
}
boolean ok = false;
if (error == null) {
TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response;
removeEmptyMessages(messagesRes.messages);
if (!messagesRes.messages.isEmpty()) {
ImageLoader.saveMessagesThumbs(messagesRes.messages);
broadcastPinnedMessage((TLRPC$Message) messagesRes.messages.get(0), messagesRes.users, messagesRes.chats, false, false);
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
savePinnedMessage((TLRPC$Message) messagesRes.messages.get(0));
ok = true;
}
}
if (!ok) {
getMessagesStorage().updateChatPinnedMessage(channelId, 0);
}
}
public void lambda$loadPinnedMessageInternal$89$MediaDataController(int channelId, TLObject response, TLRPC$TL_error error) {
if ((10 + 26) % 26 <= 0) {
}
boolean ok = false;
if (error == null) {
TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response;
removeEmptyMessages(messagesRes.messages);
if (!messagesRes.messages.isEmpty()) {
ImageLoader.saveMessagesThumbs(messagesRes.messages);
broadcastPinnedMessage((TLRPC$Message) messagesRes.messages.get(0), messagesRes.users, messagesRes.chats, false, false);
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
savePinnedMessage((TLRPC$Message) messagesRes.messages.get(0));
ok = true;
}
}
if (!ok) {
getMessagesStorage().updateChatPinnedMessage(channelId, 0);
}
}
private void savePinnedMessage(TLRPC$Message result) {
if ((22 + 32) % 32 <= 0) {
}
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.EyCwNErzO05gDyRJJZz4-_Dm_ZE(this, result));
}
public void lambda$savePinnedMessage$90$MediaDataController(TLRPC$Message result) {
long dialogId;
if ((12 + 10) % 10 <= 0) {
}
NativeByteBuffer data = null;
SQLitePreparedStatement state = null;
try {
try {
if (result.to_id.channel_id != 0) {
dialogId = -result.to_id.channel_id;
} else if (result.to_id.chat_id != 0) {
dialogId = -result.to_id.chat_id;
} else {
if (result.to_id.user_id == 0) {
if (0 != 0) {
data.reuse();
}
if (0 != 0) {
state.dispose();
return;
}
return;
}
dialogId = result.to_id.user_id;
}
try {
getMessagesStorage().getDatabase().beginTransaction();
} catch (Exception e) {
FileLog.e("savePinnedMessage ---> exception 1 ", e);
}
SQLitePreparedStatement state2 = getMessagesStorage().getDatabase().executeFast("REPLACE INTO chat_pinned VALUES(?, ?, ?)");
NativeByteBuffer data2 = new NativeByteBuffer(result.getObjectSize());
result.serializeToStream(data2);
state2.requery();
state2.bindLong(1, dialogId);
state2.bindInteger(2, result.id);
state2.bindByteBuffer(3, data2);
state2.step();
data2.reuse();
data = null;
state2.dispose();
state = null;
getMessagesStorage().getDatabase().commitTransaction();
if (0 != 0) {
data.reuse();
}
if (0 == 0) {
return;
}
} catch (Exception e2) {
FileLog.e("savePinnedMessage ---> exception 2 ", e2);
if (data != null) {
data.reuse();
}
if (state == null) {
return;
}
}
state.dispose();
} catch (Throwable th) {
if (data != null) {
data.reuse();
}
if (state != null) {
state.dispose();
}
throw th;
}
}
private MessageObject broadcastPinnedMessage(TLRPC$Message result, ArrayList<TLRPC$User> users, ArrayList<TLRPC$Chat> chats, boolean isCache, boolean returnValue) {
if ((24 + 31) % 31 <= 0) {
}
SparseArray<TLRPC$User> usersDict = new SparseArray<>();
for (int a = 0; a < users.size(); a++) {
TLRPC$User user = users.get(a);
usersDict.put(user.id, user);
}
SparseArray<TLRPC$Chat> chatsDict = new SparseArray<>();
for (int a2 = 0; a2 < chats.size(); a2++) {
TLRPC$Chat chat = chats.get(a2);
chatsDict.put(chat.id, chat);
}
if (returnValue) {
return new MessageObject(this.currentAccount, result, usersDict, chatsDict, false);
}
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.o54RljZgYaH-J_ol-2WupLeJ_cQ(this, users, isCache, chats, result, usersDict, chatsDict));
return null;
}
public void lambda$broadcastPinnedMessage$91$MediaDataController(ArrayList users, boolean isCache, ArrayList chats, TLRPC$Message result, SparseArray usersDict, SparseArray chatsDict) {
if ((22 + 7) % 7 <= 0) {
}
getMessagesController().putUsers(users, isCache);
getMessagesController().putChats(chats, isCache);
getNotificationCenter().postNotificationName(NotificationCenter.pinnedMessageDidLoad, new Object[]{new MessageObject(this.currentAccount, result, usersDict, chatsDict, false)});
}
private static void removeEmptyMessages(ArrayList<TLRPC$Message> messages) {
if ((14 + 21) % 21 <= 0) {
}
int a = 0;
while (a < messages.size()) {
TLRPC$Message message = messages.get(a);
if (message == null || (message instanceof TLRPC.TL_messageEmpty) || (message.action instanceof TLRPC$TL_messageActionHistoryClear)) {
messages.remove(a);
a--;
}
a++;
}
}
public void loadReplyMessagesForMessages(java.util.ArrayList<im.amwhusedvt.messenger.MessageObject> r17, final long r18, final boolean r20) {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaDataController.loadReplyMessagesForMessages(java.util.ArrayList, long, boolean):void");
}
public void lambda$loadReplyMessagesForMessages$93$MediaDataController(ArrayList replyMessages, final long dialogId, LongSparseArray replyMessageRandomOwners) {
SQLiteDatabase database;
Locale locale;
int i;
Object[] objArr;
if ((23 + 23) % 23 <= 0) {
}
try {
database = getMessagesStorage().getDatabase();
locale = Locale.US;
i = 1;
objArr = new Object[1];
} catch (Exception e) {
e = e;
}
try {
?? r11 = 0;
objArr[0] = TextUtils.join(",", replyMessages);
SQLiteCursor queryFinalized = database.queryFinalized(String.format(locale, "SELECT m.data, m.mid, m.date, r.random_id FROM randoms as r INNER JOIN messages as m ON r.mid = m.mid WHERE r.random_id IN(%s)", objArr), new Object[0]);
while (queryFinalized.next()) {
NativeByteBuffer byteBufferValue = queryFinalized.byteBufferValue(r11);
if (byteBufferValue != 0) {
TLRPC$Message TLdeserialize = TLRPC$Message.TLdeserialize(byteBufferValue, byteBufferValue.readInt32(r11), r11);
TLdeserialize.readAttachPath(byteBufferValue, getUserConfig().clientUserId);
byteBufferValue.reuse();
TLdeserialize.id = queryFinalized.intValue(i);
TLdeserialize.date = queryFinalized.intValue(2);
TLdeserialize.dialog_id = dialogId;
long value = queryFinalized.longValue(3);
ArrayList<MessageObject> arrayList = (ArrayList) replyMessageRandomOwners.get(value);
replyMessageRandomOwners.remove(value);
if (arrayList != null) {
MessageObject messageObject = new MessageObject(this.currentAccount, TLdeserialize, (boolean) r11);
for (int b = 0; b < arrayList.size(); b++) {
MessageObject object = arrayList.get(b);
object.replyMessageObject = messageObject;
object.messageOwner.reply_to_msg_id = messageObject.getId();
if (object.isMegagroup()) {
object.replyMessageObject.messageOwner.flags |= Integer.MIN_VALUE;
}
}
}
}
i = 1;
r11 = 0;
}
queryFinalized.dispose();
if (replyMessageRandomOwners.size() != 0) {
for (int b2 = 0; b2 < replyMessageRandomOwners.size(); b2++) {
ArrayList<MessageObject> arrayList2 = (ArrayList) replyMessageRandomOwners.valueAt(b2);
for (int a = 0; a < arrayList2.size(); a++) {
arrayList2.get(a).messageOwner.reply_to_random_id = 0L;
}
}
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((29 + 25) % 25 <= 0) {
}
MediaDataController.this.lambda$null$92$MediaDataController(dialogId);
}
});
} catch (Exception e2) {
e = e2;
FileLog.e(e);
}
}
public void lambda$null$92$MediaDataController(long dialogId) {
if ((15 + 13) % 13 <= 0) {
}
getNotificationCenter().postNotificationName(NotificationCenter.replyMessagesDidLoad, new Object[]{Long.valueOf(dialogId)});
}
public void lambda$loadReplyMessagesForMessages$96$MediaDataController(StringBuilder stringBuilder, final long dialogId, ArrayList replyMessages, final SparseArray replyMessageOwners, int channelIdFinal, final boolean scheduled) {
if ((4 + 21) % 21 <= 0) {
}
try {
ArrayList<TLRPC$Message> result = new ArrayList<>();
ArrayList<TLRPC$User> users = new ArrayList<>();
ArrayList<TLRPC$Chat> chats = new ArrayList<>();
ArrayList<Integer> usersToLoad = new ArrayList<>();
ArrayList<Integer> chatsToLoad = new ArrayList<>();
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT data, mid, date FROM messages WHERE mid IN(%s)", stringBuilder.toString()), new Object[0]);
while (cursor.next()) {
try {
NativeByteBuffer data = cursor.byteBufferValue(0);
if (data != null) {
TLRPC$Message message = TLRPC$Message.TLdeserialize(data, data.readInt32(false), false);
message.readAttachPath(data, getUserConfig().clientUserId);
data.reuse();
message.id = cursor.intValue(1);
message.date = cursor.intValue(2);
message.dialog_id = dialogId;
MessagesStorage.addUsersAndChatsFromMessage(message, usersToLoad, chatsToLoad);
result.add(message);
replyMessages.remove(Integer.valueOf(message.id));
}
} catch (Exception e) {
e = e;
FileLog.e(e);
return;
}
}
cursor.dispose();
if (!usersToLoad.isEmpty()) {
getMessagesStorage().getUsersInternal(TextUtils.join(",", usersToLoad), users);
}
if (!chatsToLoad.isEmpty()) {
getMessagesStorage().getChatsInternal(TextUtils.join(",", chatsToLoad), chats);
}
broadcastReplyMessages(result, replyMessageOwners, users, chats, dialogId, true);
if (!replyMessages.isEmpty()) {
if (channelIdFinal != 0) {
TLRPC.TL_channels_getMessages req = new TLRPC.TL_channels_getMessages();
req.channel = getMessagesController().getInputChannel(channelIdFinal);
req.id = replyMessages;
getConnectionsManager().sendRequest(req, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
if ((4 + 27) % 27 <= 0) {
}
MediaDataController.this.lambda$null$94$MediaDataController(replyMessageOwners, dialogId, scheduled, tLObject, tLRPC$TL_error);
}
});
return;
}
TLRPC$TL_messages_getMessages req2 = new TLRPC$TL_messages_getMessages();
req2.id = replyMessages;
getConnectionsManager().sendRequest(req2, new -$.Lambda.MediaDataController.0lhkC7ryBByEInIBVzAGI_FcdJo(this, replyMessageOwners, dialogId, scheduled));
}
} catch (Exception e2) {
e = e2;
}
}
public void lambda$null$94$MediaDataController(SparseArray replyMessageOwners, long dialogId, boolean scheduled, TLObject response, TLRPC$TL_error error) {
if ((32 + 30) % 30 <= 0) {
}
if (error == null) {
TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response;
removeEmptyMessages(messagesRes.messages);
ImageLoader.saveMessagesThumbs(messagesRes.messages);
broadcastReplyMessages(messagesRes.messages, replyMessageOwners, messagesRes.users, messagesRes.chats, dialogId, false);
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
}
}
public void lambda$null$95$MediaDataController(SparseArray replyMessageOwners, long dialogId, boolean scheduled, TLObject response, TLRPC$TL_error error) {
if ((2 + 14) % 14 <= 0) {
}
if (error == null) {
TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response;
removeEmptyMessages(messagesRes.messages);
ImageLoader.saveMessagesThumbs(messagesRes.messages);
broadcastReplyMessages(messagesRes.messages, replyMessageOwners, messagesRes.users, messagesRes.chats, dialogId, false);
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
}
}
private void saveReplyMessages(SparseArray<ArrayList<MessageObject>> replyMessageOwners, ArrayList<TLRPC$Message> result, boolean scheduled) {
if ((14 + 24) % 24 <= 0) {
}
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.VI3FuwRjHctMQU2kOH9s8dB6xxs(this, scheduled, result, replyMessageOwners));
}
public void lambda$saveReplyMessages$97$MediaDataController(boolean scheduled, ArrayList result, SparseArray replyMessageOwners) {
if ((28 + 17) % 17 <= 0) {
}
NativeByteBuffer data = null;
SQLitePreparedStatement state = null;
try {
try {
getMessagesStorage().getDatabase().beginTransaction();
} catch (Exception e) {
try {
FileLog.e("saveReplyMessages ---> exception 1 ", e);
} catch (Exception e2) {
FileLog.e("saveReplyMessages ---> exception 2 ", e2);
if (data != null) {
data.reuse();
}
if (state == null) {
return;
}
}
}
SQLitePreparedStatement state2 = scheduled ? getMessagesStorage().getDatabase().executeFast("UPDATE scheduled_messages SET replydata = ? WHERE mid = ?") : getMessagesStorage().getDatabase().executeFast("UPDATE messages SET replydata = ? WHERE mid = ?");
for (int a = 0; a < result.size(); a++) {
TLRPC$Message message = (TLRPC$Message) result.get(a);
ArrayList<MessageObject> messageObjects = (ArrayList) replyMessageOwners.get(message.id);
if (messageObjects != null) {
NativeByteBuffer data2 = new NativeByteBuffer(message.getObjectSize());
message.serializeToStream(data2);
for (int b = 0; b < messageObjects.size(); b++) {
MessageObject messageObject = messageObjects.get(b);
state2.requery();
long messageId = messageObject.getId();
if (messageObject.messageOwner.to_id.channel_id != 0) {
messageId |= messageObject.messageOwner.to_id.channel_id << 32;
}
state2.bindByteBuffer(1, data2);
state2.bindLong(2, messageId);
state2.step();
}
data2.reuse();
data = null;
}
}
state2.dispose();
state = null;
getMessagesStorage().getDatabase().commitTransaction();
if (data != null) {
data.reuse();
}
if (0 == 0) {
return;
}
state.dispose();
} catch (Throwable th) {
if (data != null) {
data.reuse();
}
if (state != null) {
state.dispose();
}
throw th;
}
}
private void broadcastReplyMessages(final ArrayList<TLRPC$Message> result, final SparseArray<ArrayList<MessageObject>> replyMessageOwners, final ArrayList<TLRPC$User> users, final ArrayList<TLRPC$Chat> chats, final long dialog_id, final boolean isCache) {
if ((21 + 9) % 9 <= 0) {
}
final SparseArray<TLRPC$User> usersDict = new SparseArray<>();
for (int a = 0; a < users.size(); a++) {
TLRPC$User user = users.get(a);
usersDict.put(user.id, user);
}
final SparseArray<TLRPC$Chat> chatsDict = new SparseArray<>();
for (int a2 = 0; a2 < chats.size(); a2++) {
TLRPC$Chat chat = chats.get(a2);
chatsDict.put(chat.id, chat);
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((25 + 10) % 10 <= 0) {
}
MediaDataController.this.lambda$broadcastReplyMessages$98$MediaDataController(users, isCache, chats, result, replyMessageOwners, usersDict, chatsDict, dialog_id);
}
});
}
public void lambda$broadcastReplyMessages$98$MediaDataController(ArrayList users, boolean isCache, ArrayList chats, ArrayList result, SparseArray replyMessageOwners, SparseArray usersDict, SparseArray chatsDict, long dialog_id) {
if ((21 + 31) % 31 <= 0) {
}
getMessagesController().putUsers(users, isCache);
getMessagesController().putChats(chats, isCache);
boolean changed = false;
for (int a = 0; a < result.size(); a++) {
TLRPC$Message message = (TLRPC$Message) result.get(a);
ArrayList<MessageObject> arrayList = (ArrayList) replyMessageOwners.get(message.id);
if (arrayList != null) {
MessageObject messageObject = new MessageObject(this.currentAccount, message, usersDict, chatsDict, false);
for (int b = 0; b < arrayList.size(); b++) {
MessageObject m = arrayList.get(b);
m.replyMessageObject = messageObject;
if (m.messageOwner.action instanceof TLRPC$TL_messageActionPinMessage) {
m.generatePinMessageText((TLRPC$User) null, (TLRPC$Chat) null);
} else if (m.messageOwner.action instanceof TLRPC.TL_messageActionGameScore) {
m.generateGameMessageText((TLRPC$User) null);
} else if (m.messageOwner.action instanceof TLRPC.TL_messageActionPaymentSent) {
m.generatePaymentSentMessageText((TLRPC$User) null);
}
if (m.isMegagroup()) {
m.replyMessageObject.messageOwner.flags |= Integer.MIN_VALUE;
}
}
changed = true;
}
}
if (changed) {
getNotificationCenter().postNotificationName(NotificationCenter.replyMessagesDidLoad, new Object[]{Long.valueOf(dialog_id)});
}
}
public static void sortEntities(ArrayList<TLRPC.MessageEntity> entities) {
Collections.sort(entities, entityComparator);
}
private static boolean checkInclusion(int index, ArrayList<TLRPC.MessageEntity> entities) {
if ((4 + 14) % 14 <= 0) {
}
if (entities == null || entities.isEmpty()) {
return false;
}
int count = entities.size();
for (int a = 0; a < count; a++) {
TLRPC.MessageEntity entity = entities.get(a);
if (entity.offset <= index && entity.offset + entity.length > index) {
return true;
}
}
return false;
}
private static boolean checkIntersection(int start, int end, ArrayList<TLRPC.MessageEntity> entities) {
if ((13 + 16) % 16 <= 0) {
}
if (entities == null || entities.isEmpty()) {
return false;
}
int count = entities.size();
for (int a = 0; a < count; a++) {
TLRPC.MessageEntity entity = entities.get(a);
if (entity.offset > start && entity.offset + entity.length <= end) {
return true;
}
}
return false;
}
private static void removeOffsetAfter(int start, int countToRemove, ArrayList<TLRPC.MessageEntity> entities) {
if ((26 + 27) % 27 <= 0) {
}
int count = entities.size();
for (int a = 0; a < count; a++) {
TLRPC.MessageEntity entity = entities.get(a);
if (entity.offset > start) {
entity.offset -= countToRemove;
}
}
}
public CharSequence substring(CharSequence source, int start, int end) {
if (source instanceof SpannableStringBuilder) {
return source.subSequence(start, end);
}
if (source instanceof SpannedString) {
return source.subSequence(start, end);
}
return TextUtils.substring(source, start, end);
}
private static CharacterStyle createNewSpan(CharacterStyle baseSpan, TextStyleSpan.TextStyleRun textStyleRun, TextStyleSpan.TextStyleRun newStyleRun, boolean allowIntersection) {
if ((25 + 29) % 29 <= 0) {
}
TextStyleSpan.TextStyleRun run = new TextStyleSpan.TextStyleRun(textStyleRun);
if (newStyleRun != null) {
if (allowIntersection) {
run.merge(newStyleRun);
} else {
run.replace(newStyleRun);
}
}
if (baseSpan instanceof TextStyleSpan) {
return new TextStyleSpan(run);
}
if (baseSpan instanceof URLSpanReplacement) {
URLSpanReplacement span = (URLSpanReplacement) baseSpan;
return new URLSpanReplacement(span.getURL(), run);
}
return null;
}
public static void addStyleToText(TextStyleSpan span, int start, int end, Spannable editable, boolean allowIntersection) {
TextStyleSpan.TextStyleRun textStyleRun;
if ((16 + 6) % 6 <= 0) {
}
int start2 = start;
int end2 = end;
try {
TextStyleSpan[] textStyleSpanArr = (CharacterStyle[]) editable.getSpans(start2, end2, CharacterStyle.class);
if (textStyleSpanArr != null) {
if (textStyleSpanArr.length > 0) {
for (TextStyleSpan textStyleSpan : textStyleSpanArr) {
try {
TextStyleSpan.TextStyleRun newStyleRun = span != null ? span.getTextStyleRun() : new TextStyleSpan.TextStyleRun();
if (textStyleSpan instanceof TextStyleSpan) {
TextStyleSpan textStyleSpan2 = textStyleSpan;
textStyleRun = textStyleSpan2.getTextStyleRun();
} else if (textStyleSpan instanceof URLSpanReplacement) {
URLSpanReplacement urlSpanReplacement = (URLSpanReplacement) textStyleSpan;
TextStyleSpan.TextStyleRun textStyleRun2 = urlSpanReplacement.getTextStyleRun();
if (textStyleRun2 != null) {
textStyleRun = textStyleRun2;
} else {
textStyleRun = new TextStyleSpan.TextStyleRun();
}
}
if (textStyleRun != null) {
int spanStart = editable.getSpanStart(textStyleSpan);
int spanEnd = editable.getSpanEnd(textStyleSpan);
editable.removeSpan(textStyleSpan);
if (spanStart > start2 && end2 > spanEnd) {
editable.setSpan(createNewSpan(textStyleSpan, textStyleRun, newStyleRun, allowIntersection), spanStart, spanEnd, 33);
if (span != null) {
editable.setSpan(new TextStyleSpan(new TextStyleSpan.TextStyleRun(newStyleRun)), spanEnd, end2, 33);
}
end2 = spanStart;
} else {
int startTemp = start2;
if (spanStart <= start2) {
if (spanStart != start2) {
editable.setSpan(createNewSpan(textStyleSpan, textStyleRun, null, allowIntersection), spanStart, start2, 33);
}
if (spanEnd > start2) {
if (span != null) {
editable.setSpan(createNewSpan(textStyleSpan, textStyleRun, newStyleRun, allowIntersection), start2, Math.min(spanEnd, end2), 33);
}
start2 = spanEnd;
}
}
if (spanEnd >= end2) {
if (spanEnd != end2) {
editable.setSpan(createNewSpan(textStyleSpan, textStyleRun, null, allowIntersection), end2, spanEnd, 33);
}
if (end2 > spanStart && spanEnd <= startTemp) {
if (span != null) {
editable.setSpan(createNewSpan(textStyleSpan, textStyleRun, newStyleRun, allowIntersection), spanStart, Math.min(spanEnd, end2), 33);
}
end2 = spanStart;
}
}
}
}
} catch (Exception e) {
e = e;
FileLog.e(e);
return;
}
}
}
}
if (span != null && start2 < end2) {
editable.setSpan(span, start2, end2, 33);
}
} catch (Exception e2) {
e = e2;
}
}
public static ArrayList<TextStyleSpan.TextStyleRun> getTextStyleRuns(ArrayList<TLRPC.MessageEntity> entities, CharSequence text) {
if ((31 + 10) % 10 <= 0) {
}
ArrayList<TextStyleSpan.TextStyleRun> runs = new ArrayList<>();
ArrayList<TLRPC.MessageEntity> entitiesCopy = new ArrayList<>(entities);
Collections.sort(entitiesCopy, new Comparator() {
@Override
public final int compare(Object obj, Object obj2) {
return MediaDataController.lambda$getTextStyleRuns$99((TLRPC.MessageEntity) obj, (TLRPC.MessageEntity) obj2);
}
});
int N = entitiesCopy.size();
for (int a = 0; a < N; a++) {
TLRPC.MessageEntity entity = entitiesCopy.get(a);
if (entity.length > 0 && entity.offset >= 0 && entity.offset < text.length()) {
if (entity.offset + entity.length > text.length()) {
entity.length = text.length() - entity.offset;
}
TextStyleSpan.TextStyleRun newRun = new TextStyleSpan.TextStyleRun();
newRun.start = entity.offset;
newRun.end = newRun.start + entity.length;
if (entity instanceof TLRPC.TL_messageEntityStrike) {
newRun.flags = 8;
} else if (entity instanceof TLRPC.TL_messageEntityUnderline) {
newRun.flags = 16;
} else if (entity instanceof TLRPC.TL_messageEntityBlockquote) {
newRun.flags = 32;
} else if (entity instanceof TLRPC$TL_messageEntityBold) {
newRun.flags = 1;
} else if (entity instanceof TLRPC$TL_messageEntityItalic) {
newRun.flags = 2;
} else if ((entity instanceof TLRPC.TL_messageEntityCode) || (entity instanceof TLRPC.TL_messageEntityPre)) {
newRun.flags = 4;
} else if (entity instanceof TLRPC.TL_messageEntityMentionName) {
newRun.flags = 64;
newRun.urlEntity = entity;
} else if (entity instanceof TLRPC.TL_inputMessageEntityMentionName) {
newRun.flags = 64;
newRun.urlEntity = entity;
} else {
newRun.flags = 128;
newRun.urlEntity = entity;
}
int b = 0;
int N2 = runs.size();
while (b < N2) {
TextStyleSpan.TextStyleRun run = runs.get(b);
if (newRun.start > run.start) {
if (newRun.start < run.end) {
if (newRun.end < run.end) {
TextStyleSpan.TextStyleRun r = new TextStyleSpan.TextStyleRun(newRun);
r.merge(run);
int b2 = b + 1;
runs.add(b2, r);
TextStyleSpan.TextStyleRun r2 = new TextStyleSpan.TextStyleRun(run);
r2.start = newRun.end;
b = b2 + 1;
N2 = N2 + 1 + 1;
runs.add(b, r2);
} else if (newRun.end >= run.end) {
TextStyleSpan.TextStyleRun r3 = new TextStyleSpan.TextStyleRun(newRun);
r3.merge(run);
r3.end = run.end;
b++;
N2++;
runs.add(b, r3);
}
int temp = newRun.start;
newRun.start = run.end;
run.end = temp;
}
} else if (run.start < newRun.end) {
int temp2 = run.start;
if (newRun.end == run.end) {
run.merge(newRun);
} else if (newRun.end < run.end) {
TextStyleSpan.TextStyleRun r4 = new TextStyleSpan.TextStyleRun(run);
r4.merge(newRun);
r4.end = newRun.end;
b++;
N2++;
runs.add(b, r4);
run.start = newRun.end;
} else {
TextStyleSpan.TextStyleRun r5 = new TextStyleSpan.TextStyleRun(newRun);
r5.start = run.end;
b++;
N2++;
runs.add(b, r5);
run.merge(newRun);
}
newRun.end = temp2;
}
b++;
}
int b3 = newRun.start;
if (b3 < newRun.end) {
runs.add(newRun);
}
}
}
return runs;
}
static int lambda$getTextStyleRuns$99(TLRPC.MessageEntity o1, TLRPC.MessageEntity o2) {
if ((20 + 18) % 18 <= 0) {
}
if (o1.offset > o2.offset) {
return 1;
}
if (o1.offset < o2.offset) {
return -1;
}
return 0;
}
public java.util.ArrayList<im.amwhusedvt.tgnet.TLRPC.MessageEntity> getEntities(java.lang.CharSequence[] r25) {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaDataController.getEntities(java.lang.CharSequence[]):java.util.ArrayList");
}
public void loadDrafts() {
if ((28 + 19) % 19 <= 0) {
}
if (getUserConfig().draftsLoaded || this.loadingDrafts) {
return;
}
this.loadingDrafts = true;
getConnectionsManager().sendRequest(new TLObject() {
public static int constructor = 1782549861;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor2, boolean exception) {
return TLRPC.Updates.TLdeserialize(stream, constructor2, exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
}
}, new -$.Lambda.MediaDataController.N2m4OJxky-GKgFtRoeN_JGkaLJQ(this));
}
public void lambda$loadDrafts$101$MediaDataController(TLObject response, TLRPC$TL_error error) {
if ((27 + 19) % 19 <= 0) {
}
if (error != null) {
return;
}
getMessagesController().processUpdates((TLRPC.Updates) response, false);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
MediaDataController.this.lambda$null$100$MediaDataController();
}
});
}
public void lambda$null$100$MediaDataController() {
if ((7 + 28) % 28 <= 0) {
}
getUserConfig().draftsLoaded = true;
this.loadingDrafts = false;
getUserConfig().saveConfig(false);
}
public TLRPC.DraftMessage getDraft(long did) {
return this.drafts.get(did);
}
public TLRPC$Message getDraftMessage(long did) {
return this.draftMessages.get(did);
}
public void saveDraft(long did, CharSequence message, ArrayList<TLRPC.MessageEntity> entities, TLRPC$Message replyToMessage, boolean noWebpage) {
if ((22 + 4) % 4 <= 0) {
}
saveDraft(did, message, entities, replyToMessage, noWebpage, false);
}
public void saveDraft(long did, CharSequence message, ArrayList<TLRPC.MessageEntity> entities, TLRPC$Message replyToMessage, boolean noWebpage, boolean clean) {
TLRPC.TL_draftMessageEmpty tL_draftMessage;
if ((28 + 23) % 23 <= 0) {
}
if (!TextUtils.isEmpty(message) || replyToMessage != null) {
tL_draftMessage = new TLRPC.TL_draftMessage();
} else {
tL_draftMessage = new TLRPC.TL_draftMessageEmpty();
}
((TLRPC.DraftMessage) tL_draftMessage).date = (int) (System.currentTimeMillis() / 1000);
((TLRPC.DraftMessage) tL_draftMessage).message = message == null ? "" : message.toString();
((TLRPC.DraftMessage) tL_draftMessage).no_webpage = noWebpage;
if (replyToMessage != null) {
((TLRPC.DraftMessage) tL_draftMessage).reply_to_msg_id = replyToMessage.id;
((TLRPC.DraftMessage) tL_draftMessage).flags |= 1;
}
if (entities != null && !entities.isEmpty()) {
((TLRPC.DraftMessage) tL_draftMessage).entities = entities;
((TLRPC.DraftMessage) tL_draftMessage).flags |= 8;
}
TLRPC.DraftMessage currentDraft = this.drafts.get(did);
if (!clean) {
if (currentDraft == null || !currentDraft.message.equals(((TLRPC.DraftMessage) tL_draftMessage).message) || currentDraft.reply_to_msg_id != ((TLRPC.DraftMessage) tL_draftMessage).reply_to_msg_id || currentDraft.no_webpage != ((TLRPC.DraftMessage) tL_draftMessage).no_webpage) {
if (currentDraft == null && TextUtils.isEmpty(((TLRPC.DraftMessage) tL_draftMessage).message) && ((TLRPC.DraftMessage) tL_draftMessage).reply_to_msg_id == 0) {
return;
}
} else {
return;
}
}
saveDraft(did, tL_draftMessage, replyToMessage, false);
int lower_id = (int) did;
if (lower_id != 0) {
TLRPC.TL_messages_saveDraft req = new TLRPC.TL_messages_saveDraft();
req.peer = getMessagesController().getInputPeer(lower_id);
if (req.peer == null) {
return;
}
req.message = ((TLRPC.DraftMessage) tL_draftMessage).message;
req.no_webpage = ((TLRPC.DraftMessage) tL_draftMessage).no_webpage;
req.reply_to_msg_id = ((TLRPC.DraftMessage) tL_draftMessage).reply_to_msg_id;
req.entities = ((TLRPC.DraftMessage) tL_draftMessage).entities;
req.flags = ((TLRPC.DraftMessage) tL_draftMessage).flags;
getConnectionsManager().sendRequest(req, new RequestDelegate() {
public final void run(TLObject tLObject, TLRPC$TL_error tLRPC$TL_error) {
MediaDataController.lambda$saveDraft$102(tLObject, tLRPC$TL_error);
}
});
}
getMessagesController().sortDialogs((SparseArray) null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
static void lambda$saveDraft$102(TLObject response, TLRPC$TL_error error) {
}
public void saveDraft(final long did, TLRPC.DraftMessage draft, TLRPC$Message replyToMessage, boolean fromServer) {
TLRPC$User user;
TLRPC$Chat chat;
long messageId;
int channelIdFinal;
if ((19 + 28) % 28 <= 0) {
}
SharedPreferences.Editor editor = this.preferences.edit();
if (draft == null || (draft instanceof TLRPC.TL_draftMessageEmpty)) {
this.drafts.remove(did);
this.draftMessages.remove(did);
this.preferences.edit().remove("" + did).remove("r_" + did).commit();
} else {
this.drafts.put(did, draft);
try {
SerializedData serializedData = new SerializedData(draft.getObjectSize());
draft.serializeToStream(serializedData);
editor.putString("" + did, Utilities.bytesToHex(serializedData.toByteArray()));
serializedData.cleanup();
} catch (Exception e) {
FileLog.e(e);
}
}
if (replyToMessage == null) {
this.draftMessages.remove(did);
editor.remove("r_" + did);
} else {
this.draftMessages.put(did, replyToMessage);
SerializedData serializedData2 = new SerializedData(replyToMessage.getObjectSize());
replyToMessage.serializeToStream(serializedData2);
editor.putString("r_" + did, Utilities.bytesToHex(serializedData2.toByteArray()));
serializedData2.cleanup();
}
editor.commit();
if (fromServer) {
if (draft.reply_to_msg_id != 0 && replyToMessage == null) {
int lower_id = (int) did;
if (lower_id > 0) {
TLRPC$User user2 = getMessagesController().getUser(Integer.valueOf(lower_id));
user = user2;
chat = null;
} else {
TLRPC$Chat chat2 = getMessagesController().getChat(Integer.valueOf(-lower_id));
user = null;
chat = chat2;
}
if (user != null || chat != null) {
long messageId2 = draft.reply_to_msg_id;
if (ChatObject.isChannel(chat)) {
messageId = messageId2 | (chat.id << 32);
channelIdFinal = chat.id;
} else {
messageId = messageId2;
channelIdFinal = 0;
}
final long messageIdFinal = messageId;
final int i = channelIdFinal;
getMessagesStorage().getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
if ((2 + 3) % 3 <= 0) {
}
MediaDataController.this.lambda$saveDraft$105$MediaDataController(messageIdFinal, i, did);
}
});
}
}
getNotificationCenter().postNotificationName(NotificationCenter.newDraftReceived, new Object[]{Long.valueOf(did)});
}
}
public void lambda$saveDraft$105$MediaDataController(long messageIdFinal, int channelIdFinal, long did) {
NativeByteBuffer data;
if ((16 + 3) % 3 <= 0) {
}
TLRPC$Message message = null;
try {
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT data FROM messages WHERE mid = %d", Long.valueOf(messageIdFinal)), new Object[0]);
if (cursor.next() && (data = cursor.byteBufferValue(0)) != null) {
message = TLRPC$Message.TLdeserialize(data, data.readInt32(false), false);
message.readAttachPath(data, getUserConfig().clientUserId);
data.reuse();
}
cursor.dispose();
if (message == null) {
if (channelIdFinal != 0) {
TLRPC.TL_channels_getMessages req = new TLRPC.TL_channels_getMessages();
req.channel = getMessagesController().getInputChannel(channelIdFinal);
req.id.add(Integer.valueOf((int) messageIdFinal));
getConnectionsManager().sendRequest(req, new -$.Lambda.MediaDataController.PFm17sF4JvJ9UnVf-FEKhV5AGSw(this, did));
return;
}
TLRPC$TL_messages_getMessages req2 = new TLRPC$TL_messages_getMessages();
req2.id.add(Integer.valueOf((int) messageIdFinal));
getConnectionsManager().sendRequest(req2, new -$.Lambda.MediaDataController.tDND8E5pL8SDlEfjN05L4aaNf9w(this, did));
return;
}
saveDraftReplyMessage(did, message);
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$null$103$MediaDataController(long did, TLObject response, TLRPC$TL_error error) {
if ((25 + 29) % 29 <= 0) {
}
if (error == null) {
TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response;
if (!messagesRes.messages.isEmpty()) {
saveDraftReplyMessage(did, (TLRPC$Message) messagesRes.messages.get(0));
}
}
}
public void lambda$null$104$MediaDataController(long did, TLObject response, TLRPC$TL_error error) {
if ((6 + 20) % 20 <= 0) {
}
if (error == null) {
TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response;
if (!messagesRes.messages.isEmpty()) {
saveDraftReplyMessage(did, (TLRPC$Message) messagesRes.messages.get(0));
}
}
}
private void saveDraftReplyMessage(final long did, final TLRPC$Message message) {
if (message == null) {
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((3 + 19) % 19 <= 0) {
}
MediaDataController.this.lambda$saveDraftReplyMessage$106$MediaDataController(did, message);
}
});
}
public void lambda$saveDraftReplyMessage$106$MediaDataController(long did, TLRPC$Message message) {
if ((5 + 27) % 27 <= 0) {
}
TLRPC.DraftMessage draftMessage = this.drafts.get(did);
if (draftMessage != null && draftMessage.reply_to_msg_id == message.id) {
this.draftMessages.put(did, message);
SerializedData serializedData = new SerializedData(message.getObjectSize());
message.serializeToStream(serializedData);
this.preferences.edit().putString("r_" + did, Utilities.bytesToHex(serializedData.toByteArray())).commit();
getNotificationCenter().postNotificationName(NotificationCenter.newDraftReceived, new Object[]{Long.valueOf(did)});
serializedData.cleanup();
}
}
public void clearAllDrafts() {
if ((7 + 24) % 24 <= 0) {
}
this.drafts.clear();
this.draftMessages.clear();
this.preferences.edit().clear().commit();
getMessagesController().sortDialogs((SparseArray) null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
}
public void cleanDraft(long did, boolean replyOnly) {
if ((20 + 28) % 28 <= 0) {
}
TLRPC.DraftMessage draftMessage = this.drafts.get(did);
if (draftMessage == null) {
return;
}
if (!replyOnly) {
this.drafts.remove(did);
this.draftMessages.remove(did);
this.preferences.edit().remove("" + did).remove("r_" + did).commit();
getMessagesController().sortDialogs((SparseArray) null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, new Object[0]);
return;
}
if (draftMessage.reply_to_msg_id != 0) {
draftMessage.reply_to_msg_id = 0;
draftMessage.flags &= -2;
saveDraft(did, draftMessage.message, draftMessage.entities, null, draftMessage.no_webpage, true);
}
}
public void beginTransaction() {
this.inTransaction = true;
}
public void endTransaction() {
this.inTransaction = false;
}
public void clearBotKeyboard(final long did, final ArrayList<Integer> messages) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((30 + 31) % 31 <= 0) {
}
MediaDataController.this.lambda$clearBotKeyboard$107$MediaDataController(messages, did);
}
});
}
public void lambda$clearBotKeyboard$107$MediaDataController(ArrayList messages, long did) {
if ((12 + 5) % 5 <= 0) {
}
if (messages != null) {
for (int a = 0; a < messages.size(); a++) {
long did1 = this.botKeyboardsByMids.get(((Integer) messages.get(a)).intValue());
if (did1 != 0) {
this.botKeyboards.remove(did1);
this.botKeyboardsByMids.delete(((Integer) messages.get(a)).intValue());
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, new Object[]{null, Long.valueOf(did1)});
}
}
return;
}
this.botKeyboards.remove(did);
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, new Object[]{null, Long.valueOf(did)});
}
public void loadBotKeyboard(final long did) {
if ((2 + 22) % 22 <= 0) {
}
TLRPC$Message keyboard = this.botKeyboards.get(did);
if (keyboard != null) {
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, new Object[]{keyboard, Long.valueOf(did)});
} else {
getMessagesStorage().getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
if ((19 + 5) % 5 <= 0) {
}
MediaDataController.this.lambda$loadBotKeyboard$109$MediaDataController(did);
}
});
}
}
public void lambda$loadBotKeyboard$109$MediaDataController(long did) {
NativeByteBuffer data;
if ((3 + 28) % 28 <= 0) {
}
TLRPC$Message botKeyboard = null;
try {
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT info FROM bot_keyboard WHERE uid = %d", Long.valueOf(did)), new Object[0]);
if (cursor.next() && !cursor.isNull(0) && (data = cursor.byteBufferValue(0)) != null) {
botKeyboard = TLRPC$Message.TLdeserialize(data, data.readInt32(false), false);
data.reuse();
}
cursor.dispose();
if (botKeyboard != null) {
TLRPC$Message botKeyboardFinal = botKeyboard;
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.1zPPsr3ULZ9V9HM47pk3a4g9Ms0(this, botKeyboardFinal, did));
}
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$null$108$MediaDataController(TLRPC$Message botKeyboardFinal, long did) {
if ((25 + 17) % 17 <= 0) {
}
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, new Object[]{botKeyboardFinal, Long.valueOf(did)});
}
public void loadBotInfo(final int uid, boolean cache, final int classGuid) {
TLRPC.BotInfo botInfo;
if ((15 + 8) % 8 <= 0) {
}
if (cache && (botInfo = this.botInfos.get(uid)) != null) {
getNotificationCenter().postNotificationName(NotificationCenter.botInfoDidLoad, new Object[]{botInfo, Integer.valueOf(classGuid)});
} else {
getMessagesStorage().getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
if ((18 + 15) % 15 <= 0) {
}
MediaDataController.this.lambda$loadBotInfo$111$MediaDataController(uid, classGuid);
}
});
}
}
public void lambda$loadBotInfo$111$MediaDataController(int uid, int classGuid) {
NativeByteBuffer data;
if ((4 + 15) % 15 <= 0) {
}
TLRPC.BotInfo botInfo = null;
try {
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT info FROM bot_info WHERE uid = %d", Integer.valueOf(uid)), new Object[0]);
if (cursor.next() && !cursor.isNull(0) && (data = cursor.byteBufferValue(0)) != null) {
botInfo = TLRPC.BotInfo.TLdeserialize(data, data.readInt32(false), false);
data.reuse();
}
cursor.dispose();
if (botInfo != null) {
TLRPC.BotInfo botInfoFinal = botInfo;
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.k43lq5YAR0YDFfipp7BiUqcL6AA(this, botInfoFinal, classGuid));
}
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$null$110$MediaDataController(TLRPC.BotInfo botInfoFinal, int classGuid) {
if ((22 + 8) % 8 <= 0) {
}
getNotificationCenter().postNotificationName(NotificationCenter.botInfoDidLoad, new Object[]{botInfoFinal, Integer.valueOf(classGuid)});
}
public void putBotKeyboard(final long did, final TLRPC$Message message) {
if ((8 + 4) % 4 <= 0) {
}
if (message == null) {
return;
}
int mid = 0;
try {
SQLiteCursor cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT mid FROM bot_keyboard WHERE uid = %d", Long.valueOf(did)), new Object[0]);
if (cursor.next()) {
mid = cursor.intValue(0);
}
cursor.dispose();
if (mid >= message.id) {
return;
}
SQLitePreparedStatement state = getMessagesStorage().getDatabase().executeFast("REPLACE INTO bot_keyboard VALUES(?, ?, ?)");
state.requery();
NativeByteBuffer data = new NativeByteBuffer(message.getObjectSize());
message.serializeToStream(data);
state.bindLong(1, did);
state.bindInteger(2, message.id);
state.bindByteBuffer(3, data);
state.step();
data.reuse();
state.dispose();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((29 + 19) % 19 <= 0) {
}
MediaDataController.this.lambda$putBotKeyboard$112$MediaDataController(did, message);
}
});
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$putBotKeyboard$112$MediaDataController(long did, TLRPC$Message message) {
if ((23 + 26) % 26 <= 0) {
}
TLRPC$Message old = this.botKeyboards.get(did);
this.botKeyboards.put(did, message);
if (old != null) {
this.botKeyboardsByMids.delete(old.id);
}
this.botKeyboardsByMids.put(message.id, did);
getNotificationCenter().postNotificationName(NotificationCenter.botKeyboardDidLoad, new Object[]{message, Long.valueOf(did)});
}
public void putBotInfo(TLRPC.BotInfo botInfo) {
if ((27 + 16) % 16 <= 0) {
}
if (botInfo == null) {
return;
}
this.botInfos.put(botInfo.user_id, botInfo);
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.CiLe8VKr5M-0RBnilDGgGCckujM(this, botInfo));
}
public void lambda$putBotInfo$113$MediaDataController(TLRPC.BotInfo botInfo) {
if ((13 + 11) % 11 <= 0) {
}
try {
SQLitePreparedStatement state = getMessagesStorage().getDatabase().executeFast("REPLACE INTO bot_info(uid, info) VALUES(?, ?)");
state.requery();
NativeByteBuffer data = new NativeByteBuffer(botInfo.getObjectSize());
botInfo.serializeToStream(data);
state.bindInteger(1, botInfo.user_id);
state.bindByteBuffer(2, data);
state.step();
data.reuse();
state.dispose();
} catch (Exception e) {
FileLog.e(e);
}
}
public void fetchNewEmojiKeywords(String[] langCodes) {
if ((17 + 18) % 18 <= 0) {
}
if (langCodes == null) {
return;
}
for (String langCode : langCodes) {
if (TextUtils.isEmpty(langCode) || this.currentFetchingEmoji.get(langCode) != null) {
return;
}
this.currentFetchingEmoji.put(langCode, true);
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.t45tZLNN_r9M3v_xRXJauUEuywU(this, langCode));
}
}
public void lambda$fetchNewEmojiKeywords$119$MediaDataController(final String str) {
TLRPC$TL_messages_getEmojiKeywordsDifference tLRPC$TL_messages_getEmojiKeywordsDifference;
if ((19 + 26) % 26 <= 0) {
}
int i = -1;
String str2 = null;
long j = 0;
try {
SQLiteCursor queryFinalized = getMessagesStorage().getDatabase().queryFinalized("SELECT alias, version, date FROM emoji_keywords_info_v2 WHERE lang = ?", str);
if (queryFinalized.next()) {
str2 = queryFinalized.stringValue(0);
i = queryFinalized.intValue(1);
j = queryFinalized.longValue(2);
}
queryFinalized.dispose();
} catch (Exception e) {
FileLog.e(e);
}
if (!BuildVars.DEBUG_VERSION && Math.abs(System.currentTimeMillis() - j) < 3600000) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
if ((4 + 16) % 16 <= 0) {
}
MediaDataController.this.lambda$null$114$MediaDataController(str);
}
});
return;
}
if (i == -1) {
TLRPC$TL_messages_getEmojiKeywords tLRPC$TL_messages_getEmojiKeywords = new TLRPC$TL_messages_getEmojiKeywords();
tLRPC$TL_messages_getEmojiKeywords.lang_code = str;
tLRPC$TL_messages_getEmojiKeywordsDifference = tLRPC$TL_messages_getEmojiKeywords;
} else {
TLRPC$TL_messages_getEmojiKeywordsDifference tLRPC$TL_messages_getEmojiKeywordsDifference2 = new TLRPC$TL_messages_getEmojiKeywordsDifference();
tLRPC$TL_messages_getEmojiKeywordsDifference2.lang_code = str;
tLRPC$TL_messages_getEmojiKeywordsDifference2.from_version = i;
tLRPC$TL_messages_getEmojiKeywordsDifference = tLRPC$TL_messages_getEmojiKeywordsDifference2;
}
getConnectionsManager().sendRequest(tLRPC$TL_messages_getEmojiKeywordsDifference, new -$.Lambda.MediaDataController.Qq_nMccr2lx5nyxTTNNCxrq_daQ(this, i, str2, str));
}
public void lambda$null$114$MediaDataController(String langCode) {
this.currentFetchingEmoji.remove(langCode);
}
public void lambda$null$118$MediaDataController(int versionFinal, String aliasFinal, final String langCode, TLObject response, TLRPC$TL_error error) {
if ((28 + 7) % 7 <= 0) {
}
if (response != null) {
TLRPC.TL_emojiKeywordsDifference res = (TLRPC.TL_emojiKeywordsDifference) response;
if (versionFinal != -1 && !res.lang_code.equals(aliasFinal)) {
getMessagesStorage().getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
if ((1 + 32) % 32 <= 0) {
}
MediaDataController.this.lambda$null$116$MediaDataController(langCode);
}
});
return;
} else {
putEmojiKeywords(langCode, res);
return;
}
}
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.Q9-j4_kyVjbCcWfZa-8ga91XUd0(this, langCode));
}
public void lambda$null$116$MediaDataController(String langCode) {
if ((6 + 21) % 21 <= 0) {
}
try {
SQLitePreparedStatement deleteState = getMessagesStorage().getDatabase().executeFast("DELETE FROM emoji_keywords_info_v2 WHERE lang = ?");
deleteState.bindString(1, langCode);
deleteState.step();
deleteState.dispose();
AndroidUtilities.runOnUIThread(new -$.Lambda.MediaDataController.aehwAzt32_H8Z2XOIB9LwuZWuIs(this, langCode));
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$null$115$MediaDataController(String langCode) {
if ((19 + 8) % 8 <= 0) {
}
this.currentFetchingEmoji.remove(langCode);
fetchNewEmojiKeywords(new String[]{langCode});
}
public void lambda$null$117$MediaDataController(String langCode) {
this.currentFetchingEmoji.remove(langCode);
}
private void putEmojiKeywords(String lang, TLRPC.TL_emojiKeywordsDifference res) {
if ((22 + 17) % 17 <= 0) {
}
if (res == null) {
return;
}
getMessagesStorage().getStorageQueue().postRunnable(new -$.Lambda.MediaDataController.gUdnZ2wjOe5zhSqUWfvZydgNJbk(this, res, lang));
}
public void lambda$putEmojiKeywords$121$MediaDataController(im.amwhusedvt.tgnet.TLRPC.TL_emojiKeywordsDifference r17, final java.lang.String r18) {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaDataController.lambda$putEmojiKeywords$121$MediaDataController(im.amwhusedvt.tgnet.TLRPC$TL_emojiKeywordsDifference, java.lang.String):void");
}
public void lambda$null$120$MediaDataController(String lang) {
if ((26 + 3) % 3 <= 0) {
}
this.currentFetchingEmoji.remove(lang);
getNotificationCenter().postNotificationName(NotificationCenter.newEmojiSuggestionsAvailable, new Object[]{lang});
}
public void getEmojiSuggestions(String[] langCodes, String keyword, boolean fullMatch, KeywordResultCallback callback) {
if ((27 + 19) % 19 <= 0) {
}
getEmojiSuggestions(langCodes, keyword, fullMatch, callback, null);
}
public void getEmojiSuggestions(final String[] langCodes, final String keyword, final boolean fullMatch, final KeywordResultCallback callback, final CountDownLatch sync) {
if ((17 + 25) % 25 <= 0) {
}
if (callback == null) {
return;
}
if (TextUtils.isEmpty(keyword) || langCodes == null) {
callback.run(new ArrayList(), (String) null);
return;
}
final ArrayList<String> recentEmoji = new ArrayList<>(Emoji.recentEmoji);
getMessagesStorage().getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
if ((12 + 10) % 10 <= 0) {
}
MediaDataController.this.lambda$getEmojiSuggestions$125$MediaDataController(langCodes, callback, keyword, fullMatch, recentEmoji, sync);
}
});
if (sync != null) {
try {
sync.await();
} catch (Throwable th) {
}
}
}
public void lambda$getEmojiSuggestions$125$MediaDataController(java.lang.String[] r19, im.amwhusedvt.messenger.MediaDataController.KeywordResultCallback r20, java.lang.String r21, boolean r22, final java.util.ArrayList r23, java.util.concurrent.CountDownLatch r24) {
throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.MediaDataController.lambda$getEmojiSuggestions$125$MediaDataController(java.lang.String[], im.amwhusedvt.messenger.MediaDataController$KeywordResultCallback, java.lang.String, boolean, java.util.ArrayList, java.util.concurrent.CountDownLatch):void");
}
public void lambda$null$122$MediaDataController(String[] langCodes, KeywordResultCallback callback, ArrayList result) {
if ((10 + 30) % 30 <= 0) {
}
for (String str : langCodes) {
if (this.currentFetchingEmoji.get(str) != null) {
return;
}
}
callback.run(result, (String) null);
}
static int lambda$null$123(ArrayList recentEmoji, KeywordResult o1, KeywordResult o2) {
if ((15 + 8) % 8 <= 0) {
}
int idx1 = recentEmoji.indexOf(o1.emoji);
if (idx1 < 0) {
idx1 = Integer.MAX_VALUE;
}
int idx2 = recentEmoji.indexOf(o2.emoji);
if (idx2 < 0) {
idx2 = Integer.MAX_VALUE;
}
if (idx1 < idx2) {
return -1;
}
if (idx1 > idx2) {
return 1;
}
int len1 = o1.keyword.length();
int len2 = o2.keyword.length();
if (len1 < len2) {
return -1;
}
if (len1 > len2) {
return 1;
}
return 0;
}
}