mirror of
https://github.com/wrwrabbit/Partisan-Telegram-Android.git
synced 2026-05-05 15:41:02 +00:00
Update to 7.4.0 (2221)
This commit is contained in:
parent
d52de1a40a
commit
77bbe5baec
232 changed files with 16305 additions and 2717 deletions
|
|
@ -594,8 +594,6 @@ public class NotificationsController extends BaseController {
|
|||
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) {
|
||||
|
|
@ -2082,7 +2080,7 @@ public class NotificationsController extends BaseController {
|
|||
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionScreenshotTaken) {
|
||||
msg = messageObject.messageText.toString();
|
||||
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage) {
|
||||
if (chat != null && (!ChatObject.isChannel(chat) || chat.megagroup)) {
|
||||
if (!ChatObject.isChannel(chat) || chat.megagroup) {
|
||||
if (messageObject.replyMessageObject == null) {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedNoText", R.string.NotificationActionPinnedNoText, name, chat.title);
|
||||
} else {
|
||||
|
|
@ -2154,7 +2152,7 @@ public class NotificationsController extends BaseController {
|
|||
msg = LocaleController.formatString("NotificationActionPinnedNoText", R.string.NotificationActionPinnedNoText, name, chat.title);
|
||||
}
|
||||
}
|
||||
} else if (chat != null) {
|
||||
} else {
|
||||
if (messageObject.replyMessageObject == null) {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedNoTextChannel", R.string.NotificationActionPinnedNoTextChannel, chat.title);
|
||||
} else {
|
||||
|
|
@ -2226,78 +2224,6 @@ public class NotificationsController extends BaseController {
|
|||
msg = LocaleController.formatString("NotificationActionPinnedNoTextChannel", R.string.NotificationActionPinnedNoTextChannel, chat.title);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (messageObject.replyMessageObject == null) {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedNoTextUser", R.string.NotificationActionPinnedNoTextUser, name);
|
||||
} else {
|
||||
MessageObject object = messageObject.replyMessageObject;
|
||||
if (object.isMusic()) {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedMusicUser", R.string.NotificationActionPinnedMusicUser, name);
|
||||
} else if (object.isVideo()) {
|
||||
if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(object.messageOwner.message)) {
|
||||
String message = "\uD83D\uDCF9 " + object.messageOwner.message;
|
||||
msg = LocaleController.formatString("NotificationActionPinnedTextUser", R.string.NotificationActionPinnedTextUser, name, message);
|
||||
} else {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedVideoUser", R.string.NotificationActionPinnedVideoUser, name);
|
||||
}
|
||||
} else if (object.isGif()) {
|
||||
if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(object.messageOwner.message)) {
|
||||
String message = "\uD83C\uDFAC " + object.messageOwner.message;
|
||||
msg = LocaleController.formatString("NotificationActionPinnedTextUser", R.string.NotificationActionPinnedTextUser, name, message);
|
||||
} else {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedGifUser", R.string.NotificationActionPinnedGifUser, name);
|
||||
}
|
||||
} else if (object.isVoice()) {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedVoiceUser", R.string.NotificationActionPinnedVoiceUser, name);
|
||||
} else if (object.isRoundVideo()) {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedRoundUser", R.string.NotificationActionPinnedRoundUser, name);
|
||||
} else if (object.isSticker() || object.isAnimatedSticker()) {
|
||||
String emoji = object.getStickerEmoji();
|
||||
if (emoji != null) {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedStickerEmojiUser", R.string.NotificationActionPinnedStickerEmojiUser, name, emoji);
|
||||
} else {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedStickerUser", R.string.NotificationActionPinnedStickerUser, name);
|
||||
}
|
||||
} else if (object.messageOwner.media instanceof TLRPC.TL_messageMediaDocument) {
|
||||
if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(object.messageOwner.message)) {
|
||||
String message = "\uD83D\uDCCE " + object.messageOwner.message;
|
||||
msg = LocaleController.formatString("NotificationActionPinnedTextUser", R.string.NotificationActionPinnedTextUser, name, message);
|
||||
} else {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedFileUser", R.string.NotificationActionPinnedFileUser, name);
|
||||
}
|
||||
} else if (object.messageOwner.media instanceof TLRPC.TL_messageMediaGeo || object.messageOwner.media instanceof TLRPC.TL_messageMediaVenue) {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedGeoUser", R.string.NotificationActionPinnedGeoUser, name);
|
||||
} else if (object.messageOwner.media instanceof TLRPC.TL_messageMediaGeoLive) {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedGeoLiveUser", R.string.NotificationActionPinnedGeoLiveUser, name);
|
||||
} else if (object.messageOwner.media instanceof TLRPC.TL_messageMediaContact) {
|
||||
TLRPC.TL_messageMediaContact mediaContact = (TLRPC.TL_messageMediaContact) messageObject.messageOwner.media;
|
||||
msg = LocaleController.formatString("NotificationActionPinnedContactUser", R.string.NotificationActionPinnedContactUser, name, ContactsController.formatName(mediaContact.first_name, mediaContact.last_name));
|
||||
} else if (object.messageOwner.media instanceof TLRPC.TL_messageMediaPoll) {
|
||||
TLRPC.TL_messageMediaPoll mediaPoll = (TLRPC.TL_messageMediaPoll) object.messageOwner.media;
|
||||
if (mediaPoll.poll.quiz) {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedQuizUser", R.string.NotificationActionPinnedQuizUser, name, mediaPoll.poll.question);
|
||||
} else {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedPollUser", R.string.NotificationActionPinnedPollUser, name, mediaPoll.poll.question);
|
||||
}
|
||||
} else if (object.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) {
|
||||
if (Build.VERSION.SDK_INT >= 19 && !TextUtils.isEmpty(object.messageOwner.message)) {
|
||||
String message = "\uD83D\uDDBC " + object.messageOwner.message;
|
||||
msg = LocaleController.formatString("NotificationActionPinnedTextUser", R.string.NotificationActionPinnedTextUser, name, message);
|
||||
} else {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedPhotoUser", R.string.NotificationActionPinnedPhotoUser, name);
|
||||
}
|
||||
} else if (object.messageOwner.media instanceof TLRPC.TL_messageMediaGame) {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedGameUser", R.string.NotificationActionPinnedGameUser, name);
|
||||
} else if (object.messageText != null && object.messageText.length() > 0) {
|
||||
CharSequence message = object.messageText;
|
||||
if (message.length() > 20) {
|
||||
message = message.subSequence(0, 20) + "...";
|
||||
}
|
||||
msg = LocaleController.formatString("NotificationActionPinnedTextUser", R.string.NotificationActionPinnedTextUser, name, message);
|
||||
} else {
|
||||
msg = LocaleController.formatString("NotificationActionPinnedNoTextUser", R.string.NotificationActionPinnedNoTextUser, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionGameScore) {
|
||||
msg = messageObject.messageText.toString();
|
||||
|
|
@ -2637,85 +2563,95 @@ public class NotificationsController extends BaseController {
|
|||
deleteNotificationChannel(dialogId, -1);
|
||||
}
|
||||
|
||||
private void deleteNotificationChannelInternal(long dialogId, int what) {
|
||||
if (Build.VERSION.SDK_INT < 26) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
if (what == 0 || what == -1) {
|
||||
String key = "org.telegram.key" + dialogId;
|
||||
String channelId = preferences.getString(key, null);
|
||||
if (channelId != null) {
|
||||
editor.remove(key).remove(key + "_s");
|
||||
systemNotificationManager.deleteNotificationChannel(channelId);
|
||||
}
|
||||
}
|
||||
if (what == 1 || what == -1) {
|
||||
String key = "org.telegram.keyia" + dialogId;
|
||||
String channelId = preferences.getString(key, null);
|
||||
if (channelId != null) {
|
||||
editor.remove(key).remove(key + "_s");
|
||||
systemNotificationManager.deleteNotificationChannel(channelId);
|
||||
}
|
||||
}
|
||||
editor.commit();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteNotificationChannel(long dialogId, int what) {
|
||||
if (Build.VERSION.SDK_INT < 26) {
|
||||
return;
|
||||
}
|
||||
notificationsQueue.postRunnable(() -> {
|
||||
try {
|
||||
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
if (what == 0 || what == -1) {
|
||||
String key = "org.telegram.key" + dialogId;
|
||||
String channelId = preferences.getString(key, null);
|
||||
if (channelId != null) {
|
||||
editor.remove(key).remove(key + "_s");
|
||||
systemNotificationManager.deleteNotificationChannel(channelId);
|
||||
}
|
||||
}
|
||||
if (what == 1 || what == -1) {
|
||||
String key = "org.telegram.keyia" + dialogId;
|
||||
String channelId = preferences.getString(key, null);
|
||||
if (channelId != null) {
|
||||
editor.remove(key).remove(key + "_s");
|
||||
systemNotificationManager.deleteNotificationChannel(channelId);
|
||||
}
|
||||
}
|
||||
editor.commit();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
});
|
||||
notificationsQueue.postRunnable(() -> deleteNotificationChannelInternal(dialogId, what));
|
||||
}
|
||||
|
||||
public void deleteNotificationChannelGlobal(int type) {
|
||||
deleteNotificationChannelGlobal(type, -1);
|
||||
}
|
||||
|
||||
public void deleteNotificationChannelGlobalInternal(int type, int what) {
|
||||
if (Build.VERSION.SDK_INT < 26) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
if (what == 0 || what == -1) {
|
||||
String key;
|
||||
if (type == TYPE_CHANNEL) {
|
||||
key = "channels";
|
||||
} else if (type == TYPE_GROUP) {
|
||||
key = "groups";
|
||||
} else {
|
||||
key = "private";
|
||||
}
|
||||
String channelId = preferences.getString(key, null);
|
||||
if (channelId != null) {
|
||||
editor.remove(key).remove(key + "_s");
|
||||
systemNotificationManager.deleteNotificationChannel(channelId);
|
||||
}
|
||||
}
|
||||
|
||||
if (what == 1 || what == -1) {
|
||||
String key;
|
||||
if (type == TYPE_CHANNEL) {
|
||||
key = "channels_ia";
|
||||
} else if (type == TYPE_GROUP) {
|
||||
key = "groups_ia";
|
||||
} else {
|
||||
key = "private_ia";
|
||||
}
|
||||
String channelId = preferences.getString(key, null);
|
||||
if (channelId != null) {
|
||||
editor.remove(key).remove(key + "_s");
|
||||
systemNotificationManager.deleteNotificationChannel(channelId);
|
||||
}
|
||||
}
|
||||
editor.commit();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteNotificationChannelGlobal(int type, int what) {
|
||||
if (Build.VERSION.SDK_INT < 26) {
|
||||
return;
|
||||
}
|
||||
notificationsQueue.postRunnable(() -> {
|
||||
try {
|
||||
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
if (what == 0 || what == -1) {
|
||||
String key;
|
||||
if (type == TYPE_CHANNEL) {
|
||||
key = "channels";
|
||||
} else if (type == TYPE_GROUP) {
|
||||
key = "groups";
|
||||
} else {
|
||||
key = "private";
|
||||
}
|
||||
String channelId = preferences.getString(key, null);
|
||||
if (channelId != null) {
|
||||
editor.remove(key).remove(key + "_s");
|
||||
systemNotificationManager.deleteNotificationChannel(channelId);
|
||||
}
|
||||
}
|
||||
|
||||
if (what == 1 || what == -1) {
|
||||
String key;
|
||||
if (type == TYPE_CHANNEL) {
|
||||
key = "channels_ia";
|
||||
} else if (type == TYPE_GROUP) {
|
||||
key = "groups_ia";
|
||||
} else {
|
||||
key = "private_ia";
|
||||
}
|
||||
String channelId = preferences.getString(key, null);
|
||||
if (channelId != null) {
|
||||
editor.remove(key).remove(key + "_s");
|
||||
systemNotificationManager.deleteNotificationChannel(channelId);
|
||||
}
|
||||
}
|
||||
editor.commit();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
});
|
||||
notificationsQueue.postRunnable(() -> deleteNotificationChannelGlobalInternal(type, what));
|
||||
}
|
||||
|
||||
public void deleteAllNotificationChannels() {
|
||||
|
|
@ -2748,9 +2684,9 @@ public class NotificationsController extends BaseController {
|
|||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
private void createNotificationShortcut(NotificationCompat.Builder builder, int did, String name, TLRPC.User user, TLRPC.Chat chat, Person person) {
|
||||
private String createNotificationShortcut(NotificationCompat.Builder builder, int did, String name, TLRPC.User user, TLRPC.Chat chat, Person person) {
|
||||
if (unsupportedNotificationShortcut() || ChatObject.isChannel(chat) && !chat.megagroup) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
String id = "ndid_" + did;
|
||||
|
|
@ -2782,7 +2718,7 @@ public class NotificationsController extends BaseController {
|
|||
}
|
||||
intent.putExtra("currentAccount", currentAccount);
|
||||
bubbleBuilder.setIntent(PendingIntent.getActivity(ApplicationLoader.applicationContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT));
|
||||
bubbleBuilder.setSuppressNotification(true);
|
||||
bubbleBuilder.setSuppressNotification(opened_dialog_id == did);
|
||||
bubbleBuilder.setAutoExpandBubble(false);
|
||||
bubbleBuilder.setDesiredHeight(AndroidUtilities.dp(640));
|
||||
if (avatar != null) {
|
||||
|
|
@ -2795,9 +2731,11 @@ public class NotificationsController extends BaseController {
|
|||
}
|
||||
}
|
||||
builder.setBubbleMetadata(bubbleBuilder.build());
|
||||
return id;
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@TargetApi(26)
|
||||
|
|
@ -3650,10 +3588,7 @@ public class NotificationsController extends BaseController {
|
|||
mBuilder.addAction(R.drawable.ic_ab_reply, LocaleController.getString("Reply", R.string.Reply), PendingIntent.getBroadcast(ApplicationLoader.applicationContext, 2, replyIntent, PendingIntent.FLAG_UPDATE_CURRENT));
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
mBuilder.setChannelId(validateChannelId(dialog_id, chatName, vibrationPattern, ledColor, sound, configImportance, isDefault, isInApp, notifyDisabled, chatType));
|
||||
}
|
||||
showExtraNotifications(mBuilder, detailText);
|
||||
showExtraNotifications(mBuilder, detailText, dialog_id, chatName, vibrationPattern, ledColor, sound, configImportance, isDefault, isInApp, notifyDisabled, chatType);
|
||||
scheduleNotificationRepeat();
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
|
|
@ -3669,8 +3604,47 @@ public class NotificationsController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
private void resetNotificationSound(NotificationCompat.Builder notificationBuilder, long dialogId, String chatName, long[] vibrationPattern, int ledColor, Uri sound, int importance, boolean isDefault, boolean isInApp, boolean isSilent, int chatType) {
|
||||
Uri defaultSound = Settings.System.DEFAULT_RINGTONE_URI;
|
||||
if (defaultSound != null && sound != null && !TextUtils.equals(defaultSound.toString(), sound.toString())) {
|
||||
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
|
||||
String newSound = defaultSound.toString();
|
||||
String ringtoneName = LocaleController.getString("DefaultRingtone", R.string.DefaultRingtone);
|
||||
if (isDefault) {
|
||||
if (chatType == TYPE_CHANNEL) {
|
||||
editor.putString("ChannelSound", ringtoneName);
|
||||
} else if (chatType == TYPE_GROUP) {
|
||||
editor.putString("GroupSound", ringtoneName);
|
||||
} else {
|
||||
editor.putString("GlobalSound", ringtoneName);
|
||||
}
|
||||
if (chatType == TYPE_CHANNEL) {
|
||||
editor.putString("ChannelSoundPath", newSound);
|
||||
} else if (chatType == TYPE_GROUP) {
|
||||
editor.putString("GroupSoundPath", newSound);
|
||||
} else {
|
||||
editor.putString("GlobalSoundPath", newSound);
|
||||
}
|
||||
getNotificationsController().deleteNotificationChannelGlobalInternal(chatType, -1);
|
||||
} else {
|
||||
editor.putString("sound_" + dialogId, ringtoneName);
|
||||
editor.putString("sound_path_" + dialogId, newSound);
|
||||
deleteNotificationChannelInternal(dialogId, -1);
|
||||
}
|
||||
editor.commit();
|
||||
sound = Settings.System.DEFAULT_RINGTONE_URI;
|
||||
notificationBuilder.setChannelId(validateChannelId(dialogId, chatName, vibrationPattern, ledColor, sound, importance, isDefault, isInApp, isSilent, chatType));
|
||||
notificationManager.notify(notificationId, notificationBuilder.build());
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
private void showExtraNotifications(NotificationCompat.Builder notificationBuilder, String summary) {
|
||||
private void showExtraNotifications(NotificationCompat.Builder notificationBuilder, String summary, long dialogId, String chatName, long[] vibrationPattern, int ledColor, Uri sound, int importance, boolean isDefault, boolean isInApp, boolean isSilent, int chatType) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
notificationBuilder.setChannelId(validateChannelId(dialogId, chatName, vibrationPattern, ledColor, sound, importance, isDefault, isInApp, isSilent, chatType));
|
||||
}
|
||||
Notification mainNotification = notificationBuilder.build();
|
||||
if (Build.VERSION.SDK_INT < 18) {
|
||||
notificationManager.notify(notificationId, mainNotification);
|
||||
|
|
@ -3696,7 +3670,7 @@ public class NotificationsController extends BaseController {
|
|||
if (arrayList == null) {
|
||||
arrayList = new ArrayList<>();
|
||||
messagesByDialogs.put(dialog_id, arrayList);
|
||||
sortedDialogs.add(0, dialog_id);
|
||||
sortedDialogs.add(dialog_id);
|
||||
}
|
||||
arrayList.add(messageObject);
|
||||
}
|
||||
|
|
@ -3706,18 +3680,31 @@ public class NotificationsController extends BaseController {
|
|||
|
||||
class NotificationHolder {
|
||||
int id;
|
||||
Notification notification;
|
||||
int lowerId;
|
||||
String name;
|
||||
TLRPC.User user;
|
||||
TLRPC.Chat chat;
|
||||
NotificationCompat.Builder notification;
|
||||
|
||||
NotificationHolder(int i, Notification n) {
|
||||
NotificationHolder(int i, int li, String n, TLRPC.User u, TLRPC.Chat c, NotificationCompat.Builder builder) {
|
||||
id = i;
|
||||
notification = n;
|
||||
name = n;
|
||||
user = u;
|
||||
chat = c;
|
||||
notification = builder;
|
||||
lowerId = li;
|
||||
}
|
||||
|
||||
void call() {
|
||||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.w("show dialog notification with id " + id);
|
||||
}
|
||||
notificationManager.notify(id, notification);
|
||||
try {
|
||||
notificationManager.notify(id, notification.build());
|
||||
} catch (SecurityException e) {
|
||||
FileLog.e(e);
|
||||
resetNotificationSound(notification, dialogId, chatName, vibrationPattern, ledColor, sound, importance, isDefault, isInApp, isSilent, chatType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3727,7 +3714,7 @@ public class NotificationsController extends BaseController {
|
|||
serializedNotifications = new JSONArray();
|
||||
}
|
||||
|
||||
boolean useSummaryNotification = Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1 || Build.VERSION.SDK_INT > Build.VERSION_CODES.O_MR1 && sortedDialogs.size() > 1;
|
||||
boolean useSummaryNotification = Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1 || sortedDialogs.size() > 1;
|
||||
if (useSummaryNotification && Build.VERSION.SDK_INT >= 26) {
|
||||
checkOtherNotificationsChannel();
|
||||
}
|
||||
|
|
@ -3735,12 +3722,8 @@ public class NotificationsController extends BaseController {
|
|||
int selfUserId = getUserConfig().getClientUserId();
|
||||
boolean waitingForPasscode = AndroidUtilities.needShowPasscode() || SharedConfig.isWaitingForPasscodeEnter;
|
||||
|
||||
int maxCount;
|
||||
if (UserConfig.getActivatedAccountsCount() >= 3) {
|
||||
maxCount = 7;
|
||||
} else {
|
||||
maxCount = 10;
|
||||
}
|
||||
int maxCount = 7;
|
||||
LongSparseArray<Person> personCache = new LongSparseArray<>();
|
||||
for (int b = 0, size = sortedDialogs.size(); b < size; b++) {
|
||||
if (holders.size() >= maxCount) {
|
||||
break;
|
||||
|
|
@ -3782,7 +3765,6 @@ public class NotificationsController extends BaseController {
|
|||
Bitmap avatarBitmap = null;
|
||||
File avatalFile = null;
|
||||
boolean canReply;
|
||||
LongSparseArray<Person> personCache = new LongSparseArray<>();
|
||||
|
||||
if (lowerId != 0) {
|
||||
canReply = lowerId != 777000;
|
||||
|
|
@ -4021,7 +4003,7 @@ public class NotificationsController extends BaseController {
|
|||
File avatar = null;
|
||||
if (lowerId > 0 || isChannel) {
|
||||
avatar = avatalFile;
|
||||
} else if (lowerId < 0) {
|
||||
} else {
|
||||
int fromId = messageObject.getSenderId();
|
||||
TLRPC.User sender = getMessagesController().getUser(fromId);
|
||||
if (sender == null) {
|
||||
|
|
@ -4199,7 +4181,7 @@ public class NotificationsController extends BaseController {
|
|||
.setStyle(messagingStyle)
|
||||
.setContentIntent(contentIntent)
|
||||
.extend(wearableExtender)
|
||||
.setSortKey("" + (Long.MAX_VALUE - date))
|
||||
.setSortKey(String.valueOf(Long.MAX_VALUE - date))
|
||||
.setCategory(NotificationCompat.CATEGORY_MESSAGE);
|
||||
|
||||
Intent dismissIntent = new Intent(ApplicationLoader.applicationContext, NotificationDismissReceiver.class);
|
||||
|
|
@ -4248,11 +4230,6 @@ public class NotificationsController extends BaseController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 29) {
|
||||
if (lowerId != 0) {
|
||||
createNotificationShortcut(builder, lowerId, name, user, chat, personCache.get(lowerId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (chat == null && user != null && user.phone != null && user.phone.length() > 0) {
|
||||
|
|
@ -4262,7 +4239,7 @@ public class NotificationsController extends BaseController {
|
|||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
setNotificationChannel(mainNotification, builder, useSummaryNotification);
|
||||
}
|
||||
holders.add(new NotificationHolder(internalId, builder.build()));
|
||||
holders.add(new NotificationHolder(internalId, lowerId, name, user, chat, builder));
|
||||
wearNotificationsIds.put(dialog_id, internalId);
|
||||
|
||||
if (lowerId != 0) {
|
||||
|
|
@ -4281,7 +4258,7 @@ public class NotificationsController extends BaseController {
|
|||
}
|
||||
if (lowerId > 0) {
|
||||
serializedChat.put("type", "user");
|
||||
} else if (lowerId < 0) {
|
||||
} else {
|
||||
if (isChannel || isSupergroup) {
|
||||
serializedChat.put("type", "channel");
|
||||
} else {
|
||||
|
|
@ -4299,27 +4276,17 @@ public class NotificationsController extends BaseController {
|
|||
if (BuildVars.LOGS_ENABLED) {
|
||||
FileLog.d("show summary with id " + notificationId);
|
||||
}
|
||||
notificationManager.notify(notificationId, mainNotification);
|
||||
try {
|
||||
notificationManager.notify(notificationId, mainNotification);
|
||||
} catch (SecurityException e) {
|
||||
FileLog.e(e);
|
||||
resetNotificationSound(notificationBuilder, dialogId, chatName, vibrationPattern, ledColor, sound, importance, isDefault, isInApp, isSilent, chatType);
|
||||
}
|
||||
} else {
|
||||
if (openedInBubbleDialogs.isEmpty()) {
|
||||
notificationManager.cancel(notificationId);
|
||||
}
|
||||
}
|
||||
ArrayList<String> ids = new ArrayList<>(holders.size());
|
||||
for (int a = 0, size = holders.size(); a < size; a++) {
|
||||
NotificationHolder holder = holders.get(a);
|
||||
holder.call();
|
||||
if (!unsupportedNotificationShortcut()) {
|
||||
ids.add(holder.notification.getShortcutId());
|
||||
}
|
||||
}
|
||||
if (!unsupportedNotificationShortcut()) {
|
||||
try {
|
||||
ShortcutManagerCompat.removeDynamicShortcuts(ApplicationLoader.applicationContext, ids);
|
||||
} catch (Exception e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
for (int a = 0; a < oldIdsWear.size(); a++) {
|
||||
long did = oldIdsWear.keyAt(a);
|
||||
|
|
@ -4332,6 +4299,23 @@ public class NotificationsController extends BaseController {
|
|||
}
|
||||
notificationManager.cancel(id);
|
||||
}
|
||||
|
||||
ArrayList<String> ids = new ArrayList<>(holders.size());
|
||||
for (int a = 0, size = holders.size(); a < size; a++) {
|
||||
NotificationHolder holder = holders.get(a);
|
||||
ids.clear();
|
||||
if (Build.VERSION.SDK_INT >= 29 && holder.lowerId != 0) {
|
||||
String shortcutId = createNotificationShortcut(holder.notification, holder.lowerId, holder.name, holder.user, holder.chat, personCache.get(holder.lowerId));
|
||||
if (shortcutId != null) {
|
||||
ids.add(shortcutId);
|
||||
}
|
||||
}
|
||||
holder.call();
|
||||
if (!unsupportedNotificationShortcut() && !ids.isEmpty()) {
|
||||
ShortcutManagerCompat.removeDynamicShortcuts(ApplicationLoader.applicationContext, ids);
|
||||
}
|
||||
}
|
||||
|
||||
if (serializedNotifications != null) {
|
||||
try {
|
||||
JSONObject s = new JSONObject();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue