导航菜单

页面标题

页面副标题

北京退费客服端 v1.0.0 - NotificationsController.java 源代码

正在查看: 北京退费客服端 v1.0.0 应用的 NotificationsController.java JAVA 源代码文件

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


package im.amwhusedvt.messenger;

import android.app.AlarmManager;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ImageDecoder;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.media.AudioAttributes;
import android.media.AudioManager;
import android.media.SoundPool;
import android.net.Uri;
import android.os.Build;
import android.os.PowerManager;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.LongSparseArray;
import android.util.SparseArray;
import android.util.SparseIntArray;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.app.Person;
import androidx.core.graphics.drawable.IconCompat;
import im.amwhusedvt.messenger.-$;
import im.amwhusedvt.messenger.support.SparseLongArray;
import im.amwhusedvt.tgnet.ConnectionsManager;
import im.amwhusedvt.tgnet.RequestDelegate;
import im.amwhusedvt.tgnet.TLApiModel;
import im.amwhusedvt.tgnet.TLJsonResolve;
import im.amwhusedvt.tgnet.TLObject;
import im.amwhusedvt.tgnet.TLRPC;
import im.amwhusedvt.tgnet.TLRPCRedpacket;
import im.amwhusedvt.ui.PopupNotificationActivity;
import im.amwhusedvt.ui.hui.packet.bean.RedpacketBean;
import im.amwhusedvt.ui.hui.packet.bean.RedpacketResponse;
import im.amwhusedvt.ui.hui.transfer.bean.TransferResponse;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import org.json.JSONException;
import org.json.JSONObject;

public class NotificationsController extends BaseController {
    public static final String EXTRA_VOICE_REPLY = "extra_voice_reply";
    private static volatile NotificationsController[] Instance = null;
    public static String OTHER_NOTIFICATIONS_CHANNEL = null;
    public static final int SETTING_MUTE_2_DAYS = 2;
    public static final int SETTING_MUTE_8_HOURS = 1;
    public static final int SETTING_MUTE_FOREVER = 3;
    public static final int SETTING_MUTE_HOUR = 0;
    public static final int SETTING_MUTE_UNMUTE = 4;
    public static final int TYPE_CHANNEL = 2;
    public static final int TYPE_GROUP = 0;
    public static final int TYPE_PRIVATE = 1;
    protected static AudioManager audioManager;
    public static long globalSecretChatId;
    private static NotificationManagerCompat notificationManager;
    private static DispatchQueue notificationsQueue;
    private static NotificationManager systemNotificationManager;
    private AlarmManager alarmManager;
    private ArrayList<MessageObject> delayedPushMessages;
    private LongSparseArray<MessageObject> fcmRandomMessagesDict;
    private boolean inChatSoundEnabled;
    private int lastBadgeCount;
    private int lastButtonId;
    private int lastOnlineFromOtherDevice;
    private long lastSoundOutPlay;
    private long lastSoundPlay;
    private LongSparseArray<Integer> lastWearNotifiedMessageId;
    private String launcherClassName;
    private Runnable notificationDelayRunnable;
    private PowerManager.WakeLock notificationDelayWakelock;
    private String notificationGroup;
    private int notificationId;
    private boolean notifyCheck;
    private long opened_dialog_id;
    private int personal_count;
    public ArrayList<MessageObject> popupMessages;
    public ArrayList<MessageObject> popupReplyMessages;
    private LongSparseArray<Integer> pushDialogs;
    private LongSparseArray<Integer> pushDialogsOverrideMention;
    private ArrayList<MessageObject> pushMessages;
    private LongSparseArray<MessageObject> pushMessagesDict;
    public boolean showBadgeMessages;
    public boolean showBadgeMuted;
    public boolean showBadgeNumber;
    private LongSparseArray<Point> smartNotificationsDialogs;
    private int soundIn;
    private boolean soundInLoaded;
    private int soundOut;
    private boolean soundOutLoaded;
    private SoundPool soundPool;
    private int soundRecord;
    private boolean soundRecordLoaded;
    private int total_unread_count;
    private LongSparseArray<Integer> wearNotificationsIds;

    static void access$000(byte b, short s, String str, int i) {
        double d = (42 * 210) + 210;
    }

    static void access$000(int i, byte b, String str, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$000(short s, String str, int i, byte b) {
        double d = (42 * 210) + 210;
    }

    private void addToPopupMessages(ArrayList arrayList, MessageObject messageObject, int i, long j, boolean z, SharedPreferences sharedPreferences, float f, int i2, boolean z2, char c) {
        double d = (42 * 210) + 210;
    }

    private void addToPopupMessages(ArrayList arrayList, MessageObject messageObject, int i, long j, boolean z, SharedPreferences sharedPreferences, int i2, char c, boolean z2, float f) {
        double d = (42 * 210) + 210;
    }

    private void addToPopupMessages(ArrayList arrayList, MessageObject messageObject, int i, long j, boolean z, SharedPreferences sharedPreferences, int i2, float f, boolean z2, char c) {
        double d = (42 * 210) + 210;
    }

    public static void checkOtherNotificationsChannel(byte b, float f, char c, int i) {
        double d = (42 * 210) + 210;
    }

    public static void checkOtherNotificationsChannel(byte b, int i, float f, char c) {
        double d = (42 * 210) + 210;
    }

    public static void checkOtherNotificationsChannel(int i, byte b, char c, float f) {
        double d = (42 * 210) + 210;
    }

    private void dismissNotification(byte b, float f, boolean z, int i) {
        double d = (42 * 210) + 210;
    }

    private void dismissNotification(byte b, int i, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    private void dismissNotification(float f, int i, boolean z, byte b) {
        double d = (42 * 210) + 210;
    }

    public static void getInstance(int i, String str, char c, short s, boolean z) {
        double d = (42 * 210) + 210;
    }

    public static void getInstance(int i, String str, short s, boolean z, char c) {
        double d = (42 * 210) + 210;
    }

    public static void getInstance(int i, String str, boolean z, char c, short s) {
        double d = (42 * 210) + 210;
    }

    private void getNotifyOverride(SharedPreferences sharedPreferences, long j, byte b, boolean z, String str, short s) {
        double d = (42 * 210) + 210;
    }

    private void getNotifyOverride(SharedPreferences sharedPreferences, long j, short s, byte b, String str, boolean z) {
        double d = (42 * 210) + 210;
    }

    private void getNotifyOverride(SharedPreferences sharedPreferences, long j, short s, boolean z, String str, byte b) {
        double d = (42 * 210) + 210;
    }

    private void getShortStringForMessage(MessageObject messageObject, String[] strArr, boolean[] zArr, byte b, int i, String str, float f) {
        double d = (42 * 210) + 210;
    }

    private void getShortStringForMessage(MessageObject messageObject, String[] strArr, boolean[] zArr, float f, int i, byte b, String str) {
        double d = (42 * 210) + 210;
    }

    private void getShortStringForMessage(MessageObject messageObject, String[] strArr, boolean[] zArr, int i, float f, byte b, String str) {
        double d = (42 * 210) + 210;
    }

    private void getStringForMessage(MessageObject messageObject, boolean z, boolean[] zArr, boolean[] zArr2, int i, char c, String str, boolean z2) {
        double d = (42 * 210) + 210;
    }

    private void getStringForMessage(MessageObject messageObject, boolean z, boolean[] zArr, boolean[] zArr2, String str, boolean z2, int i, char c) {
        double d = (42 * 210) + 210;
    }

    private void getStringForMessage(MessageObject messageObject, boolean z, boolean[] zArr, boolean[] zArr2, boolean z2, char c, int i, String str) {
        double d = (42 * 210) + 210;
    }

    private void getTotalAllUnreadCount(char c, boolean z, float f, String str) {
        double d = (42 * 210) + 210;
    }

    private void getTotalAllUnreadCount(String str, char c, boolean z, float f) {
        double d = (42 * 210) + 210;
    }

    private void getTotalAllUnreadCount(boolean z, String str, char c, float f) {
        double d = (42 * 210) + 210;
    }

    private void isEmptyVibration(long[] jArr, byte b, char c, int i, float f) {
        double d = (42 * 210) + 210;
    }

    private void isEmptyVibration(long[] jArr, char c, byte b, int i, float f) {
        double d = (42 * 210) + 210;
    }

    private void isEmptyVibration(long[] jArr, float f, int i, char c, byte b) {
        double d = (42 * 210) + 210;
    }

    private void isPersonalMessage(MessageObject messageObject, byte b, int i, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    private void isPersonalMessage(MessageObject messageObject, byte b, boolean z, float f, int i) {
        double d = (42 * 210) + 210;
    }

    private void isPersonalMessage(MessageObject messageObject, boolean z, int i, float f, byte b) {
        double d = (42 * 210) + 210;
    }

    static void lambda$dismissNotification$25(char c, short s, int i, float f) {
        double d = (42 * 210) + 210;
    }

    static void lambda$dismissNotification$25(int i, char c, short s, float f) {
        double d = (42 * 210) + 210;
    }

    static void lambda$dismissNotification$25(int i, float f, short s, char c) {
        double d = (42 * 210) + 210;
    }

    static void lambda$loadRoundAvatar$33(ImageDecoder imageDecoder, ImageDecoder.ImageInfo imageInfo, ImageDecoder.Source source, byte b, int i, short s, String str) {
        double d = (42 * 210) + 210;
    }

    static void lambda$loadRoundAvatar$33(ImageDecoder imageDecoder, ImageDecoder.ImageInfo imageInfo, ImageDecoder.Source source, byte b, short s, String str, int i) {
        double d = (42 * 210) + 210;
    }

    static void lambda$loadRoundAvatar$33(ImageDecoder imageDecoder, ImageDecoder.ImageInfo imageInfo, ImageDecoder.Source source, String str, short s, byte b, int i) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$26(SoundPool soundPool, int i, int i2, byte b, short s, String str, float f) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$26(SoundPool soundPool, int i, int i2, String str, short s, float f, byte b) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$26(SoundPool soundPool, int i, int i2, short s, byte b, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$32(Canvas canvas, float f, int i, byte b, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$32(Canvas canvas, float f, int i, boolean z, byte b) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$32(Canvas canvas, float f, boolean z, byte b, int i) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$34(SoundPool soundPool, int i, int i2, char c, boolean z, int i3, byte b) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$34(SoundPool soundPool, int i, int i2, int i3, char c, boolean z, byte b) {
        double d = (42 * 210) + 210;
    }

    static void lambda$null$34(SoundPool soundPool, int i, int i2, boolean z, int i3, byte b, char c) {
        double d = (42 * 210) + 210;
    }

    static void lambda$showExtraNotifications$31(Uri uri, char c, String str, boolean z, int i) {
        double d = (42 * 210) + 210;
    }

    static void lambda$showExtraNotifications$31(Uri uri, char c, boolean z, int i, String str) {
        double d = (42 * 210) + 210;
    }

    static void lambda$showExtraNotifications$31(Uri uri, int i, boolean z, String str, char c) {
        double d = (42 * 210) + 210;
    }

    static void lambda$updateServerNotificationsSettings$36(TLObject tLObject, TLRPC.TL_error tL_error, byte b, boolean z, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void lambda$updateServerNotificationsSettings$36(TLObject tLObject, TLRPC.TL_error tL_error, String str, float f, boolean z, byte b) {
        double d = (42 * 210) + 210;
    }

    static void lambda$updateServerNotificationsSettings$36(TLObject tLObject, TLRPC.TL_error tL_error, boolean z, byte b, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void lambda$updateServerNotificationsSettings$37(TLObject tLObject, TLRPC.TL_error tL_error, byte b, String str, short s, char c) {
        double d = (42 * 210) + 210;
    }

    static void lambda$updateServerNotificationsSettings$37(TLObject tLObject, TLRPC.TL_error tL_error, char c, String str, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    static void lambda$updateServerNotificationsSettings$37(TLObject tLObject, TLRPC.TL_error tL_error, char c, String str, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    private void loadRoundAvatar(File file, Person.Builder builder, boolean z, float f, String str, short s) {
        double d = (42 * 210) + 210;
    }

    private void loadRoundAvatar(File file, Person.Builder builder, boolean z, String str, float f, short s) {
        double d = (42 * 210) + 210;
    }

    private void loadRoundAvatar(File file, Person.Builder builder, boolean z, String str, short s, float f) {
        double d = (42 * 210) + 210;
    }

    private void playInChatSound(int i, String str, boolean z, byte b) {
        double d = (42 * 210) + 210;
    }

    private void playInChatSound(boolean z, int i, byte b, String str) {
        double d = (42 * 210) + 210;
    }

    private void playInChatSound(boolean z, String str, byte b, int i) {
        double d = (42 * 210) + 210;
    }

    private void scheduleNotificationDelay(boolean z, String str, int i, short s, boolean z2) {
        double d = (42 * 210) + 210;
    }

    private void scheduleNotificationDelay(boolean z, String str, short s, boolean z2, int i) {
        double d = (42 * 210) + 210;
    }

    private void scheduleNotificationDelay(boolean z, short s, boolean z2, String str, int i) {
        double d = (42 * 210) + 210;
    }

    private void scheduleNotificationRepeat(char c, String str, float f, int i) {
        double d = (42 * 210) + 210;
    }

    private void scheduleNotificationRepeat(int i, char c, String str, float f) {
        double d = (42 * 210) + 210;
    }

    private void scheduleNotificationRepeat(String str, int i, float f, char c) {
        double d = (42 * 210) + 210;
    }

    private void setBadge(int i, char c, byte b, boolean z, String str) {
        double d = (42 * 210) + 210;
    }

    private void setBadge(int i, String str, boolean z, char c, byte b) {
        double d = (42 * 210) + 210;
    }

    private void setBadge(int i, boolean z, char c, String str, byte b) {
        double d = (42 * 210) + 210;
    }

    private void showExtraNotifications(NotificationCompat.Builder builder, boolean z, String str, float f, byte b, int i, short s) {
        double d = (42 * 210) + 210;
    }

    private void showExtraNotifications(NotificationCompat.Builder builder, boolean z, String str, int i, byte b, short s, float f) {
        double d = (42 * 210) + 210;
    }

    private void showExtraNotifications(NotificationCompat.Builder builder, boolean z, String str, int i, float f, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    private void showOrUpdateNotification(boolean z, byte b, float f, short s, String str) {
        double d = (42 * 210) + 210;
    }

    private void showOrUpdateNotification(boolean z, byte b, String str, short s, float f) {
        double d = (42 * 210) + 210;
    }

    private void showOrUpdateNotification(boolean z, float f, String str, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    private void validateChannelId(long j, String str, long[] jArr, int i, Uri uri, int i2, long[] jArr2, Uri uri2, int i3, char c, String str2, boolean z, short s) {
        double d = (42 * 210) + 210;
    }

    private void validateChannelId(long j, String str, long[] jArr, int i, Uri uri, int i2, long[] jArr2, Uri uri2, int i3, String str2, char c, short s, boolean z) {
        double d = (42 * 210) + 210;
    }

    private void validateChannelId(long j, String str, long[] jArr, int i, Uri uri, int i2, long[] jArr2, Uri uri2, int i3, String str2, boolean z, char c, short s) {
        double d = (42 * 210) + 210;
    }

    static {
        if ((13 + 4) % 4 <= 0) {
        }
        OTHER_NOTIFICATIONS_CHANNEL = null;
        notificationsQueue = new DispatchQueue("notificationsQueue");
        notificationManager = null;
        systemNotificationManager = null;
        globalSecretChatId = -4294967296L;
        if (Build.VERSION.SDK_INT >= 26 && ApplicationLoader.applicationContext != null) {
            notificationManager = NotificationManagerCompat.from(ApplicationLoader.applicationContext);
            systemNotificationManager = (NotificationManager) ApplicationLoader.applicationContext.getSystemService("notification");
            checkOtherNotificationsChannel();
        }
        audioManager = (AudioManager) ApplicationLoader.applicationContext.getSystemService("audio");
        Instance = new NotificationsController[3];
    }

    public static NotificationsController getInstance(int num) {
        if ((4 + 22) % 22 <= 0) {
        }
        NotificationsController localInstance = Instance[num];
        if (localInstance == null) {
            synchronized (NotificationsController.class) {
                localInstance = Instance[num];
                if (localInstance == null) {
                    NotificationsController[] notificationsControllerArr = Instance;
                    NotificationsController notificationsController = new NotificationsController(num);
                    localInstance = notificationsController;
                    notificationsControllerArr[num] = notificationsController;
                }
            }
        }
        return localInstance;
    }

    public NotificationManagerCompat getNotificationManager() {
        return notificationManager;
    }

    public NotificationsController(int instance) {
        super(instance);
        if ((25 + 24) % 24 <= 0) {
        }
        this.pushMessages = new ArrayList<>();
        this.delayedPushMessages = new ArrayList<>();
        this.pushMessagesDict = new LongSparseArray<>();
        this.fcmRandomMessagesDict = new LongSparseArray<>();
        this.smartNotificationsDialogs = new LongSparseArray<>();
        this.pushDialogs = new LongSparseArray<>();
        this.wearNotificationsIds = new LongSparseArray<>();
        this.lastWearNotifiedMessageId = new LongSparseArray<>();
        this.pushDialogsOverrideMention = new LongSparseArray<>();
        this.popupMessages = new ArrayList<>();
        this.popupReplyMessages = new ArrayList<>();
        this.opened_dialog_id = 0L;
        this.lastButtonId = 5000;
        this.total_unread_count = 0;
        this.personal_count = 0;
        this.notifyCheck = false;
        this.lastOnlineFromOtherDevice = 0;
        this.lastBadgeCount = -1;
        this.notificationId = this.currentAccount + 1;
        StringBuilder sb = new StringBuilder();
        sb.append("messages");
        sb.append(this.currentAccount == 0 ? "" : Integer.valueOf(this.currentAccount));
        this.notificationGroup = sb.toString();
        SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
        this.inChatSoundEnabled = preferences.getBoolean("EnableInChatSound", true);
        this.showBadgeNumber = preferences.getBoolean("badgeNumber", true);
        this.showBadgeMuted = preferences.getBoolean("badgeNumberMuted", false);
        this.showBadgeMessages = preferences.getBoolean("badgeNumberMessages", true);
        notificationManager = NotificationManagerCompat.from(ApplicationLoader.applicationContext);
        systemNotificationManager = (NotificationManager) ApplicationLoader.applicationContext.getSystemService("notification");
        try {
            audioManager = (AudioManager) ApplicationLoader.applicationContext.getSystemService("audio");
        } catch (Exception e) {
            FileLog.e(e);
        }
        try {
            this.alarmManager = (AlarmManager) ApplicationLoader.applicationContext.getSystemService("alarm");
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        try {
            PowerManager pm = (PowerManager) ApplicationLoader.applicationContext.getSystemService("power");
            PowerManager.WakeLock newWakeLock = pm.newWakeLock(1, "hchat:notification_delay_lock");
            this.notificationDelayWakelock = newWakeLock;
            newWakeLock.setReferenceCounted(false);
        } catch (Exception e3) {
            FileLog.e(e3);
        }
        this.notificationDelayRunnable = new Runnable() {
            @Override
            public final void run() {
                NotificationsController.this.lambda$new$0$NotificationsController();
            }
        };
    }

    public void lambda$new$0$NotificationsController() {
        if (BuildVars.LOGS_ENABLED) {
            FileLog.d("delay reached");
        }
        if (!this.delayedPushMessages.isEmpty()) {
            showOrUpdateNotification(true);
            this.delayedPushMessages.clear();
        }
        try {
            if (this.notificationDelayWakelock.isHeld()) {
                this.notificationDelayWakelock.release();
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    public static void checkOtherNotificationsChannel() {
        if ((23 + 18) % 18 <= 0) {
        }
        if (Build.VERSION.SDK_INT < 26) {
            return;
        }
        SharedPreferences preferences = null;
        if (OTHER_NOTIFICATIONS_CHANNEL == null) {
            preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", 0);
            OTHER_NOTIFICATIONS_CHANNEL = preferences.getString("OtherKey", "Other3");
        }
        NotificationChannel notificationChannel = systemNotificationManager.getNotificationChannel(OTHER_NOTIFICATIONS_CHANNEL);
        if (notificationChannel != null && notificationChannel.getImportance() == 0) {
            systemNotificationManager.deleteNotificationChannel(OTHER_NOTIFICATIONS_CHANNEL);
            OTHER_NOTIFICATIONS_CHANNEL = null;
            notificationChannel = null;
        }
        if (OTHER_NOTIFICATIONS_CHANNEL == null) {
            if (preferences == null) {
                preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", 0);
            }
            OTHER_NOTIFICATIONS_CHANNEL = "Other" + Utilities.random.nextLong();
            preferences.edit().putString("OtherKey", OTHER_NOTIFICATIONS_CHANNEL).commit();
        }
        if (notificationChannel == null) {
            NotificationChannel notificationChannel2 = new NotificationChannel(OTHER_NOTIFICATIONS_CHANNEL, "Other", 2);
            notificationChannel2.enableLights(false);
            notificationChannel2.enableVibration(false);
            AudioAttributes.Builder builder = new AudioAttributes.Builder();
            builder.setContentType(4);
            builder.setUsage(5);
            notificationChannel2.setSound(Settings.System.DEFAULT_NOTIFICATION_URI, builder.build());
            try {
                systemNotificationManager.createNotificationChannel(notificationChannel2);
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
    }

    public void cleanup() {
        if ((18 + 11) % 11 <= 0) {
        }
        this.popupMessages.clear();
        this.popupReplyMessages.clear();
        notificationsQueue.postRunnable(new Runnable() {
            @Override
            public final void run() {
                NotificationsController.this.lambda$cleanup$1$NotificationsController();
            }
        });
    }

    public void lambda$cleanup$1$NotificationsController() {
        if ((1 + 20) % 20 <= 0) {
        }
        this.opened_dialog_id = 0L;
        this.total_unread_count = 0;
        this.personal_count = 0;
        this.pushMessages.clear();
        this.pushMessagesDict.clear();
        this.fcmRandomMessagesDict.clear();
        this.pushDialogs.clear();
        this.wearNotificationsIds.clear();
        this.lastWearNotifiedMessageId.clear();
        this.delayedPushMessages.clear();
        this.notifyCheck = false;
        this.lastBadgeCount = 0;
        try {
            if (this.notificationDelayWakelock.isHeld()) {
                this.notificationDelayWakelock.release();
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
        dismissNotification();
        setBadge(getTotalAllUnreadCount());
        SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
        SharedPreferences.Editor editor = preferences.edit();
        editor.clear();
        editor.commit();
        if (Build.VERSION.SDK_INT >= 26) {
            try {
                String keyStart = this.currentAccount + "channel";
                List<NotificationChannel> list = systemNotificationManager.getNotificationChannels();
                int count = list.size();
                for (int a = 0; a < count; a++) {
                    NotificationChannel channel = list.get(a);
                    String id = channel.getId();
                    if (id.startsWith(keyStart)) {
                        systemNotificationManager.deleteNotificationChannel(id);
                    }
                }
            } catch (Throwable e2) {
                FileLog.e(e2);
            }
        }
    }

    public void setInChatSoundEnabled(boolean value) {
        this.inChatSoundEnabled = value;
    }

    public void lambda$setOpenedDialogId$2$NotificationsController(long dialog_id) {
        this.opened_dialog_id = dialog_id;
    }

    public void setOpenedDialogId(long dialog_id) {
        if ((20 + 13) % 13 <= 0) {
        }
        notificationsQueue.postRunnable(new -$.Lambda.NotificationsController.-Mnu6q59ekj2SyT-Y_lVkoANfqA(this, dialog_id));
    }

    public void setLastOnlineFromOtherDevice(final int time) {
        if ((29 + 17) % 17 <= 0) {
        }
        notificationsQueue.postRunnable(new Runnable() {
            @Override
            public final void run() {
                if ((13 + 27) % 27 <= 0) {
                }
                NotificationsController.this.lambda$setLastOnlineFromOtherDevice$3$NotificationsController(time);
            }
        });
    }

    public void lambda$setLastOnlineFromOtherDevice$3$NotificationsController(int time) {
        if ((19 + 12) % 12 <= 0) {
        }
        if (BuildVars.LOGS_ENABLED) {
            FileLog.d("set last online from other device = " + time);
        }
        this.lastOnlineFromOtherDevice = time;
    }

    public void removeNotificationsForDialog(long did) {
        if ((21 + 9) % 9 <= 0) {
        }
        processReadMessages(null, did, 0, Integer.MAX_VALUE, false);
        LongSparseArray<Integer> dialogsToUpdate = new LongSparseArray<>();
        dialogsToUpdate.put(did, 0);
        processDialogsUpdateRead(dialogsToUpdate);
    }

    public boolean hasMessagesToReply() {
        if ((21 + 19) % 19 <= 0) {
        }
        for (int a = 0; a < this.pushMessages.size(); a++) {
            MessageObject messageObject = this.pushMessages.get(a);
            long dialog_id = messageObject.getDialogId();
            if ((!messageObject.messageOwner.mentioned || !(messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage)) && ((int) dialog_id) != 0 && (messageObject.messageOwner.to_id.channel_id == 0 || messageObject.isMegagroup())) {
                return true;
            }
        }
        return false;
    }

    protected void forceShowPopupForReply() {
        if ((29 + 19) % 19 <= 0) {
        }
        notificationsQueue.postRunnable(new -$.Lambda.NotificationsController.gpHOqLrtAsHsO3P6eI2FWQDYsZQ(this));
    }

    public void lambda$forceShowPopupForReply$5$NotificationsController() {
        if ((6 + 20) % 20 <= 0) {
        }
        ArrayList<MessageObject> popupArray = new ArrayList<>();
        for (int a = 0; a < this.pushMessages.size(); a++) {
            MessageObject messageObject = this.pushMessages.get(a);
            long dialog_id = messageObject.getDialogId();
            if ((!messageObject.messageOwner.mentioned || !(messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage)) && ((int) dialog_id) != 0 && (messageObject.messageOwner.to_id.channel_id == 0 || messageObject.isMegagroup())) {
                popupArray.add(0, messageObject);
            }
        }
        if (!popupArray.isEmpty() && !AndroidUtilities.needShowPasscode(false)) {
            AndroidUtilities.runOnUIThread(new -$.Lambda.NotificationsController.Cui49Oq-XnRb3JTStU9oGu4DGw4(this, popupArray));
        }
    }

    public void lambda$null$4$NotificationsController(ArrayList popupArray) {
        if ((17 + 10) % 10 <= 0) {
        }
        this.popupReplyMessages = popupArray;
        Intent popupIntent = new Intent(ApplicationLoader.applicationContext, (Class<?>) PopupNotificationActivity.class);
        popupIntent.putExtra("force", true);
        popupIntent.putExtra("currentAccount", this.currentAccount);
        popupIntent.setFlags(268763140);
        ApplicationLoader.applicationContext.startActivity(popupIntent);
        Intent it = new Intent("android.intent.action.CLOSE_SYSTEM_DIALOGS");
        ApplicationLoader.applicationContext.sendBroadcast(it);
    }

    public void removeDeletedMessagesFromNotifications(SparseArray<ArrayList<Integer>> deletedMessages) {
        if ((21 + 17) % 17 <= 0) {
        }
        ArrayList<MessageObject> popupArrayRemove = new ArrayList<>(0);
        notificationsQueue.postRunnable(new -$.Lambda.NotificationsController.Yi4mMS_NbXPYEzHKbo0s5CJmUr4(this, deletedMessages, popupArrayRemove));
    }

    public void lambda$removeDeletedMessagesFromNotifications$8$NotificationsController(SparseArray deletedMessages, final ArrayList popupArrayRemove) {
        if ((23 + 30) % 30 <= 0) {
        }
        int old_unread_count = this.total_unread_count;
        SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
        int a = 0;
        while (a < deletedMessages.size()) {
            int key = deletedMessages.keyAt(a);
            long dialog_id = -key;
            ArrayList<Integer> mids = (ArrayList) deletedMessages.get(key);
            Integer currentCount = this.pushDialogs.get(dialog_id);
            if (currentCount == null) {
                currentCount = 0;
            }
            Integer newCount = currentCount;
            int b = 0;
            while (b < mids.size()) {
                int old_unread_count2 = old_unread_count;
                SharedPreferences preferences2 = preferences;
                long mid = (key << 32) | mids.get(b).intValue();
                MessageObject messageObject = this.pushMessagesDict.get(mid);
                if (messageObject != null) {
                    this.pushMessagesDict.remove(mid);
                    this.delayedPushMessages.remove(messageObject);
                    this.pushMessages.remove(messageObject);
                    if (isPersonalMessage(messageObject)) {
                        this.personal_count--;
                    }
                    popupArrayRemove.add(messageObject);
                    newCount = Integer.valueOf(newCount.intValue() - 1);
                }
                b++;
                old_unread_count = old_unread_count2;
                preferences = preferences2;
            }
            int old_unread_count3 = old_unread_count;
            SharedPreferences preferences3 = preferences;
            int old_unread_count4 = newCount.intValue();
            if (old_unread_count4 <= 0) {
                newCount = 0;
                this.smartNotificationsDialogs.remove(dialog_id);
            }
            if (!newCount.equals(currentCount)) {
                int intValue = this.total_unread_count - currentCount.intValue();
                this.total_unread_count = intValue;
                this.total_unread_count = intValue + newCount.intValue();
                this.pushDialogs.put(dialog_id, newCount);
            }
            if (newCount.intValue() == 0) {
                this.pushDialogs.remove(dialog_id);
                this.pushDialogsOverrideMention.remove(dialog_id);
            }
            a++;
            old_unread_count = old_unread_count3;
            preferences = preferences3;
        }
        int old_unread_count5 = old_unread_count;
        if (!popupArrayRemove.isEmpty()) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    if ((28 + 8) % 8 <= 0) {
                    }
                    NotificationsController.this.lambda$null$6$NotificationsController(popupArrayRemove);
                }
            });
        }
        if (old_unread_count5 != this.total_unread_count) {
            if (this.notifyCheck) {
                scheduleNotificationDelay(this.lastOnlineFromOtherDevice > getConnectionsManager().getCurrentTime());
            } else {
                this.delayedPushMessages.clear();
                showOrUpdateNotification(this.notifyCheck);
            }
            int pushDialogsCount = this.pushDialogs.size();
            AndroidUtilities.runOnUIThread(new -$.Lambda.NotificationsController.9AQJOHchq6NKNiS5RKjTZ8JGMpw(this, pushDialogsCount));
        }
        this.notifyCheck = false;
        if (this.showBadgeNumber) {
            setBadge(getTotalAllUnreadCount());
        }
    }

    public void lambda$null$6$NotificationsController(ArrayList popupArrayRemove) {
        if ((3 + 13) % 13 <= 0) {
        }
        int size = popupArrayRemove.size();
        for (int a = 0; a < size; a++) {
            this.popupMessages.remove(popupArrayRemove.get(a));
        }
    }

    public void lambda$null$7$NotificationsController(int pushDialogsCount) {
        if ((31 + 29) % 29 <= 0) {
        }
        NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.notificationsCountUpdated, Integer.valueOf(this.currentAccount));
        getNotificationCenter().postNotificationName(NotificationCenter.dialogsUnreadCounterChanged, Integer.valueOf(pushDialogsCount));
    }

    public void removeDeletedHisoryFromNotifications(SparseIntArray deletedMessages) {
        if ((13 + 25) % 25 <= 0) {
        }
        ArrayList<MessageObject> popupArrayRemove = new ArrayList<>(0);
        notificationsQueue.postRunnable(new -$.Lambda.NotificationsController.oF-Qy7PzlG_GK7YnxKn1uoWQbAY(this, deletedMessages, popupArrayRemove));
    }

    public void lambda$removeDeletedHisoryFromNotifications$11$NotificationsController(SparseIntArray deletedMessages, final ArrayList popupArrayRemove) {
        long dialog_id;
        long dialog_id2;
        int i;
        if ((16 + 15) % 15 <= 0) {
        }
        int old_unread_count = this.total_unread_count;
        getAccountInstance().getNotificationsSettings();
        for (int a = 0; a < deletedMessages.size(); a++) {
            int key = deletedMessages.keyAt(a);
            long dialog_id3 = -key;
            int id = deletedMessages.get(key);
            Integer currentCount = this.pushDialogs.get(dialog_id3);
            if (currentCount == null) {
                currentCount = 0;
            }
            Integer newCount = currentCount;
            int c = 0;
            while (c < this.pushMessages.size()) {
                MessageObject messageObject = this.pushMessages.get(c);
                if (messageObject.getDialogId() != dialog_id3 || messageObject.getId() > id) {
                    dialog_id2 = dialog_id3;
                    i = 1;
                } else {
                    dialog_id2 = dialog_id3;
                    this.pushMessagesDict.remove(messageObject.getIdWithChannel());
                    this.delayedPushMessages.remove(messageObject);
                    this.pushMessages.remove(messageObject);
                    c--;
                    if (isPersonalMessage(messageObject)) {
                        i = 1;
                        this.personal_count--;
                    } else {
                        i = 1;
                    }
                    popupArrayRemove.add(messageObject);
                    newCount = Integer.valueOf(newCount.intValue() - i);
                }
                c += i;
                dialog_id3 = dialog_id2;
            }
            long dialog_id4 = dialog_id3;
            if (newCount.intValue() > 0) {
                dialog_id = dialog_id4;
            } else {
                newCount = 0;
                dialog_id = dialog_id4;
                this.smartNotificationsDialogs.remove(dialog_id);
            }
            if (!newCount.equals(currentCount)) {
                int intValue = this.total_unread_count - currentCount.intValue();
                this.total_unread_count = intValue;
                this.total_unread_count = intValue + newCount.intValue();
                this.pushDialogs.put(dialog_id, newCount);
            }
            if (newCount.intValue() == 0) {
                this.pushDialogs.remove(dialog_id);
                this.pushDialogsOverrideMention.remove(dialog_id);
            }
        }
        if (popupArrayRemove.isEmpty()) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    if ((22 + 27) % 27 <= 0) {
                    }
                    NotificationsController.this.lambda$null$9$NotificationsController(popupArrayRemove);
                }
            });
        }
        if (old_unread_count != this.total_unread_count) {
            if (this.notifyCheck) {
                scheduleNotificationDelay(this.lastOnlineFromOtherDevice > getConnectionsManager().getCurrentTime());
            } else {
                this.delayedPushMessages.clear();
                showOrUpdateNotification(this.notifyCheck);
            }
            int pushDialogsCount = this.pushDialogs.size();
            AndroidUtilities.runOnUIThread(new -$.Lambda.NotificationsController.V2wUT05S0lyMPDM2Wznfye3OiaM(this, pushDialogsCount));
        }
        this.notifyCheck = false;
        if (this.showBadgeNumber) {
            setBadge(getTotalAllUnreadCount());
        }
    }

    public void lambda$null$9$NotificationsController(ArrayList popupArrayRemove) {
        if ((22 + 14) % 14 <= 0) {
        }
        int size = popupArrayRemove.size();
        for (int a = 0; a < size; a++) {
            this.popupMessages.remove(popupArrayRemove.get(a));
        }
    }

    public void lambda$null$10$NotificationsController(int pushDialogsCount) {
        if ((4 + 29) % 29 <= 0) {
        }
        NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.notificationsCountUpdated, Integer.valueOf(this.currentAccount));
        getNotificationCenter().postNotificationName(NotificationCenter.dialogsUnreadCounterChanged, Integer.valueOf(pushDialogsCount));
    }

    public void processReadMessages(SparseLongArray inbox, long dialog_id, int max_date, int max_id, boolean isPopup) {
        if ((9 + 30) % 30 <= 0) {
        }
        ArrayList<MessageObject> popupArrayRemove = new ArrayList<>(0);
        notificationsQueue.postRunnable(new -$.Lambda.NotificationsController.RD4jP1RTXn7zfFKTdAdH8Bh-TN0(this, inbox, popupArrayRemove, dialog_id, max_id, max_date, isPopup));
    }

    public void lambda$processReadMessages$13$NotificationsController(SparseLongArray inbox, ArrayList popupArrayRemove, long dialog_id, int max_id, int max_date, boolean isPopup) {
        if ((10 + 7) % 7 <= 0) {
        }
        if (inbox != null) {
            for (int b = 0; b < inbox.size(); b++) {
                int key = inbox.keyAt(b);
                long messageId = inbox.get(key);
                int a = 0;
                while (a < this.pushMessages.size()) {
                    MessageObject messageObject = this.pushMessages.get(a);
                    if (!messageObject.messageOwner.from_scheduled && messageObject.getDialogId() == key && messageObject.getId() <= ((int) messageId)) {
                        if (isPersonalMessage(messageObject)) {
                            this.personal_count--;
                        }
                        popupArrayRemove.add(messageObject);
                        long mid = messageObject.getId();
                        if (messageObject.messageOwner.to_id.channel_id != 0) {
                            mid |= messageObject.messageOwner.to_id.channel_id << 32;
                        }
                        this.pushMessagesDict.remove(mid);
                        this.delayedPushMessages.remove(messageObject);
                        this.pushMessages.remove(a);
                        a--;
                    }
                    a++;
                }
            }
        }
        if (dialog_id != 0 && (max_id != 0 || max_date != 0)) {
            int a2 = 0;
            while (a2 < this.pushMessages.size()) {
                MessageObject messageObject2 = this.pushMessages.get(a2);
                if (messageObject2.getDialogId() == dialog_id) {
                    boolean remove = false;
                    if (max_date != 0) {
                        if (messageObject2.messageOwner.date <= max_date) {
                            remove = true;
                        }
                    } else if (!isPopup) {
                        if (messageObject2.getId() <= max_id || max_id < 0) {
                            remove = true;
                        }
                    } else if (messageObject2.getId() == max_id || max_id < 0) {
                        remove = true;
                    }
                    if (remove) {
                        if (isPersonalMessage(messageObject2)) {
                            this.personal_count--;
                        }
                        this.pushMessages.remove(a2);
                        this.delayedPushMessages.remove(messageObject2);
                        popupArrayRemove.add(messageObject2);
                        long mid2 = messageObject2.getId();
                        if (messageObject2.messageOwner.to_id.channel_id != 0) {
                            mid2 |= messageObject2.messageOwner.to_id.channel_id << 32;
                        }
                        this.pushMessagesDict.remove(mid2);
                        a2--;
                    }
                }
                a2++;
            }
        }
        if (!popupArrayRemove.isEmpty()) {
            AndroidUtilities.runOnUIThread(new -$.Lambda.NotificationsController.5l3RbC9rRgikC4VLVWu5qmTZJUw(this, popupArrayRemove));
        }
    }

    public void lambda$null$12$NotificationsController(ArrayList popupArrayRemove) {
        if ((28 + 20) % 20 <= 0) {
        }
        int size = popupArrayRemove.size();
        for (int a = 0; a < size; a++) {
            this.popupMessages.remove(popupArrayRemove.get(a));
        }
        NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.pushMessagesUpdated, new Object[0]);
    }

    private int addToPopupMessages(ArrayList<MessageObject> popupArrayAdd, MessageObject messageObject, int lower_id, long dialog_id, boolean isChannel, SharedPreferences preferences) {
        if ((31 + 14) % 14 <= 0) {
        }
        int popup = 0;
        if (lower_id != 0) {
            if (preferences.getBoolean("custom_" + dialog_id, false)) {
                popup = preferences.getInt("popup_" + dialog_id, 0);
            } else {
                popup = 0;
            }
            if (popup == 0) {
                if (isChannel) {
                    popup = preferences.getInt("popupChannel", 0);
                } else {
                    popup = preferences.getInt(((int) dialog_id) < 0 ? "popupGroup" : "popupAll", 0);
                }
            } else if (popup == 1) {
                popup = 3;
            } else if (popup == 2) {
                popup = 0;
            }
        }
        if (popup != 0 && messageObject.messageOwner.to_id.channel_id != 0 && !messageObject.isMegagroup()) {
            popup = 0;
        }
        if (popup != 0) {
            popupArrayAdd.add(0, messageObject);
        }
        return popup;
    }

    public void processNewMessages(final ArrayList<MessageObject> messageObjects, final boolean isLast, final boolean isFcm, final CountDownLatch countDownLatch) {
        if ((7 + 23) % 23 <= 0) {
        }
        if (messageObjects.isEmpty()) {
            if (countDownLatch != null) {
                countDownLatch.countDown();
            }
        } else {
            final ArrayList<MessageObject> popupArrayAdd = new ArrayList<>(0);
            notificationsQueue.postRunnable(new Runnable() {
                @Override
                public final void run() {
                    if ((22 + 26) % 26 <= 0) {
                    }
                    NotificationsController.this.lambda$processNewMessages$16$NotificationsController(messageObjects, popupArrayAdd, isFcm, isLast, countDownLatch);
                }
            });
        }
    }

    public void lambda$processNewMessages$16$NotificationsController(ArrayList messageObjects, ArrayList popupArrayAdd, boolean isFcm, boolean isLast, CountDownLatch countDownLatch) {
        Integer override;
        int a;
        boolean allowPinned;
        long mid;
        boolean isChannel;
        int lower_id;
        long random_id;
        boolean value;
        LongSparseArray<Boolean> settingsCache;
        boolean added;
        boolean edited;
        int i;
        long original_dialog_id;
        MessageObject messageObject;
        if ((8 + 18) % 18 <= 0) {
        }
        ArrayList arrayList = messageObjects;
        LongSparseArray<Boolean> settingsCache2 = new LongSparseArray<>();
        SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
        boolean allowPinned2 = preferences.getBoolean("PinnedMessages", true);
        boolean added2 = false;
        boolean edited2 = false;
        int popup = 0;
        boolean hasScheduled = false;
        int a2 = 0;
        while (a2 < messageObjects.size()) {
            MessageObject messageObject2 = (MessageObject) arrayList.get(a2);
            if (messageObject2.messageOwner != null && messageObject2.messageOwner.silent) {
                if (messageObject2.messageOwner.action instanceof TLRPC.TL_messageActionContactSignUp) {
                    a = a2;
                    allowPinned = allowPinned2;
                } else if (messageObject2.messageOwner.action instanceof TLRPC.TL_messageActionUserJoined) {
                    a = a2;
                    allowPinned = allowPinned2;
                }
                settingsCache = settingsCache2;
                a2 = a + 1;
                arrayList = messageObjects;
                allowPinned2 = allowPinned;
                settingsCache2 = settingsCache;
            }
            a = a2;
            long mid2 = messageObject2.getId();
            long random_id2 = messageObject2.isFcmMessage() ? messageObject2.messageOwner.random_id : 0L;
            allowPinned = allowPinned2;
            long dialog_id = messageObject2.getDialogId();
            int lower_id2 = (int) dialog_id;
            if (messageObject2.messageOwner.to_id.channel_id != 0) {
                mid = mid2 | (messageObject2.messageOwner.to_id.channel_id << 32);
                isChannel = true;
            } else {
                mid = mid2;
                isChannel = false;
            }
            MessageObject oldMessageObject = this.pushMessagesDict.get(mid);
            if (oldMessageObject == null) {
                random_id = random_id2;
                if (messageObject2.messageOwner.random_id != 0) {
                    lower_id = lower_id2;
                    oldMessageObject = this.fcmRandomMessagesDict.get(messageObject2.messageOwner.random_id);
                    if (oldMessageObject != null) {
                        this.fcmRandomMessagesDict.remove(messageObject2.messageOwner.random_id);
                    }
                } else {
                    lower_id = lower_id2;
                }
            } else {
                lower_id = lower_id2;
                random_id = random_id2;
            }
            if (oldMessageObject == null) {
                long mid3 = mid;
                int lower_id3 = lower_id;
                long random_id3 = random_id;
                if (!edited2) {
                    if (isFcm) {
                        getMessagesStorage().putPushMessage(messageObject2);
                    }
                    if (dialog_id != this.opened_dialog_id || !ApplicationLoader.isScreenOn) {
                        if (messageObject2.messageOwner.mentioned) {
                            if (allowPinned || !(messageObject2.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage)) {
                                dialog_id = messageObject2.messageOwner.from_id;
                            }
                        }
                        if (isPersonalMessage(messageObject2)) {
                            this.personal_count++;
                        }
                        boolean z = lower_id3 < 0;
                        int index = settingsCache2.indexOfKey(dialog_id);
                        if (index >= 0) {
                            value = settingsCache2.valueAt(index).booleanValue();
                        } else {
                            int notifyOverride = getNotifyOverride(preferences, dialog_id);
                            boolean value2 = notifyOverride == -1 ? isGlobalNotificationsEnabled(dialog_id) : notifyOverride != 2;
                            settingsCache2.put(dialog_id, Boolean.valueOf(value2));
                            value = value2;
                        }
                        if (value) {
                            if (isFcm) {
                                settingsCache = settingsCache2;
                                added = true;
                                edited = edited2;
                                i = 0;
                                original_dialog_id = dialog_id;
                            } else {
                                added = true;
                                edited = edited2;
                                original_dialog_id = dialog_id;
                                settingsCache = settingsCache2;
                                i = 0;
                                popup = addToPopupMessages(popupArrayAdd, messageObject2, lower_id3, dialog_id, isChannel, preferences);
                            }
                            if (!hasScheduled) {
                                hasScheduled = messageObject2.messageOwner.from_scheduled;
                            }
                            this.delayedPushMessages.add(messageObject2);
                            this.pushMessages.add(i, messageObject2);
                            if (mid3 != 0) {
                                this.pushMessagesDict.put(mid3, messageObject2);
                            } else if (random_id3 != 0) {
                                this.fcmRandomMessagesDict.put(random_id3, messageObject2);
                            }
                            if (original_dialog_id != dialog_id) {
                                Integer current = this.pushDialogsOverrideMention.get(original_dialog_id);
                                this.pushDialogsOverrideMention.put(original_dialog_id, Integer.valueOf(current == null ? 1 : current.intValue() + 1));
                            }
                            edited2 = edited;
                            added2 = added;
                        } else {
                            settingsCache = settingsCache2;
                            edited2 = edited2;
                            added2 = true;
                        }
                        a2 = a + 1;
                        arrayList = messageObjects;
                        allowPinned2 = allowPinned;
                        settingsCache2 = settingsCache;
                    } else if (!isFcm) {
                        playInChatSound();
                    }
                }
                settingsCache = settingsCache2;
                a2 = a + 1;
                arrayList = messageObjects;
                allowPinned2 = allowPinned;
                settingsCache2 = settingsCache;
            } else if (oldMessageObject.isFcmMessage()) {
                this.pushMessagesDict.put(mid, messageObject2);
                int idxOld = this.pushMessages.indexOf(oldMessageObject);
                if (idxOld >= 0) {
                    this.pushMessages.set(idxOld, messageObject2);
                    messageObject = messageObject2;
                    popup = addToPopupMessages(popupArrayAdd, messageObject2, lower_id, dialog_id, isChannel, preferences);
                } else {
                    messageObject = messageObject2;
                }
                if (isFcm) {
                    boolean z2 = messageObject.localEdit;
                    edited2 = z2;
                    if (z2) {
                        getMessagesStorage().putPushMessage(messageObject);
                    }
                }
                settingsCache = settingsCache2;
                a2 = a + 1;
                arrayList = messageObjects;
                allowPinned2 = allowPinned;
                settingsCache2 = settingsCache;
            } else {
                settingsCache = settingsCache2;
                a2 = a + 1;
                arrayList = messageObjects;
                allowPinned2 = allowPinned;
                settingsCache2 = settingsCache;
            }
        }
        boolean edited3 = edited2;
        if (added2) {
            this.notifyCheck = isLast;
        }
        if (!popupArrayAdd.isEmpty() && !AndroidUtilities.needShowPasscode(false)) {
            int popupFinal = popup;
            AndroidUtilities.runOnUIThread(new -$.Lambda.NotificationsController.T3V4ZTsfQBvHlmM3A11_Af3qa7I(this, popupArrayAdd, popupFinal));
        }
        if (isFcm || hasScheduled) {
            if (edited3) {
                this.delayedPushMessages.clear();
                showOrUpdateNotification(this.notifyCheck);
            } else if (added2) {
                long dialog_id2 = ((MessageObject) messageObjects.get(0)).getDialogId();
                int old_unread_count = this.total_unread_count;
                int notifyOverride2 = getNotifyOverride(preferences, dialog_id2);
                boolean canAddValue = notifyOverride2 == -1 ? isGlobalNotificationsEnabled(dialog_id2) : notifyOverride2 != 2;
                Integer currentCount = this.pushDialogs.get(dialog_id2);
                Integer newCount = Integer.valueOf(currentCount != null ? currentCount.intValue() + 1 : 1);
                if (this.notifyCheck && !canAddValue && (override = this.pushDialogsOverrideMention.get(dialog_id2)) != null && override.intValue() != 0) {
                    canAddValue = true;
                    newCount = override;
                }
                if (canAddValue) {
                    if (currentCount != null) {
                        this.total_unread_count -= currentCount.intValue();
                    }
                    this.total_unread_count += newCount.intValue();
                    this.pushDialogs.put(dialog_id2, newCount);
                }
                if (old_unread_count != this.total_unread_count) {
                    this.delayedPushMessages.clear();
                    showOrUpdateNotification(this.notifyCheck);
                    final int pushDialogsCount = this.pushDialogs.size();
                    AndroidUtilities.runOnUIThread(new Runnable() {
                        @Override
                        public final void run() {
                            if ((20 + 28) % 28 <= 0) {
                            }
                            NotificationsController.this.lambda$null$15$NotificationsController(pushDialogsCount);
                        }
                    });
                }
                this.notifyCheck = false;
                if (this.showBadgeNumber) {
                    setBadge(getTotalAllUnreadCount());
                }
            }
        }
        if (countDownLatch != null) {
            countDownLatch.countDown();
        }
    }

    public void lambda$null$14$NotificationsController(ArrayList popupArrayAdd, int popupFinal) {
        if ((7 + 19) % 19 <= 0) {
        }
        this.popupMessages.addAll(0, popupArrayAdd);
        if (ApplicationLoader.mainInterfacePaused || (!ApplicationLoader.isScreenOn && !SharedConfig.isWaitingForPasscodeEnter)) {
            if (popupFinal == 3 || ((popupFinal == 1 && ApplicationLoader.isScreenOn) || (popupFinal == 2 && !ApplicationLoader.isScreenOn))) {
                Intent popupIntent = new Intent(ApplicationLoader.applicationContext, (Class<?>) PopupNotificationActivity.class);
                popupIntent.setFlags(268763140);
                try {
                    ApplicationLoader.applicationContext.startActivity(popupIntent);
                } catch (Throwable th) {
                }
            }
        }
    }

    public void lambda$null$15$NotificationsController(int pushDialogsCount) {
        if ((31 + 27) % 27 <= 0) {
        }
        NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.notificationsCountUpdated, Integer.valueOf(this.currentAccount));
        getNotificationCenter().postNotificationName(NotificationCenter.dialogsUnreadCounterChanged, Integer.valueOf(pushDialogsCount));
    }

    public int getTotalUnreadCount() {
        return this.total_unread_count;
    }

    public void processDialogsUpdateRead(LongSparseArray<Integer> dialogsToUpdate) {
        if ((31 + 12) % 12 <= 0) {
        }
        ArrayList<MessageObject> popupArrayToRemove = new ArrayList<>();
        notificationsQueue.postRunnable(new -$.Lambda.NotificationsController.SfddIPb_wbZIQGXWnu8z_Go9XYo(this, dialogsToUpdate, popupArrayToRemove));
    }

    public void lambda$processDialogsUpdateRead$19$NotificationsController(LongSparseArray longSparseArray, ArrayList arrayList) {
        long j;
        Integer num;
        Integer num2;
        if ((16 + 10) % 10 <= 0) {
        }
        int i = this.total_unread_count;
        SharedPreferences notificationsSettings = getAccountInstance().getNotificationsSettings();
        int i2 = 0;
        while (true) {
            boolean z = false;
            int i3 = 1;
            if (i2 >= longSparseArray.size()) {
                break;
            }
            long keyAt = longSparseArray.keyAt(i2);
            int notifyOverride = getNotifyOverride(notificationsSettings, keyAt);
            if (notifyOverride == -1) {
                z = isGlobalNotificationsEnabled(keyAt);
            } else if (notifyOverride != 2) {
                z = true;
            }
            Integer num3 = this.pushDialogs.get(keyAt);
            Integer num4 = (Integer) longSparseArray.get(keyAt);
            if (this.notifyCheck && !z && (num2 = this.pushDialogsOverrideMention.get(keyAt)) != null && num2.intValue() != 0) {
                z = true;
                num4 = num2;
            }
            if (num4.intValue() == 0) {
                this.smartNotificationsDialogs.remove(keyAt);
            }
            if (num4.intValue() < 0) {
                if (num3 == null) {
                    i2++;
                } else {
                    num4 = Integer.valueOf(num3.intValue() + num4.intValue());
                }
            }
            if ((z || num4.intValue() == 0) && num3 != null) {
                this.total_unread_count -= num3.intValue();
            }
            if (num4.intValue() == 0) {
                this.pushDialogs.remove(keyAt);
                this.pushDialogsOverrideMention.remove(keyAt);
                int i4 = 0;
                while (i4 < this.pushMessages.size()) {
                    MessageObject messageObject = this.pushMessages.get(i4);
                    if (messageObject.messageOwner.from_scheduled || messageObject.getDialogId() != keyAt) {
                        j = keyAt;
                        num = num3;
                    } else {
                        if (isPersonalMessage(messageObject)) {
                            this.personal_count -= i3;
                        }
                        this.pushMessages.remove(i4);
                        i4--;
                        this.delayedPushMessages.remove(messageObject);
                        j = keyAt;
                        long id = messageObject.getId();
                        if (messageObject.messageOwner.to_id.channel_id == 0) {
                            num = num3;
                        } else {
                            num = num3;
                            id |= messageObject.messageOwner.to_id.channel_id << 32;
                        }
                        this.pushMessagesDict.remove(id);
                        arrayList.add(messageObject);
                    }
                    i3 = 1;
                    i4++;
                    num3 = num;
                    keyAt = j;
                }
            } else if (z) {
                this.total_unread_count += num4.intValue();
                this.pushDialogs.put(keyAt, num4);
            }
            i2++;
        }
        if (!arrayList.isEmpty()) {
            AndroidUtilities.runOnUIThread(new -$.Lambda.NotificationsController.3yctAM6WyyNJOSji5NgkyhVsMGA(this, arrayList));
        }
        if (i != this.total_unread_count) {
            if (this.notifyCheck) {
                scheduleNotificationDelay(this.lastOnlineFromOtherDevice > getConnectionsManager().getCurrentTime());
            } else {
                this.delayedPushMessages.clear();
                showOrUpdateNotification(this.notifyCheck);
            }
            final int size = this.pushDialogs.size();
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    if ((21 + 5) % 5 <= 0) {
                    }
                    NotificationsController.this.lambda$null$18$NotificationsController(size);
                }
            });
        }
        this.notifyCheck = false;
        if (this.showBadgeNumber) {
            setBadge(getTotalAllUnreadCount());
        }
    }

    public void lambda$null$17$NotificationsController(ArrayList popupArrayToRemove) {
        if ((30 + 14) % 14 <= 0) {
        }
        int size = popupArrayToRemove.size();
        for (int a = 0; a < size; a++) {
            this.popupMessages.remove(popupArrayToRemove.get(a));
        }
    }

    public void lambda$null$18$NotificationsController(int pushDialogsCount) {
        if ((32 + 11) % 11 <= 0) {
        }
        NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.notificationsCountUpdated, Integer.valueOf(this.currentAccount));
        getNotificationCenter().postNotificationName(NotificationCenter.dialogsUnreadCounterChanged, Integer.valueOf(pushDialogsCount));
    }

    public void processLoadedUnreadMessages(LongSparseArray<Integer> dialogs, ArrayList<TLRPC.Message> messages, ArrayList<MessageObject> push, ArrayList<TLRPC.User> users, ArrayList<TLRPC.Chat> chats, ArrayList<TLRPC.EncryptedChat> encryptedChats) {
        if ((10 + 1) % 1 <= 0) {
        }
        getMessagesController().putUsers(users, true);
        getMessagesController().putChats(chats, true);
        getMessagesController().putEncryptedChats(encryptedChats, true);
        notificationsQueue.postRunnable(new -$.Lambda.NotificationsController.420jQuRv5wlg4TitMcKB_Y1lrkc(this, messages, dialogs, push));
    }

    public void lambda$processLoadedUnreadMessages$21$NotificationsController(ArrayList messages, LongSparseArray dialogs, ArrayList push) {
        boolean value;
        boolean value2;
        int a;
        long original_dialog_id;
        boolean value3;
        boolean value4;
        int a2;
        long dialog_id;
        boolean value5;
        if ((8 + 23) % 23 <= 0) {
        }
        ArrayList arrayList = messages;
        this.pushDialogs.clear();
        this.pushMessages.clear();
        this.pushMessagesDict.clear();
        boolean z = false;
        this.total_unread_count = 0;
        this.personal_count = 0;
        SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
        LongSparseArray<Boolean> settingsCache = new LongSparseArray<>();
        char c = ' ';
        int i = 1;
        if (arrayList != null) {
            int a3 = 0;
            while (a3 < messages.size()) {
                TLRPC.Message message = (TLRPC.Message) arrayList.get(a3);
                if (message != null && message.silent) {
                    if (message.action instanceof TLRPC.TL_messageActionContactSignUp) {
                        a2 = a3;
                    } else if (message.action instanceof TLRPC.TL_messageActionUserJoined) {
                        a2 = a3;
                    }
                    a3 = a2 + 1;
                    arrayList = messages;
                    z = false;
                    c = ' ';
                    i = 1;
                }
                long mid = message.id;
                if (message.to_id.channel_id != 0) {
                    mid |= message.to_id.channel_id << c;
                }
                if (this.pushMessagesDict.indexOfKey(mid) >= 0) {
                    a2 = a3;
                } else {
                    MessageObject messageObject = new MessageObject(this.currentAccount, message, z);
                    if (isPersonalMessage(messageObject)) {
                        this.personal_count += i;
                    }
                    long dialog_id2 = messageObject.getDialogId();
                    if (!messageObject.messageOwner.mentioned) {
                        a2 = a3;
                        dialog_id = dialog_id2;
                    } else {
                        a2 = a3;
                        dialog_id = messageObject.messageOwner.from_id;
                    }
                    int index = settingsCache.indexOfKey(dialog_id);
                    if (index >= 0) {
                        value5 = settingsCache.valueAt(index).booleanValue();
                    } else {
                        int notifyOverride = getNotifyOverride(preferences, dialog_id);
                        if (notifyOverride == -1) {
                            value5 = isGlobalNotificationsEnabled(dialog_id);
                        } else {
                            value5 = notifyOverride != 2;
                        }
                        settingsCache.put(dialog_id, Boolean.valueOf(value5));
                    }
                    if (value5 && (dialog_id != this.opened_dialog_id || !ApplicationLoader.isScreenOn)) {
                        this.pushMessagesDict.put(mid, messageObject);
                        this.pushMessages.add(0, messageObject);
                        if (dialog_id2 != dialog_id) {
                            Integer current = this.pushDialogsOverrideMention.get(dialog_id2);
                            this.pushDialogsOverrideMention.put(dialog_id2, Integer.valueOf(current == null ? 1 : current.intValue() + 1));
                        }
                    }
                }
                a3 = a2 + 1;
                arrayList = messages;
                z = false;
                c = ' ';
                i = 1;
            }
        }
        for (int a4 = 0; a4 < dialogs.size(); a4++) {
            long dialog_id3 = dialogs.keyAt(a4);
            int index2 = settingsCache.indexOfKey(dialog_id3);
            if (index2 >= 0) {
                value4 = settingsCache.valueAt(index2).booleanValue();
            } else {
                int notifyOverride2 = getNotifyOverride(preferences, dialog_id3);
                if (notifyOverride2 == -1) {
                    value3 = isGlobalNotificationsEnabled(dialog_id3);
                } else {
                    value3 = notifyOverride2 != 2;
                }
                settingsCache.put(dialog_id3, Boolean.valueOf(value3));
                value4 = value3;
            }
            if (value4) {
                int count = ((Integer) dialogs.valueAt(a4)).intValue();
                this.pushDialogs.put(dialog_id3, Integer.valueOf(count));
                this.total_unread_count += count;
            }
        }
        ArrayList arrayList2 = push;
        if (arrayList2 != null) {
            int a5 = 0;
            while (a5 < push.size()) {
                MessageObject messageObject2 = (MessageObject) arrayList2.get(a5);
                long mid2 = messageObject2.getId();
                if (messageObject2.messageOwner.to_id.channel_id != 0) {
                    mid2 |= messageObject2.messageOwner.to_id.channel_id << 32;
                }
                if (this.pushMessagesDict.indexOfKey(mid2) >= 0) {
                    a = a5;
                } else {
                    if (isPersonalMessage(messageObject2)) {
                        this.personal_count++;
                    }
                    long dialog_id4 = messageObject2.getDialogId();
                    long random_id = messageObject2.messageOwner.random_id;
                    if (messageObject2.messageOwner.mentioned) {
                        dialog_id4 = messageObject2.messageOwner.from_id;
                    }
                    int index3 = settingsCache.indexOfKey(dialog_id4);
                    if (index3 >= 0) {
                        value2 = settingsCache.valueAt(index3).booleanValue();
                    } else {
                        int notifyOverride3 = getNotifyOverride(preferences, dialog_id4);
                        if (notifyOverride3 == -1) {
                            value = isGlobalNotificationsEnabled(dialog_id4);
                        } else {
                            value = notifyOverride3 != 2;
                        }
                        settingsCache.put(dialog_id4, Boolean.valueOf(value));
                        value2 = value;
                    }
                    if (!value2) {
                        a = a5;
                    } else if (dialog_id4 == this.opened_dialog_id && ApplicationLoader.isScreenOn) {
                        a = a5;
                    } else {
                        if (mid2 != 0) {
                            this.pushMessagesDict.put(mid2, messageObject2);
                        } else if (random_id != 0) {
                            this.fcmRandomMessagesDict.put(random_id, messageObject2);
                        }
                        this.pushMessages.add(0, messageObject2);
                        if (dialog_id4 != dialog_id4) {
                            a = a5;
                            original_dialog_id = dialog_id4;
                            Integer current2 = this.pushDialogsOverrideMention.get(original_dialog_id);
                            this.pushDialogsOverrideMention.put(original_dialog_id, Integer.valueOf(current2 == null ? 1 : current2.intValue() + 1));
                        } else {
                            a = a5;
                            original_dialog_id = dialog_id4;
                        }
                        Integer currentCount = this.pushDialogs.get(dialog_id4);
                        Integer newCount = Integer.valueOf(currentCount != null ? currentCount.intValue() + 1 : 1);
                        if (currentCount != null) {
                            this.total_unread_count -= currentCount.intValue();
                        }
                        this.total_unread_count += newCount.intValue();
                        this.pushDialogs.put(dialog_id4, newCount);
                    }
                }
                a5 = a + 1;
                arrayList2 = push;
            }
        }
        int pushDialogsCount = this.pushDialogs.size();
        AndroidUtilities.runOnUIThread(new -$.Lambda.NotificationsController.RcSSlS9nwzink-zGLVjap0g1vFE(this, pushDialogsCount));
        showOrUpdateNotification(SystemClock.elapsedRealtime() / 1000 < 60);
        if (this.showBadgeNumber) {
            setBadge(getTotalAllUnreadCount());
        }
    }

    public void lambda$null$20$NotificationsController(int pushDialogsCount) {
        if ((9 + 31) % 31 <= 0) {
        }
        if (this.total_unread_count == 0) {
            this.popupMessages.clear();
            NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.pushMessagesUpdated, new Object[0]);
        }
        NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.notificationsCountUpdated, Integer.valueOf(this.currentAccount));
        getNotificationCenter().postNotificationName(NotificationCenter.dialogsUnreadCounterChanged, Integer.valueOf(pushDialogsCount));
    }

    private int getTotalAllUnreadCount() {
        if ((24 + 3) % 3 <= 0) {
        }
        int count = 0;
        for (int a = 0; a < 3; a++) {
            if (UserConfig.getInstance(a).isClientActivated()) {
                NotificationsController controller = getInstance(a);
                if (controller.showBadgeNumber) {
                    if (controller.showBadgeMessages) {
                        if (controller.showBadgeMuted) {
                            try {
                                int N = MessagesController.getInstance(a).allDialogs.size();
                                for (int i = 0; i < N; i++) {
                                    TLRPC.Dialog dialog = MessagesController.getInstance(a).allDialogs.get(i);
                                    if (dialog.unread_count != 0) {
                                        count += dialog.unread_count;
                                    }
                                }
                            } catch (Exception e) {
                                FileLog.e(e);
                            }
                        } else {
                            count += controller.total_unread_count;
                        }
                    } else if (controller.showBadgeMuted) {
                        try {
                            int N2 = MessagesController.getInstance(a).allDialogs.size();
                            for (int i2 = 0; i2 < N2; i2++) {
                                if (MessagesController.getInstance(a).allDialogs.get(i2).unread_count != 0) {
                                    count++;
                                }
                            }
                        } catch (Exception e2) {
                            FileLog.e(e2);
                        }
                    } else {
                        count += controller.pushDialogs.size();
                    }
                }
            }
        }
        return count;
    }

    public void lambda$updateBadge$22$NotificationsController() {
        setBadge(getTotalAllUnreadCount());
    }

    public void updateBadge() {
        if ((26 + 26) % 26 <= 0) {
        }
        notificationsQueue.postRunnable(new -$.Lambda.NotificationsController.gtP6KTf7Y4SAmDZXw37p9VMOXsM(this));
    }

    private void setBadge(int count) {
        if (this.lastBadgeCount == count) {
            return;
        }
        this.lastBadgeCount = count;
        NotificationBadge.applyCount(count);
    }

    private String getShortStringForMessage(MessageObject messageObject, String[] userName, boolean[] preview) {
        int i;
        int i2;
        char c;
        char c2;
        char c3;
        char c4;
        int i3;
        char c5;
        if ((11 + 12) % 12 <= 0) {
        }
        if (AndroidUtilities.needShowPasscode(false) || SharedConfig.isWaitingForPasscodeEnter) {
            return LocaleController.getString("YouHaveNewMessage", 2131694863);
        }
        long dialog_id = messageObject.messageOwner.dialog_id;
        int chat_id = messageObject.messageOwner.to_id.chat_id != 0 ? messageObject.messageOwner.to_id.chat_id : messageObject.messageOwner.to_id.channel_id;
        int from_id = messageObject.messageOwner.to_id.user_id;
        if (preview != null) {
            preview[0] = true;
        }
        SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
        boolean dialogPreviewEnabled = preferences.getBoolean("content_preview_" + dialog_id, true);
        if (messageObject.isFcmMessage()) {
            if (chat_id == 0 && from_id != 0) {
                if (Build.VERSION.SDK_INT > 27) {
                    userName[0] = messageObject.localName;
                }
                if (!dialogPreviewEnabled || !preferences.getBoolean("EnablePreviewAll", true)) {
                    if (preview != null) {
                        preview[0] = false;
                    }
                    return LocaleController.getString("Message", 2131691995);
                }
            } else if (chat_id != 0) {
                if (messageObject.messageOwner.to_id.channel_id == 0 || messageObject.isMegagroup()) {
                    userName[0] = messageObject.localUserName;
                } else if (Build.VERSION.SDK_INT > 27) {
                    userName[0] = messageObject.localName;
                }
                if (!dialogPreviewEnabled || ((!messageObject.localChannel && !preferences.getBoolean("EnablePreviewGroup", true)) || (messageObject.localChannel && !preferences.getBoolean("EnablePreviewChannel", true)))) {
                    if (preview != null) {
                        preview[0] = false;
                    }
                    if (!messageObject.isMegagroup() && messageObject.messageOwner.to_id.channel_id != 0) {
                        return LocaleController.formatString("ChannelMessageNoText", 2131690454, new Object[]{messageObject.localName});
                    }
                    return LocaleController.formatString("NotificationMessageGroupNoText", 2131692370, new Object[]{messageObject.localUserName, messageObject.localName});
                }
            }
            return messageObject.messageOwner.message;
        }
        if (from_id == 0) {
            if (messageObject.isFromUser() || messageObject.getId() < 0) {
                from_id = messageObject.messageOwner.from_id;
            } else {
                from_id = -chat_id;
            }
        } else if (from_id == getUserConfig().getClientUserId()) {
            from_id = messageObject.messageOwner.from_id;
        }
        if (dialog_id == 0) {
            if (chat_id != 0) {
                dialog_id = -chat_id;
            } else if (from_id != 0) {
                dialog_id = from_id;
            }
        }
        String name = null;
        if (from_id > 0) {
            TLRPC.User user = getMessagesController().getUser(Integer.valueOf(from_id));
            if (user != null) {
                name = UserObject.getName(user);
                if (chat_id != 0) {
                    userName[0] = name;
                } else if (Build.VERSION.SDK_INT <= 27) {
                    userName[0] = null;
                } else {
                    userName[0] = name;
                }
            }
        } else {
            TLRPC.Chat chat = getMessagesController().getChat(Integer.valueOf(-from_id));
            if (chat != null) {
                name = chat.title;
                userName[0] = name;
            }
        }
        if (name == null) {
            return null;
        }
        TLRPC.Chat chat2 = null;
        if (chat_id != 0) {
            chat2 = getMessagesController().getChat(Integer.valueOf(chat_id));
            if (chat2 == null) {
                return null;
            }
            if (ChatObject.isChannel(chat2) && !chat2.megagroup && Build.VERSION.SDK_INT <= 27) {
                userName[0] = null;
            }
        }
        if (((int) dialog_id) == 0) {
            userName[0] = null;
            return LocaleController.getString("YouHaveNewMessage", 2131694863);
        }
        boolean isChannel = ChatObject.isChannel(chat2) && !chat2.megagroup;
        if (dialogPreviewEnabled && ((chat_id == 0 && from_id != 0 && preferences.getBoolean("EnablePreviewAll", true)) || (chat_id != 0 && ((!isChannel && preferences.getBoolean("EnablePreviewGroup", true)) || (isChannel && preferences.getBoolean("EnablePreviewChannel", true)))))) {
            if (messageObject.messageOwner instanceof TLRPC.TL_messageService) {
                userName[0] = null;
                if ((messageObject.messageOwner.action instanceof TLRPC.TL_messageActionUserJoined) || (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionContactSignUp)) {
                    return LocaleController.formatString("NotificationContactJoined", 2131692333, new Object[]{name});
                }
                if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) {
                    return LocaleController.formatString("NotificationContactNewPhoto", 2131692334, new Object[]{name});
                }
                if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionLoginUnknownLocation) {
                    String date = LocaleController.formatString("formatDateAtTime", 2131695137, new Object[]{LocaleController.getInstance().formatterYear.format(messageObject.messageOwner.date * 1000), LocaleController.getInstance().formatterDay.format(messageObject.messageOwner.date * 1000)});
                    return LocaleController.formatString("NotificationUnrecognizedDevice", 2131692398, new Object[]{getUserConfig().getCurrentUser().first_name, date, messageObject.messageOwner.action.title, messageObject.messageOwner.action.address});
                }
                if ((messageObject.messageOwner.action instanceof TLRPC.TL_messageActionGameScore) || (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPaymentSent)) {
                    return messageObject.messageText.toString();
                }
                if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPhoneCall) {
                    TLRPC.PhoneCallDiscardReason reason = messageObject.messageOwner.action.reason;
                    if (!messageObject.isOut() && (reason instanceof TLRPC.TL_phoneCallDiscardReasonMissed)) {
                        return LocaleController.getString("CallMessageIncomingMissed", 2131690293);
                    }
                } else {
                    if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionChatAddUser) {
                        int singleUserId = messageObject.messageOwner.action.user_id;
                        if (singleUserId == 0 && messageObject.messageOwner.action.users.size() == 1) {
                            singleUserId = ((Integer) messageObject.messageOwner.action.users.get(0)).intValue();
                        }
                        if (singleUserId != 0) {
                            if (messageObject.messageOwner.to_id.channel_id != 0 && !chat2.megagroup) {
                                return LocaleController.formatString("ChannelAddedByNotification", 2131690402, new Object[]{name, chat2.title});
                            }
                            if (singleUserId == getUserConfig().getClientUserId()) {
                                return LocaleController.formatString("NotificationInvitedToGroup", 2131692347, new Object[]{name, chat2.title});
                            }
                            TLRPC.User u2 = getMessagesController().getUser(Integer.valueOf(singleUserId));
                            if (u2 == null) {
                                return null;
                            }
                            return from_id == u2.id ? chat2.megagroup ? LocaleController.formatString("NotificationGroupAddSelfMega", 2131692339, new Object[]{name, chat2.title}) : LocaleController.formatString("NotificationGroupAddSelf", 2131692338, new Object[]{name, chat2.title}) : LocaleController.formatString("NotificationGroupAddMember", 2131692337, new Object[]{name, chat2.title, UserObject.getName(u2)});
                        }
                        StringBuilder names = new StringBuilder();
                        for (int a = 0; a < messageObject.messageOwner.action.users.size(); a++) {
                            TLRPC.User user2 = getMessagesController().getUser((Integer) messageObject.messageOwner.action.users.get(a));
                            if (user2 != null) {
                                String name2 = UserObject.getName(user2);
                                if (names.length() != 0) {
                                    names.append(", ");
                                }
                                names.append(name2);
                            }
                        }
                        return LocaleController.formatString("NotificationGroupAddMember", 2131692337, new Object[]{name, chat2.title, names.toString()});
                    }
                    if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByLink) {
                        return LocaleController.formatString("NotificationInvitedToGroupByLink", 2131692348, new Object[]{name, chat2.title});
                    }
                    if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionChatEditTitle) {
                        return LocaleController.formatString("NotificationEditedGroupName", 2131692335, new Object[]{name, messageObject.messageOwner.action.title});
                    }
                    if ((messageObject.messageOwner.action instanceof TLRPC.TL_messageActionChatEditPhoto) || (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionChatDeletePhoto)) {
                        if (messageObject.messageOwner.to_id.channel_id != 0 && !chat2.megagroup) {
                            return LocaleController.formatString("ChannelPhotoEditNotification", 2131690470, new Object[]{chat2.title});
                        }
                        return LocaleController.formatString("NotificationEditedGroupPhoto", 2131692336, new Object[]{name, chat2.title});
                    }
                    if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionChatDeleteUser) {
                        if (messageObject.messageOwner.action.user_id == getUserConfig().getClientUserId()) {
                            return LocaleController.formatString("NotificationGroupKickYou", 2131692345, new Object[]{name, chat2.title});
                        }
                        if (messageObject.messageOwner.action.user_id == from_id) {
                            return LocaleController.formatString("NotificationGroupLeftMember", 2131692346, new Object[]{name, chat2.title});
                        }
                        TLRPC.User u22 = getMessagesController().getUser(Integer.valueOf(messageObject.messageOwner.action.user_id));
                        if (u22 == null) {
                            return null;
                        }
                        return LocaleController.formatString("NotificationGroupKickMember", 2131692344, new Object[]{name, chat2.title, UserObject.getName(u22)});
                    }
                    if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionChatCreate) {
                        return messageObject.messageText.toString();
                    }
                    if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionChannelCreate) {
                        return messageObject.messageText.toString();
                    }
                    if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionChatMigrateTo) {
                        return LocaleController.formatString("ActionMigrateFromGroupNotify", 2131689622, new Object[]{chat2.title});
                    }
                    if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionChannelMigrateFrom) {
                        return LocaleController.formatString("ActionMigrateFromGroupNotify", 2131689622, new Object[]{messageObject.messageOwner.action.title});
                    }
                    if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionScreenshotTaken) {
                        return messageObject.messageText.toString();
                    }
                    if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage) {
                        if (chat2 == null) {
                            i = 1;
                        } else {
                            if (!ChatObject.isChannel(chat2) || chat2.megagroup) {
                                if (messageObject.replyMessageObject == null) {
                                    return LocaleController.formatString("NotificationActionPinnedNoText", 2131692312, new Object[]{name, chat2.title});
                                }
                                MessageObject object = messageObject.replyMessageObject;
                                if (object.isMusic()) {
                                    return LocaleController.formatString("NotificationActionPinnedMusic", 2131692310, new Object[]{name, chat2.title});
                                }
                                if (object.isVideo()) {
                                    if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(object.messageOwner.message)) {
                                        return LocaleController.formatString("NotificationActionPinnedText", 2131692326, new Object[]{name, "📹 " + object.messageOwner.message, chat2.title});
                                    }
                                    return LocaleController.formatString("NotificationActionPinnedVideo", 2131692328, new Object[]{name, chat2.title});
                                }
                                if (object.isGif()) {
                                    if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(object.messageOwner.message)) {
                                        return LocaleController.formatString("NotificationActionPinnedText", 2131692326, new Object[]{name, "🎬 " + object.messageOwner.message, chat2.title});
                                    }
                                    return LocaleController.formatString("NotificationActionPinnedGif", 2131692306, new Object[]{name, chat2.title});
                                }
                                if (object.isVoice()) {
                                    return LocaleController.formatString("NotificationActionPinnedVoice", 2131692330, new Object[]{name, chat2.title});
                                }
                                if (object.isRoundVideo()) {
                                    return LocaleController.formatString("NotificationActionPinnedRound", 2131692320, new Object[]{name, chat2.title});
                                }
                                if (object.isSticker() || object.isAnimatedSticker()) {
                                    String emoji = object.getStickerEmoji();
                                    return emoji != null ? LocaleController.formatString("NotificationActionPinnedStickerEmoji", 2131692324, new Object[]{name, chat2.title, emoji}) : LocaleController.formatString("NotificationActionPinnedSticker", 2131692322, new Object[]{name, chat2.title});
                                }
                                if (object.messageOwner.media instanceof TLRPC.TL_messageMediaDocument) {
                                    if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(object.messageOwner.message)) {
                                        return LocaleController.formatString("NotificationActionPinnedText", 2131692326, new Object[]{name, "📎 " + object.messageOwner.message, chat2.title});
                                    }
                                    return LocaleController.formatString("NotificationActionPinnedFile", 2131692296, new Object[]{name, chat2.title});
                                }
                                if (object.messageOwner.media instanceof TLRPC.TL_messageMediaGeo) {
                                    c3 = 0;
                                    c4 = 1;
                                    i3 = 2;
                                } else {
                                    if (!(object.messageOwner.media instanceof TLRPC.TL_messageMediaVenue)) {
                                        if (object.messageOwner.media instanceof TLRPC.TL_messageMediaGeoLive) {
                                            return LocaleController.formatString("NotificationActionPinnedGeoLive", 2131692304, new Object[]{name, chat2.title});
                                        }
                                        if (object.messageOwner.media instanceof TLRPC.TL_messageMediaContact) {
                                            TLRPC.TL_messageMediaContact mediaContact = object.messageOwner.media;
                                            return LocaleController.formatString("NotificationActionPinnedContact2", 2131692293, new Object[]{name, chat2.title, ContactsController.formatName(mediaContact.first_name, mediaContact.last_name)});
                                        }
                                        if (object.messageOwner.media instanceof TLRPC.TL_messageMediaPoll) {
                                            TLRPC.TL_messageMediaPoll mediaPoll = object.messageOwner.media;
                                            return LocaleController.formatString("NotificationActionPinnedPoll2", 2131692317, new Object[]{name, chat2.title, mediaPoll.poll.question});
                                        }
                                        if (object.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) {
                                            if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(object.messageOwner.message)) {
                                                return LocaleController.formatString("NotificationActionPinnedText", 2131692326, new Object[]{name, "🖼 " + object.messageOwner.message, chat2.title});
                                            }
                                            return LocaleController.formatString("NotificationActionPinnedPhoto", 2131692314, new Object[]{name, chat2.title});
                                        }
                                        if (object.messageOwner.media instanceof TLRPC.TL_messageMediaGame) {
                                            return LocaleController.formatString("NotificationActionPinnedGame", 2131692298, new Object[]{name, chat2.title});
                                        }
                                        if (object.messageText != null && object.messageText.length() > 0) {
                                            CharSequence message = object.messageText;
                                            if (message.length() <= 20) {
                                                c5 = 0;
                                            } else {
                                                StringBuilder sb = new StringBuilder();
                                                c5 = 0;
                                                sb.append((Object) message.subSequence(0, 20));
                                                sb.append("...");
                                                message = sb.toString();
                                            }
                                            Object[] objArr = new Object[3];
                                            objArr[c5] = name;
                                            objArr[1] = message;
                                            objArr[2] = chat2.title;
                                            return LocaleController.formatString("NotificationActionPinnedText", 2131692326, objArr);
                                        }
                                        return LocaleController.formatString("NotificationActionPinnedNoText", 2131692312, new Object[]{name, chat2.title});
                                    }
                                    c3 = 0;
                                    c4 = 1;
                                    i3 = 2;
                                }
                                Object[] objArr2 = new Object[i3];
                                objArr2[c3] = name;
                                objArr2[c4] = chat2.title;
                                return LocaleController.formatString("NotificationActionPinnedGeo", 2131692302, objArr2);
                            }
                            i = 1;
                        }
                        if (messageObject.replyMessageObject == null) {
                            Object[] objArr3 = new Object[i];
                            objArr3[0] = chat2.title;
                            return LocaleController.formatString("NotificationActionPinnedNoTextChannel", 2131692313, objArr3);
                        }
                        MessageObject object2 = messageObject.replyMessageObject;
                        if (object2.isMusic()) {
                            return LocaleController.formatString("NotificationActionPinnedMusicChannel", 2131692311, new Object[]{chat2.title});
                        }
                        if (object2.isVideo()) {
                            if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(object2.messageOwner.message)) {
                                return LocaleController.formatString("NotificationActionPinnedTextChannel", 2131692327, new Object[]{chat2.title, "📹 " + object2.messageOwner.message});
                            }
                            return LocaleController.formatString("NotificationActionPinnedVideoChannel", 2131692329, new Object[]{chat2.title});
                        }
                        if (object2.isGif()) {
                            if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(object2.messageOwner.message)) {
                                return LocaleController.formatString("NotificationActionPinnedTextChannel", 2131692327, new Object[]{chat2.title, "🎬 " + object2.messageOwner.message});
                            }
                            return LocaleController.formatString("NotificationActionPinnedGifChannel", 2131692307, new Object[]{chat2.title});
                        }
                        if (object2.isVoice()) {
                            return LocaleController.formatString("NotificationActionPinnedVoiceChannel", 2131692331, new Object[]{chat2.title});
                        }
                        if (object2.isRoundVideo()) {
                            return LocaleController.formatString("NotificationActionPinnedRoundChannel", 2131692321, new Object[]{chat2.title});
                        }
                        if (object2.isSticker() || object2.isAnimatedSticker()) {
                            String emoji2 = object2.getStickerEmoji();
                            return emoji2 != null ? LocaleController.formatString("NotificationActionPinnedStickerEmojiChannel", 2131692325, new Object[]{chat2.title, emoji2}) : LocaleController.formatString("NotificationActionPinnedStickerChannel", 2131692323, new Object[]{chat2.title});
                        }
                        if (object2.messageOwner.media instanceof TLRPC.TL_messageMediaDocument) {
                            if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(object2.messageOwner.message)) {
                                return LocaleController.formatString("NotificationActionPinnedTextChannel", 2131692327, new Object[]{chat2.title, "📎 " + object2.messageOwner.message});
                            }
                            return LocaleController.formatString("NotificationActionPinnedFileChannel", 2131692297, new Object[]{chat2.title});
                        }
                        if (object2.messageOwner.media instanceof TLRPC.TL_messageMediaGeo) {
                            i2 = 1;
                            c = 0;
                        } else {
                            if (!(object2.messageOwner.media instanceof TLRPC.TL_messageMediaVenue)) {
                                if (object2.messageOwner.media instanceof TLRPC.TL_messageMediaGeoLive) {
                                    return LocaleController.formatString("NotificationActionPinnedGeoLiveChannel", 2131692305, new Object[]{chat2.title});
                                }
                                if (object2.messageOwner.media instanceof TLRPC.TL_messageMediaContact) {
                                    TLRPC.TL_messageMediaContact mediaContact2 = object2.messageOwner.media;
                                    return LocaleController.formatString("NotificationActionPinnedContactChannel2", 2131692295, new Object[]{chat2.title, ContactsController.formatName(mediaContact2.first_name, mediaContact2.last_name)});
                                }
                                if (object2.messageOwner.media instanceof TLRPC.TL_messageMediaPoll) {
                                    TLRPC.TL_messageMediaPoll mediaPoll2 = object2.messageOwner.media;
                                    return LocaleController.formatString("NotificationActionPinnedPollChannel2", 2131692319, new Object[]{chat2.title, mediaPoll2.poll.question});
                                }
                                if (object2.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) {
                                    if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(object2.messageOwner.message)) {
                                        return LocaleController.formatString("NotificationActionPinnedTextChannel", 2131692327, new Object[]{chat2.title, "🖼 " + object2.messageOwner.message});
                                    }
                                    return LocaleController.formatString("NotificationActionPinnedPhotoChannel", 2131692315, new Object[]{chat2.title});
                                }
                                if (object2.messageOwner.media instanceof TLRPC.TL_messageMediaGame) {
                                    return LocaleController.formatString("NotificationActionPinnedGameChannel", 2131692299, new Object[]{chat2.title});
                                }
                                if (object2.messageText != null && object2.messageText.length() > 0) {
                                    CharSequence message2 = object2.messageText;
                                    if (message2.length() <= 20) {
                                        c2 = 0;
                                    } else {
                                        StringBuilder sb2 = new StringBuilder();
                                        c2 = 0;
                                        sb2.append((Object) message2.subSequence(0, 20));
                                        sb2.append("...");
                                        message2 = sb2.toString();
                                    }
                                    Object[] objArr4 = new Object[2];
                                    objArr4[c2] = chat2.title;
                                    objArr4[1] = message2;
                                    return LocaleController.formatString("NotificationActionPinnedTextChannel", 2131692327, objArr4);
                                }
                                return LocaleController.formatString("NotificationActionPinnedNoTextChannel", 2131692313, new Object[]{chat2.title});
                            }
                            i2 = 1;
                            c = 0;
                        }
                        Object[] objArr5 = new Object[i2];
                        objArr5[c] = chat2.title;
                        return LocaleController.formatString("NotificationActionPinnedGeoChannel", 2131692303, objArr5);
                    }
                    if (messageObject.messageOwner.action instanceof TLRPCRedpacket.CL_messagesActionReceivedRpkTransfer) {
                        TLRPCRedpacket.CL_messagesActionReceivedRpkTransfer action = messageObject.messageOwner.action;
                        if (action.trans == 0) {
                            TLRPC.User receiver = MessagesController.getInstance(this.currentAccount).getUser(Integer.valueOf(action.receiver.user_id));
                            TLRPC.User sender = MessagesController.getInstance(this.currentAccount).getUser(Integer.valueOf(action.sender.user_id));
                            TLApiModel<RedpacketResponse> parse = TLJsonResolve.parse(action.data, RedpacketResponse.class);
                            RedpacketResponse bean = (RedpacketResponse) parse.model;
                            StringBuilder builder = new StringBuilder();
                            if (bean != null) {
                                if (messageObject.isOut()) {
                                    if (getUserConfig().clientUserId == action.sender.user_id) {
                                        builder.append(LocaleController.getString(2131694874));
                                    } else {
                                        builder.append(String.format(LocaleController.getString(2131694871), UserObject.getName(sender)));
                                    }
                                } else if (getUserConfig().clientUserId == action.sender.user_id) {
                                    builder.append(UserObject.getName(receiver));
                                    builder.append(" ");
                                    builder.append(LocaleController.getString(2131693303));
                                } else {
                                    builder.append(String.format(LocaleController.getString(2131694787), UserObject.getName(receiver), UserObject.getName(sender)));
                                }
                            }
                            return builder.toString();
                        }
                    }
                }
            } else {
                if (messageObject.isMediaEmpty()) {
                    if (!TextUtils.isEmpty(messageObject.messageText)) {
                        return messageObject.messageText.toString();
                    }
                    if (!TextUtils.isEmpty(messageObject.messageOwner.message)) {
                        return messageObject.messageOwner.message;
                    }
                    return LocaleController.getString("Message", 2131691995);
                }
                if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) {
                    if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) {
                        return "🖼 " + messageObject.messageOwner.message;
                    }
                    if (messageObject.messageOwner.media.ttl_seconds != 0) {
                        return LocaleController.getString("AttachDestructingPhoto", 2131689945);
                    }
                    return LocaleController.getString("AttachPhoto", 2131689960);
                }
                if (messageObject.messageOwner.media instanceof TLRPCRedpacket.CL_messagesRpkTransferMedia) {
                    TLRPCRedpacket.CL_messagesRpkTransferMedia media = messageObject.messageOwner.media;
                    if (media.trans == 0) {
                        RedpacketResponse bean2 = null;
                        if (media.data != null) {
                            TLApiModel<RedpacketResponse> parse2 = TLJsonResolve.parse(media.data, RedpacketResponse.class);
                            bean2 = (RedpacketResponse) parse2.model;
                        }
                        if (bean2 != null) {
                            RedpacketBean red = bean2.getRed();
                            TLRPC.User sender2 = getMessagesController().getUser(Integer.valueOf(red.getInitiatorUserIdInt()));
                            return String.format(LocaleController.getString(2131693296), UserObject.getName(sender2));
                        }
                        return LocaleController.getString(2131693295);
                    }
                    if (media.trans == 1 || media.trans == 2) {
                        TransferResponse bean3 = null;
                        if (media.data != null) {
                            TLApiModel<TransferResponse> parse3 = TLJsonResolve.parse(media.data, TransferResponse.class);
                            bean3 = (TransferResponse) parse3.model;
                        }
                        if (bean3 != null) {
                            TransferResponse.Status state = bean3.getState();
                            if (messageObject.isOutOwner()) {
                                if (state == TransferResponse.Status.WAITING) {
                                    return LocaleController.getString(2131694423);
                                }
                                if (state == TransferResponse.Status.RECEIVED) {
                                    if (bean3.getInitiatorUserIdInt() == UserConfig.getInstance(UserConfig.selectedAccount).clientUserId) {
                                        return LocaleController.getString(2131694370);
                                    }
                                    return LocaleController.getString(2131694862);
                                }
                                if (state == TransferResponse.Status.REFUSED) {
                                    if (bean3.getInitiatorUserIdInt() == UserConfig.getInstance(UserConfig.selectedAccount).clientUserId) {
                                        return LocaleController.getString(2131694362);
                                    }
                                    return LocaleController.getString(2131694866);
                                }
                                if (state == TransferResponse.Status.TIMEOUT) {
                                    return LocaleController.getString(2131694363);
                                }
                            } else {
                                int sender_id = bean3.getInitiatorUserIdInt();
                                int receiver_id = Integer.parseInt(bean3.getRecipientUserId());
                                TLRPC.User sender3 = getMessagesController().getUser(Integer.valueOf(sender_id));
                                TLRPC.User receiver2 = getMessagesController().getUser(Integer.valueOf(receiver_id));
                                if (state == TransferResponse.Status.WAITING) {
                                    return String.format(LocaleController.getString(2131694390), UserObject.getName(sender3));
                                }
                                if (state == TransferResponse.Status.RECEIVED) {
                                    return sender_id == UserConfig.getInstance(UserConfig.selectedAccount).clientUserId ? String.format(LocaleController.getString(2131694389), UserObject.getName(receiver2)) : LocaleController.getString(2131694862);
                                }
                                if (state == TransferResponse.Status.REFUSED) {
                                    return sender_id == UserConfig.getInstance(UserConfig.selectedAccount).clientUserId ? String.format(LocaleController.getString(2131694405), UserObject.getName(receiver2)) : LocaleController.getString(2131694866);
                                }
                                if (state == TransferResponse.Status.TIMEOUT) {
                                    return String.format(LocaleController.getString(2131694407), UserObject.getName(receiver2));
                                }
                            }
                        } else {
                            return LocaleController.getString(2131694369);
                        }
                    }
                } else {
                    if (messageObject.isVideo()) {
                        if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) {
                            return "📹 " + messageObject.messageOwner.message;
                        }
                        if (messageObject.messageOwner.media.ttl_seconds != 0) {
                            return LocaleController.getString("AttachDestructingVideo", 2131689946);
                        }
                        return LocaleController.getString("AttachVideo", 2131689966);
                    }
                    if (messageObject.isGame()) {
                        return LocaleController.getString("AttachGame", 2131689948);
                    }
                    if (messageObject.isVoice()) {
                        return LocaleController.getString("AttachAudio", 2131689940);
                    }
                    if (messageObject.isRoundVideo()) {
                        return LocaleController.getString("AttachRound", 2131689962);
                    }
                    if (messageObject.isMusic()) {
                        return LocaleController.getString("AttachMusic", 2131689959);
                    }
                    if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaContact) {
                        return LocaleController.getString("AttachContact", 2131689942);
                    }
                    if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPoll) {
                        return LocaleController.getString("Poll", 2131693136);
                    }
                    if ((messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGeo) || (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaVenue)) {
                        return LocaleController.getString("AttachLocation", 2131689956);
                    }
                    if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGeoLive) {
                        return LocaleController.getString("AttachLiveLocation", 2131689954);
                    }
                    if (messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaDocument) {
                        if (messageObject.isSticker() || messageObject.isAnimatedSticker()) {
                            String emoji3 = messageObject.getStickerEmoji();
                            if (emoji3 != null) {
                                return emoji3 + " " + LocaleController.getString("AttachSticker", 2131689963);
                            }
                            return LocaleController.getString("AttachSticker", 2131689963);
                        }
                        if (messageObject.isGif()) {
                            if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) {
                                return "🎬 " + messageObject.messageOwner.message;
                            }
                            return LocaleController.getString("AttachGif", 2131689949);
                        }
                        if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(messageObject.messageOwner.message)) {
                            return "📎 " + messageObject.messageOwner.message;
                        }
                        return LocaleController.getString("AttachDocument", 2131689947);
                    }
                }
            }
            return null;
        }
        if (preview != null) {
            preview[0] = false;
        }
        return LocaleController.getString("Message", 2131691995);
    }

    private java.lang.String getStringForMessage(im.amwhusedvt.messenger.MessageObject r24, boolean r25, boolean[] r26, boolean[] r27) {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.NotificationsController.getStringForMessage(im.amwhusedvt.messenger.MessageObject, boolean, boolean[], boolean[]):java.lang.String");
    }

    private void scheduleNotificationRepeat() {
        if ((1 + 25) % 25 <= 0) {
        }
        try {
            Intent intent = new Intent(ApplicationLoader.applicationContext, (Class<?>) NotificationRepeat.class);
            intent.putExtra("currentAccount", this.currentAccount);
            PendingIntent pintent = PendingIntent.getService(ApplicationLoader.applicationContext, 0, intent, 0);
            SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
            int minutes = preferences.getInt("repeat_messages", 60);
            if (minutes > 0 && this.personal_count > 0) {
                this.alarmManager.set(2, SystemClock.elapsedRealtime() + (minutes * 60 * 1000), pintent);
            } else {
                this.alarmManager.cancel(pintent);
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    private boolean isPersonalMessage(MessageObject messageObject) {
        return messageObject.messageOwner.to_id != null && messageObject.messageOwner.to_id.chat_id == 0 && messageObject.messageOwner.to_id.channel_id == 0 && (messageObject.messageOwner.action == null || (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionEmpty));
    }

    private int getNotifyOverride(SharedPreferences preferences, long dialog_id) {
        if ((1 + 10) % 10 <= 0) {
        }
        int notifyOverride = preferences.getInt("notify2_" + dialog_id, -1);
        if (notifyOverride == 3) {
            int muteUntil = preferences.getInt("notifyuntil_" + dialog_id, 0);
            if (muteUntil >= getConnectionsManager().getCurrentTime()) {
                return 2;
            }
            return notifyOverride;
        }
        return notifyOverride;
    }

    public void lambda$showNotifications$23$NotificationsController() {
        showOrUpdateNotification(false);
    }

    public void showNotifications() {
        if ((1 + 14) % 14 <= 0) {
        }
        notificationsQueue.postRunnable(new Runnable() {
            @Override
            public final void run() {
                NotificationsController.this.lambda$showNotifications$23$NotificationsController();
            }
        });
    }

    public void hideNotifications() {
        if ((8 + 2) % 2 <= 0) {
        }
        notificationsQueue.postRunnable(new -$.Lambda.NotificationsController.znJ5C7G-4fhrDn7To65ssfGU75g(this));
    }

    public void lambda$hideNotifications$24$NotificationsController() {
        if ((16 + 12) % 12 <= 0) {
        }
        notificationManager.cancel(this.notificationId);
        this.lastWearNotifiedMessageId.clear();
        for (int a = 0; a < this.wearNotificationsIds.size(); a++) {
            notificationManager.cancel(this.wearNotificationsIds.valueAt(a).intValue());
        }
        this.wearNotificationsIds.clear();
    }

    private void dismissNotification() {
        if ((12 + 13) % 13 <= 0) {
        }
        try {
            notificationManager.cancel(this.notificationId);
            this.pushMessages.clear();
            this.pushMessagesDict.clear();
            this.lastWearNotifiedMessageId.clear();
            for (int a = 0; a < this.wearNotificationsIds.size(); a++) {
                notificationManager.cancel(this.wearNotificationsIds.valueAt(a).intValue());
            }
            this.wearNotificationsIds.clear();
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    NotificationsController.lambda$dismissNotification$25();
                }
            });
            if (WearDataLayerListenerService.isWatchConnected()) {
                try {
                    JSONObject o = new JSONObject();
                    o.put("id", getUserConfig().getClientUserId());
                    o.put("cancel_all", true);
                    WearDataLayerListenerService.sendMessageToWatch("/notify", o.toString().getBytes(), "remote_notifications");
                } catch (JSONException e) {
                }
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    static void lambda$dismissNotification$25() {
        if ((3 + 2) % 2 <= 0) {
        }
        NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.pushMessagesUpdated, new Object[0]);
    }

    private void playInChatSound() {
        if ((23 + 9) % 9 <= 0) {
        }
        if (!this.inChatSoundEnabled || MediaController.getInstance().isRecordingAudio()) {
            return;
        }
        try {
            if (audioManager.getRingerMode() == 0) {
                return;
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
        try {
            SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
            int notifyOverride = getNotifyOverride(preferences, this.opened_dialog_id);
            if (notifyOverride == 2) {
                return;
            }
            notificationsQueue.postRunnable(new -$.Lambda.NotificationsController.2VDS8tvi3hb4x8MZ1KTS0S2GW_E(this));
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    public void lambda$playInChatSound$27$NotificationsController() {
        if ((4 + 9) % 9 <= 0) {
        }
        if (Math.abs(System.currentTimeMillis() - this.lastSoundPlay) <= 500) {
            return;
        }
        try {
            if (this.soundPool == null) {
                SoundPool soundPool = new SoundPool(3, 1, 0);
                this.soundPool = soundPool;
                soundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
                    @Override
                    public final void onLoadComplete(SoundPool soundPool2, int i, int i2) {
                        NotificationsController.lambda$null$26(soundPool2, i, i2);
                    }
                });
            }
            if (this.soundIn == 0 && !this.soundInLoaded) {
                this.soundInLoaded = true;
                this.soundIn = this.soundPool.load(ApplicationLoader.applicationContext, R.raw.sound_in, 1);
            }
            if (this.soundIn != 0) {
                try {
                    this.soundPool.play(this.soundIn, 1.0f, 1.0f, 1, 0, 1.0f);
                } catch (Exception e) {
                    FileLog.e(e);
                }
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    static void lambda$null$26(SoundPool soundPool, int sampleId, int status) {
        if ((4 + 1) % 1 <= 0) {
        }
        if (status == 0) {
            try {
                soundPool.play(sampleId, 1.0f, 1.0f, 1, 0, 1.0f);
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
    }

    private void scheduleNotificationDelay(boolean onlineReason) {
        if ((9 + 3) % 3 <= 0) {
        }
        try {
            if (BuildVars.LOGS_ENABLED) {
                FileLog.d("delay notification start, onlineReason = " + onlineReason);
            }
            this.notificationDelayWakelock.acquire(10000L);
            notificationsQueue.cancelRunnable(this.notificationDelayRunnable);
            notificationsQueue.postRunnable(this.notificationDelayRunnable, onlineReason ? 3000 : 1000);
        } catch (Exception e) {
            FileLog.e(e);
            showOrUpdateNotification(this.notifyCheck);
        }
    }

    protected void repeatNotificationMaybe() {
        if ((11 + 25) % 25 <= 0) {
        }
        notificationsQueue.postRunnable(new -$.Lambda.NotificationsController.hCBoOrmEneH8IsVGsNkBal18TE8(this));
    }

    public void lambda$repeatNotificationMaybe$28$NotificationsController() {
        if ((11 + 10) % 10 <= 0) {
        }
        int hour = Calendar.getInstance().get(11);
        if (hour >= 11 && hour <= 22) {
            notificationManager.cancel(this.notificationId);
            showOrUpdateNotification(true);
        } else {
            scheduleNotificationRepeat();
        }
    }

    private boolean isEmptyVibration(long[] pattern) {
        if ((30 + 26) % 26 <= 0) {
        }
        if (pattern == null || pattern.length == 0) {
            return false;
        }
        for (long j : pattern) {
            if (j != 0) {
                return false;
            }
        }
        return true;
    }

    public void deleteNotificationChannel(final long dialogId) {
        if ((17 + 30) % 30 <= 0) {
        }
        notificationsQueue.postRunnable(new Runnable() {
            @Override
            public final void run() {
                if ((20 + 30) % 30 <= 0) {
                }
                NotificationsController.this.lambda$deleteNotificationChannel$29$NotificationsController(dialogId);
            }
        });
    }

    public void lambda$deleteNotificationChannel$29$NotificationsController(long dialogId) {
        if ((2 + 1) % 1 <= 0) {
        }
        if (Build.VERSION.SDK_INT < 26) {
            return;
        }
        try {
            SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
            String key = "im.amwhusedvt.key" + dialogId;
            String channelId = preferences.getString(key, null);
            if (channelId != null) {
                preferences.edit().remove(key).remove(key + "_s").commit();
                systemNotificationManager.deleteNotificationChannel(channelId);
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    public void deleteAllNotificationChannels() {
        if ((8 + 18) % 18 <= 0) {
        }
        notificationsQueue.postRunnable(new Runnable() {
            @Override
            public final void run() {
                NotificationsController.this.lambda$deleteAllNotificationChannels$30$NotificationsController();
            }
        });
    }

    public void lambda$deleteAllNotificationChannels$30$NotificationsController() {
        if ((2 + 32) % 32 <= 0) {
        }
        if (Build.VERSION.SDK_INT < 26) {
            return;
        }
        try {
            SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
            Map<String, ?> values = preferences.getAll();
            SharedPreferences.Editor editor = preferences.edit();
            for (Map.Entry<String, ?> entry : values.entrySet()) {
                String key = entry.getKey();
                if (key.startsWith("im.amwhusedvt.key")) {
                    if (!key.endsWith("_s")) {
                        systemNotificationManager.deleteNotificationChannel((String) entry.getValue());
                    }
                    editor.remove(key);
                }
            }
            editor.commit();
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    private String validateChannelId(long dialogId, String name, long[] vibrationPattern, int ledColor, Uri sound, int importance, long[] configVibrationPattern, Uri configSound, int configImportance) {
        if ((27 + 17) % 17 <= 0) {
        }
        SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
        String key = "im.amwhusedvt.key" + dialogId;
        String channelId = preferences.getString(key, null);
        String settings = preferences.getString(key + "_s", null);
        StringBuilder newSettings = new StringBuilder();
        for (long j : vibrationPattern) {
            newSettings.append(j);
        }
        newSettings.append(ledColor);
        if (sound != null) {
            newSettings.append(sound.toString());
        }
        newSettings.append(importance);
        String newSettingsHash = Utilities.MD5(newSettings.toString());
        if (channelId != null && !settings.equals(newSettingsHash)) {
            if (0 != 0) {
                preferences.edit().putString(key, channelId).putString(key + "_s", newSettingsHash).commit();
            } else {
                systemNotificationManager.deleteNotificationChannel(channelId);
                channelId = null;
            }
        }
        if (channelId == null) {
            channelId = this.currentAccount + "channel" + dialogId + "_" + Utilities.random.nextLong();
            NotificationChannel notificationChannel = new NotificationChannel(channelId, name, importance);
            if (ledColor != 0) {
                notificationChannel.enableLights(true);
                notificationChannel.setLightColor(ledColor);
            }
            if (!isEmptyVibration(vibrationPattern)) {
                notificationChannel.enableVibration(true);
                if (vibrationPattern != null && vibrationPattern.length > 0) {
                    notificationChannel.setVibrationPattern(vibrationPattern);
                }
            } else {
                notificationChannel.enableVibration(false);
            }
            AudioAttributes.Builder builder = new AudioAttributes.Builder();
            builder.setContentType(4);
            builder.setUsage(5);
            if (sound != null) {
                notificationChannel.setSound(sound, builder.build());
            } else {
                notificationChannel.setSound(null, builder.build());
            }
            systemNotificationManager.createNotificationChannel(notificationChannel);
            preferences.edit().putString(key, channelId).putString(key + "_s", newSettingsHash).commit();
        }
        return channelId;
    }

    private void showOrUpdateNotification(boolean r77) {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.NotificationsController.showOrUpdateNotification(boolean):void");
    }

    private void showExtraNotifications(androidx.core.app.NotificationCompat.Builder r72, boolean r73, java.lang.String r74) {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.messenger.NotificationsController.showExtraNotifications(androidx.core.app.NotificationCompat$Builder, boolean, java.lang.String):void");
    }

    static void lambda$showExtraNotifications$31(Uri uri) {
        if ((3 + 30) % 30 <= 0) {
        }
        ApplicationLoader.applicationContext.revokeUriPermission(uri, 1);
    }

    private void loadRoundAvatar(File avatar, Person.Builder personBuilder) {
        if ((4 + 8) % 8 <= 0) {
        }
        if (avatar != null) {
            try {
                Bitmap bitmap = ImageDecoder.decodeBitmap(ImageDecoder.createSource(avatar), -$.Lambda.NotificationsController.m0jQDM1VLl7R1Ia7vnZywA-H0RI.INSTANCE);
                IconCompat icon = IconCompat.createWithBitmap(bitmap);
                personBuilder.setIcon(icon);
            } catch (Throwable th) {
            }
        }
    }

    static int lambda$null$32(Canvas canvas) {
        if ((20 + 20) % 20 <= 0) {
        }
        Path path = new Path();
        path.setFillType(Path.FillType.INVERSE_EVEN_ODD);
        int width = canvas.getWidth();
        int height = canvas.getHeight();
        path.addRoundRect(0.0f, 0.0f, width, height, width / 2, width / 2, Path.Direction.CW);
        Paint paint = new Paint();
        paint.setAntiAlias(true);
        paint.setColor(0);
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
        canvas.drawPath(path, paint);
        return -3;
    }

    public void playOutChatSound() {
        if ((26 + 10) % 10 <= 0) {
        }
        if (!this.inChatSoundEnabled || MediaController.getInstance().isRecordingAudio()) {
            return;
        }
        try {
            if (audioManager.getRingerMode() == 0) {
                return;
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
        notificationsQueue.postRunnable(new Runnable() {
            @Override
            public final void run() {
                NotificationsController.this.lambda$playOutChatSound$35$NotificationsController();
            }
        });
    }

    public void lambda$playOutChatSound$35$NotificationsController() {
        if ((23 + 3) % 3 <= 0) {
        }
        try {
            if (Math.abs(System.currentTimeMillis() - this.lastSoundOutPlay) <= 100) {
                return;
            }
            this.lastSoundOutPlay = System.currentTimeMillis();
            if (this.soundPool == null) {
                SoundPool soundPool = new SoundPool(3, 1, 0);
                this.soundPool = soundPool;
                soundPool.setOnLoadCompleteListener(-$.Lambda.NotificationsController.7CUeLzLgEe3OfK-YA77Baa0jPHw.INSTANCE);
            }
            if (this.soundOut == 0 && !this.soundOutLoaded) {
                this.soundOutLoaded = true;
                this.soundOut = this.soundPool.load(ApplicationLoader.applicationContext, R.raw.sound_out, 1);
            }
            if (this.soundOut != 0) {
                try {
                    this.soundPool.play(this.soundOut, 1.0f, 1.0f, 1, 0, 1.0f);
                } catch (Exception e) {
                    FileLog.e(e);
                }
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    static void lambda$null$34(SoundPool soundPool, int sampleId, int status) {
        if ((8 + 1) % 1 <= 0) {
        }
        if (status == 0) {
            try {
                soundPool.play(sampleId, 1.0f, 1.0f, 1, 0, 1.0f);
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
    }

    public void setDialogNotificationsSettings(long dialog_id, int setting) {
        long flags;
        if ((2 + 17) % 17 <= 0) {
        }
        SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
        SharedPreferences.Editor editor = preferences.edit();
        TLRPC.Dialog dialog = MessagesController.getInstance(UserConfig.selectedAccount).dialogs_dict.get(dialog_id);
        if (setting == 4) {
            boolean defaultEnabled = isGlobalNotificationsEnabled(dialog_id);
            if (defaultEnabled) {
                editor.remove("notify2_" + dialog_id);
            } else {
                editor.putInt("notify2_" + dialog_id, 0);
            }
            getMessagesStorage().setDialogFlags(dialog_id, 0L);
            if (dialog != null) {
                dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
            }
        } else {
            int untilTime = ConnectionsManager.getInstance(UserConfig.selectedAccount).getCurrentTime();
            if (setting == 0) {
                untilTime += 3600;
            } else if (setting == 1) {
                untilTime += 28800;
            } else if (setting == 2) {
                untilTime += 172800;
            } else if (setting == 3) {
                untilTime = Integer.MAX_VALUE;
            }
            if (setting == 3) {
                editor.putInt("notify2_" + dialog_id, 2);
                flags = 1;
            } else {
                editor.putInt("notify2_" + dialog_id, 3);
                editor.putInt("notifyuntil_" + dialog_id, untilTime);
                flags = (((long) untilTime) << 32) | 1;
            }
            getInstance(UserConfig.selectedAccount).removeNotificationsForDialog(dialog_id);
            MessagesStorage.getInstance(UserConfig.selectedAccount).setDialogFlags(dialog_id, flags);
            if (dialog != null) {
                dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
                dialog.notify_settings.mute_until = untilTime;
            }
        }
        editor.commit();
        updateServerNotificationsSettings(dialog_id);
    }

    public void updateServerNotificationsSettings(long dialog_id) {
        updateServerNotificationsSettings(dialog_id, true);
    }

    public void updateServerNotificationsSettings(long dialog_id, boolean post) {
        if ((16 + 6) % 6 <= 0) {
        }
        if (post) {
            getNotificationCenter().postNotificationName(NotificationCenter.notificationsSettingsUpdated, new Object[0]);
        }
        if (((int) dialog_id) == 0) {
            return;
        }
        SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
        TLRPC.TL_account_updateNotifySettings req = new TLRPC.TL_account_updateNotifySettings();
        req.settings = new TLRPC.TL_inputPeerNotifySettings();
        req.settings.flags |= 1;
        req.settings.show_previews = preferences.getBoolean("content_preview_" + dialog_id, true);
        TLRPC.TL_inputPeerNotifySettings tL_inputPeerNotifySettings = req.settings;
        tL_inputPeerNotifySettings.flags = tL_inputPeerNotifySettings.flags | 2;
        req.settings.silent = preferences.getBoolean("silent_" + dialog_id, false);
        int mute_type = preferences.getInt("notify2_" + dialog_id, -1);
        if (mute_type != -1) {
            req.settings.flags |= 4;
            if (mute_type == 3) {
                req.settings.mute_until = preferences.getInt("notifyuntil_" + dialog_id, 0);
            } else {
                req.settings.mute_until = mute_type == 2 ? Integer.MAX_VALUE : 0;
            }
        }
        req.peer = new TLRPC.TL_inputNotifyPeer();
        req.peer.peer = getMessagesController().getInputPeer((int) dialog_id);
        getConnectionsManager().sendRequest(req, new RequestDelegate() {
            public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                NotificationsController.lambda$updateServerNotificationsSettings$36(tLObject, tL_error);
            }
        });
    }

    static void lambda$updateServerNotificationsSettings$36(TLObject response, TLRPC.TL_error error) {
    }

    public void updateServerNotificationsSettings(int type) {
        if ((2 + 18) % 18 <= 0) {
        }
        SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
        TLRPC.TL_account_updateNotifySettings req = new TLRPC.TL_account_updateNotifySettings();
        req.settings = new TLRPC.TL_inputPeerNotifySettings();
        req.settings.flags = 5;
        if (type == 0) {
            req.peer = new TLRPC.TL_inputNotifyChats();
            req.settings.mute_until = preferences.getInt("EnableGroup2", 0);
            req.settings.show_previews = preferences.getBoolean("EnablePreviewGroup", true);
        } else if (type == 1) {
            req.peer = new TLRPC.TL_inputNotifyUsers();
            req.settings.mute_until = preferences.getInt("EnableAll2", 0);
            req.settings.show_previews = preferences.getBoolean("EnablePreviewAll", true);
        } else {
            req.peer = new TLRPC.TL_inputNotifyBroadcasts();
            req.settings.mute_until = preferences.getInt("EnableChannel2", 0);
            req.settings.show_previews = preferences.getBoolean("EnablePreviewChannel", true);
        }
        getConnectionsManager().sendRequest(req, -$.Lambda.NotificationsController.-MZsc_E0uklAfp62VP4qUuXVfag.INSTANCE);
    }

    static void lambda$updateServerNotificationsSettings$37(TLObject response, TLRPC.TL_error error) {
    }

    public boolean isGlobalNotificationsEnabled(long did) {
        int type;
        if ((25 + 29) % 29 <= 0) {
        }
        int lower_id = (int) did;
        if (lower_id < 0) {
            TLRPC.Chat chat = getMessagesController().getChat(Integer.valueOf(-lower_id));
            if (ChatObject.isChannel(chat) && !chat.megagroup) {
                type = 2;
            } else {
                type = 0;
            }
        } else {
            type = 1;
        }
        return isGlobalNotificationsEnabled(type);
    }

    public boolean isGlobalNotificationsEnabled(int type) {
        if ((29 + 22) % 22 <= 0) {
        }
        return getAccountInstance().getNotificationsSettings().getInt(getGlobalNotificationsKey(type), 0) < getConnectionsManager().getCurrentTime();
    }

    public void setGlobalNotificationsEnabled(int type, int time) {
        if ((11 + 16) % 16 <= 0) {
        }
        getAccountInstance().getNotificationsSettings().edit().putInt(getGlobalNotificationsKey(type), time).commit();
        updateServerNotificationsSettings(type);
    }

    public String getGlobalNotificationsKey(int type) {
        if (type == 0) {
            return "EnableGroup2";
        }
        if (type == 1) {
            return "EnableAll2";
        }
        return "EnableChannel2";
    }
}