1
0
mirror of https://github.com/NekoX-Dev/NekoX.git synced 2024-11-16 10:46:12 +01:00

Merge remote-tracking branch 'telegram/master'

This commit is contained in:
NekoInverter 2020-05-01 08:46:25 +08:00
commit 4f4e9d1246
No known key found for this signature in database
GPG Key ID: 280D6CCCF95715F9
26 changed files with 1086 additions and 611 deletions

View File

@ -1,5 +1,5 @@
import java.security.MessageDigest
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.internal.os.OperatingSystem
apply plugin: 'com.android.application'
@ -20,13 +20,13 @@ configurations.all {
dependencies {
implementation 'androidx.core:core:1.1.0-beta01'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.1.0'
implementation 'androidx.exifinterface:exifinterface:1.2.0'
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
implementation 'com.android.support:multidex:1.0.3'
compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
implementation 'com.google.firebase:firebase-messaging:20.1.4'
implementation 'com.google.firebase:firebase-messaging:20.1.6'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-vision:16.2.0'
@ -296,13 +296,13 @@ android {
}
}
defaultConfig.versionCode = 10 * 1942
defaultConfig.versionCode = 10 * 1945
def tgVoipDexFileName = "libtgvoip.dex"
def tgVoipDexClasses = ["AudioRecordJNI", "AudioTrackJNI", "NativeTgVoipDelegate", "NativeTgVoipInstance", "TgVoipNativeLoader", "Resampler", "VLog"]
def tgVoipDexClassesPath = "org/telegram/messenger/voip"
def dxUtilPath = "${sdkDirectory.path}/build-tools/${buildToolsVersion}/dx"
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
if (OperatingSystem.current().isWindows()) {
dxUtilPath = "${sdkDirectory.path}\\build-tools\\${buildToolsVersion}\\dx.bat"
}
@ -394,7 +394,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionName "6.1.0.1"
versionName "6.1.1"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
@ -428,7 +428,7 @@ private static File findJavaHome() {
private static File findJavac() {
File javaHome = findJavaHome()
if (javaHome != null) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
if (OperatingSystem.current().isWindows()) {
return new File(javaHome.getParent(), "bin/javac.exe")
} else {
return new File(javaHome, "bin/javac")

View File

@ -19,8 +19,8 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean TON_WALLET_STANDALONE = false;
public static int BUILD_VERSION = 1942;
public static String BUILD_VERSION_STRING = "6.1.0.1";
public static int BUILD_VERSION = 1945;
public static String BUILD_VERSION_STRING = "6.1.0";
public static int APP_ID = 336779;
public static String APP_HASH = "b91eefacc86747c068c8d8a16b41500d";
public static String APPCENTER_HASH = "a5b5c4f5-51da-dedc-9918-d9766a22ca7c";

View File

@ -1013,6 +1013,17 @@ public class LocaleController {
return getInstance().getStringInternal(key, res);
}
public static String getString(String key) {
if (TextUtils.isEmpty(key)) {
return "LOC_ERR:" + key;
}
int resourceId = ApplicationLoader.applicationContext.getResources().getIdentifier(key, "string", ApplicationLoader.applicationContext.getPackageName());
if (resourceId != 0) {
return getString(key, resourceId);
}
return getServerString(key);
}
public static String getPluralString(String key, int plural) {
if (key == null || key.length() == 0 || getInstance().currentPluralRules == null) {
return "LOC_ERR:" + key;

View File

@ -9,7 +9,6 @@
package org.telegram.messenger;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -54,7 +53,6 @@ import org.telegram.ui.Components.Bulletin;
import org.telegram.ui.Components.StickerSetBulletinLayout;
import org.telegram.ui.Components.StickersArchiveAlert;
import org.telegram.ui.Components.TextStyleSpan;
import org.telegram.ui.Components.TrendingStickersAlert;
import org.telegram.ui.Components.URLSpanReplacement;
import org.telegram.ui.Components.URLSpanUserMention;
import org.telegram.ui.LaunchActivity;

View File

@ -55,8 +55,6 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import androidx.core.app.NotificationManagerCompat;
import tw.nekomimi.nekogram.NekoConfig;
public class MessagesController extends BaseController implements NotificationCenter.NotificationCenterDelegate {
@ -199,13 +197,16 @@ public class MessagesController extends BaseController implements NotificationCe
private int loadingNotificationSettings;
private boolean loadingNotificationSignUpSettings;
private int nextProxyInfoCheckTime;
private boolean checkingProxyInfo;
private int checkingProxyInfoRequestId;
private int lastCheckProxyId;
private TLRPC.Dialog proxyDialog;
private boolean isLeftProxyChannel;
private long proxyDialogId;
private int nextPromoInfoCheckTime;
private boolean checkingPromoInfo;
private int checkingPromoInfoRequestId;
private int lastCheckPromoId;
private TLRPC.Dialog promoDialog;
private boolean isLeftPromoChannel;
private long promoDialogId;
public int promoDialogType;
public String promoPsaMessage;
public String promoPsaType;
private String proxyDialogAddress;
private boolean checkingTosUpdate;
@ -328,6 +329,10 @@ public class MessagesController extends BaseController implements NotificationCe
public static final int UPDATE_MASK_REORDER = 131072;
public static final int UPDATE_MASK_ALL = UPDATE_MASK_AVATAR | UPDATE_MASK_STATUS | UPDATE_MASK_NAME | UPDATE_MASK_CHAT_AVATAR | UPDATE_MASK_CHAT_NAME | UPDATE_MASK_CHAT_MEMBERS | UPDATE_MASK_USER_PRINT | UPDATE_MASK_USER_PHONE | UPDATE_MASK_READ_DIALOG_MESSAGE | UPDATE_MASK_PHONE;
public static final int PROMO_TYPE_PROXY = 0;
public static final int PROMO_TYPE_PSA = 1;
public static final int PROMO_TYPE_OTHER = 2;
private static class ReadTask {
public long dialogId;
public int maxId;
@ -542,7 +547,11 @@ public class MessagesController extends BaseController implements NotificationCe
youtubePipType = mainPreferences.getString("youtubePipType", "disabled");
keepAliveService = mainPreferences.getBoolean("keepAliveService", false);
backgroundConnection = mainPreferences.getBoolean("keepAliveService", false);
proxyDialogId = mainPreferences.getLong("proxy_dialog", 0);
promoDialogId = mainPreferences.getLong("proxy_dialog", 0);
nextPromoInfoCheckTime = mainPreferences.getInt("nextPromoInfoCheckTime", 0);
promoDialogType = mainPreferences.getInt("promo_dialog_type", 0);
promoPsaMessage = mainPreferences.getString("promo_psa_message", null);
promoPsaType = mainPreferences.getString("promo_psa_type", null);
proxyDialogAddress = mainPreferences.getString("proxyDialogAddress", null);
nextTosCheckTime = notificationsPreferences.getInt("nextTosCheckTime", 0);
venueSearchBot = mainPreferences.getString("venueSearchBot", "foursquare");
@ -715,7 +724,7 @@ public class MessagesController extends BaseController implements NotificationCe
TLRPC.Message message = pinnedDialogs.messages.get(a);
if (message.to_id.channel_id != 0) {
TLRPC.Chat chat = chatsDict.get(message.to_id.channel_id);
if (chat != null && chat.left && (proxyDialogId == 0 || proxyDialogId != -chat.id)) {
if (chat != null && chat.left && (promoDialogId == 0 || promoDialogId != -chat.id)) {
continue;
}
if (chat != null && chat.megagroup) {
@ -744,8 +753,8 @@ public class MessagesController extends BaseController implements NotificationCe
continue;
}
}
if (proxyDialogId != 0 && proxyDialogId == d.id) {
proxyDialog = d;
if (promoDialogId != 0 && promoDialogId == d.id) {
promoDialog = d;
}
if (d.last_message_date == 0) {
MessageObject mess = new_dialogMessage.get(d.id);
@ -756,7 +765,7 @@ public class MessagesController extends BaseController implements NotificationCe
if (DialogObject.isChannel(d)) {
TLRPC.Chat chat = chatsDict.get(-(int) d.id);
if (chat != null) {
if (chat.left && (proxyDialogId == 0 || proxyDialogId != d.id)) {
if (chat.left && (promoDialogId == 0 || promoDialogId != d.id)) {
continue;
}
}
@ -1872,8 +1881,8 @@ public class MessagesController extends BaseController implements NotificationCe
checkingTosUpdate = false;
nextTosCheckTime = 0;
nextProxyInfoCheckTime = 0;
checkingProxyInfo = false;
nextPromoInfoCheckTime = 0;
checkingPromoInfo = false;
loadingUnreadDialogs = false;
currentDeletingTaskTime = 0;
@ -3729,6 +3738,24 @@ public class MessagesController extends BaseController implements NotificationCe
}
}
public void hidePromoDialog() {
if (promoDialog == null) {
return;
}
TLRPC.TL_help_hidePromoData req = new TLRPC.TL_help_hidePromoData();
req.peer = getInputPeer((int) promoDialog.id);
getConnectionsManager().sendRequest(req, (response, error) -> {
});
Utilities.stageQueue.postRunnable(() -> {
promoDialogId = 0;
proxyDialogAddress = null;
nextPromoInfoCheckTime = getConnectionsManager().getCurrentTime() + 60 * 60;
getGlobalMainSettings().edit().putLong("proxy_dialog", promoDialogId).remove("proxyDialogAddress").putInt("nextPromoInfoCheckTime", nextPromoInfoCheckTime).commit();
});
removePromoDialog();
}
public void deleteDialog(final long did, final int onlyHistory) {
deleteDialog(did, onlyHistory, false);
}
@ -3757,7 +3784,7 @@ public class MessagesController extends BaseController implements NotificationCe
int max_id_delete = max_id;
if (first) {
boolean isProxyDialog = false;
boolean isPromoDialog = false;
boolean emptyMax = max_id_delete == 0;
if (emptyMax) {
int max = getMessagesStorage().getDialogMaxMessageId(did);
@ -3777,10 +3804,10 @@ public class MessagesController extends BaseController implements NotificationCe
max_id_delete = Math.max(max_id_delete, dialog.read_outbox_max_id);
}
if (onlyHistory == 0 || onlyHistory == 3) {
if (isProxyDialog = (proxyDialog != null && proxyDialog.id == did)) {
isLeftProxyChannel = true;
if (proxyDialog.id < 0) {
TLRPC.Chat chat = getChat(-(int) proxyDialog.id);
if (isPromoDialog = (promoDialog != null && promoDialog.id == did)) {
isLeftPromoChannel = true;
if (promoDialog.id < 0) {
TLRPC.Chat chat = getChat(-(int) promoDialog.id);
if (chat != null) {
chat.left = true;
}
@ -3796,7 +3823,7 @@ public class MessagesController extends BaseController implements NotificationCe
} else {
dialog.unread_count = 0;
}
if (!isProxyDialog) {
if (!isPromoDialog) {
int lastMessageId;
MessageObject object = dialogMessage.get(dialog.id);
dialogMessage.remove(dialog.id);
@ -3857,7 +3884,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
if (!dialogsInTransaction) {
if (isProxyDialog) {
if (isPromoDialog) {
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, true);
} else {
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
@ -4331,7 +4358,7 @@ public class MessagesController extends BaseController implements NotificationCe
GcmPushListenerService.sendRegistrationToServer(SharedConfig.pushString);
}
getLocationController().update();
checkProxyInfoInternal(false);
checkPromoInfoInternal(false);
checkTosUpdate();
}
@ -4357,268 +4384,283 @@ public class MessagesController extends BaseController implements NotificationCe
});
}
public void checkProxyInfo(final boolean reset) {
Utilities.stageQueue.postRunnable(() -> checkProxyInfoInternal(reset));
public void checkPromoInfo(final boolean reset) {
Utilities.stageQueue.postRunnable(() -> checkPromoInfoInternal(reset));
}
private void checkProxyInfoInternal(boolean reset) {
if (reset && checkingProxyInfo) {
checkingProxyInfo = false;
private void checkPromoInfoInternal(boolean reset) {
if (reset && checkingPromoInfo) {
checkingPromoInfo = false;
}
if (!reset && nextProxyInfoCheckTime > getConnectionsManager().getCurrentTime() || checkingProxyInfo) {
if (!reset && nextPromoInfoCheckTime > getConnectionsManager().getCurrentTime() || checkingPromoInfo) {
return;
}
if (checkingProxyInfoRequestId != 0) {
getConnectionsManager().cancelRequest(checkingProxyInfoRequestId, true);
checkingProxyInfoRequestId = 0;
if (checkingPromoInfoRequestId != 0) {
getConnectionsManager().cancelRequest(checkingPromoInfoRequestId, true);
checkingPromoInfoRequestId = 0;
}
SharedPreferences preferences = getGlobalMainSettings();
boolean enabled = preferences.getBoolean("proxy_enabled", false);
String proxyAddress = preferences.getString("proxy_ip", "");
String proxySecret = preferences.getString("proxy_secret", "");
int removeCurrent = 0;
if (proxyDialogId != 0 && proxyDialogAddress != null && !proxyDialogAddress.equals(proxyAddress + proxySecret)) {
if (!NekoConfig.hideProxySponsorChannel && promoDialogId != 0 && promoDialogType == PROMO_TYPE_PROXY && proxyDialogAddress != null && !proxyDialogAddress.equals(proxyAddress + proxySecret)) {
removeCurrent = 1;
}
lastCheckProxyId++;
if (!NekoConfig.hideProxySponsorChannel && enabled && !TextUtils.isEmpty(proxyAddress) && !TextUtils.isEmpty(proxySecret)) {
checkingProxyInfo = true;
int checkProxyId = lastCheckProxyId;
TLRPC.TL_help_getProxyData req = new TLRPC.TL_help_getProxyData();
checkingProxyInfoRequestId = getConnectionsManager().sendRequest(req, (response, error) -> {
if (checkProxyId != lastCheckProxyId) {
return;
}
boolean noDialog = false;
if (response instanceof TLRPC.TL_help_proxyDataEmpty) {
TLRPC.TL_help_proxyDataEmpty res = (TLRPC.TL_help_proxyDataEmpty) response;
nextProxyInfoCheckTime = res.expires;
noDialog = true;
} else if (response instanceof TLRPC.TL_help_proxyDataPromo) {
final TLRPC.TL_help_proxyDataPromo res = (TLRPC.TL_help_proxyDataPromo) response;
lastCheckPromoId++;
final long did;
if (res.peer.user_id != 0) {
did = res.peer.user_id;
} else if (res.peer.chat_id != 0) {
did = -res.peer.chat_id;
for (int a = 0; a < res.chats.size(); a++) {
TLRPC.Chat chat = res.chats.get(a);
if (chat.id == res.peer.chat_id) {
if (chat.kicked || chat.restricted) {
noDialog = true;
}
break;
checkingPromoInfo = true;
int checkPromoId = lastCheckPromoId;
TLRPC.TL_help_getPromoData req = new TLRPC.TL_help_getPromoData();
checkingPromoInfoRequestId = getConnectionsManager().sendRequest(req, (response, error) -> {
if (checkPromoId != lastCheckPromoId) {
return;
}
boolean noDialog = false;
if (response instanceof TLRPC.TL_help_promoDataEmpty) {
TLRPC.TL_help_promoDataEmpty res = (TLRPC.TL_help_promoDataEmpty) response;
nextPromoInfoCheckTime = res.expires;
noDialog = true;
} else if (response instanceof TLRPC.TL_help_promoData) {
final TLRPC.TL_help_promoData res = (TLRPC.TL_help_promoData) response;
final long did;
if (res.peer.user_id != 0) {
did = res.peer.user_id;
} else if (res.peer.chat_id != 0) {
did = -res.peer.chat_id;
for (int a = 0; a < res.chats.size(); a++) {
TLRPC.Chat chat = res.chats.get(a);
if (chat.id == res.peer.chat_id) {
if (chat.kicked || chat.restricted) {
noDialog = true;
}
break;
}
} else {
did = -res.peer.channel_id;
for (int a = 0; a < res.chats.size(); a++) {
TLRPC.Chat chat = res.chats.get(a);
if (chat.id == res.peer.channel_id) {
if (chat.kicked || chat.restricted) {
noDialog = true;
}
break;
}
}
}
proxyDialogId = did;
proxyDialogAddress = proxyAddress + proxySecret;
getGlobalMainSettings().edit().putLong("proxy_dialog", proxyDialogId).putString("proxyDialogAddress", proxyDialogAddress).commit();
nextProxyInfoCheckTime = res.expires;
if (!noDialog) {
AndroidUtilities.runOnUIThread(() -> {
if (proxyDialog != null && did != proxyDialog.id) {
removeProxyDialog();
}
proxyDialog = dialogs_dict.get(did);
if (proxyDialog != null) {
checkingProxyInfo = false;
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, true);
} else {
final SparseArray<TLRPC.User> usersDict = new SparseArray<>();
final SparseArray<TLRPC.Chat> chatsDict = new SparseArray<>();
for (int a = 0; a < res.users.size(); a++) {
TLRPC.User u = res.users.get(a);
usersDict.put(u.id, u);
}
for (int a = 0; a < res.chats.size(); a++) {
TLRPC.Chat c = res.chats.get(a);
chatsDict.put(c.id, c);
}
TLRPC.TL_messages_getPeerDialogs req1 = new TLRPC.TL_messages_getPeerDialogs();
TLRPC.TL_inputDialogPeer peer = new TLRPC.TL_inputDialogPeer();
if (res.peer.user_id != 0) {
peer.peer = new TLRPC.TL_inputPeerUser();
peer.peer.user_id = res.peer.user_id;
TLRPC.User user = usersDict.get(res.peer.user_id);
if (user != null) {
peer.peer.access_hash = user.access_hash;
}
} else if (res.peer.chat_id != 0) {
peer.peer = new TLRPC.TL_inputPeerChat();
peer.peer.chat_id = res.peer.chat_id;
TLRPC.Chat chat = chatsDict.get(res.peer.chat_id);
if (chat != null) {
peer.peer.access_hash = chat.access_hash;
}
} else {
peer.peer = new TLRPC.TL_inputPeerChannel();
peer.peer.channel_id = res.peer.channel_id;
TLRPC.Chat chat = chatsDict.get(res.peer.channel_id);
if (chat != null) {
peer.peer.access_hash = chat.access_hash;
}
}
req1.peers.add(peer);
checkingProxyInfoRequestId = getConnectionsManager().sendRequest(req1, (response1, error1) -> {
if (checkProxyId != lastCheckProxyId) {
return;
}
checkingProxyInfoRequestId = 0;
final TLRPC.TL_messages_peerDialogs res2 = (TLRPC.TL_messages_peerDialogs) response1;
if (res2 != null && !res2.dialogs.isEmpty()) {
getMessagesStorage().putUsersAndChats(res.users, res.chats, true, true);
TLRPC.TL_messages_dialogs dialogs = new TLRPC.TL_messages_dialogs();
dialogs.chats = res2.chats;
dialogs.users = res2.users;
dialogs.dialogs = res2.dialogs;
dialogs.messages = res2.messages;
getMessagesStorage().putDialogs(dialogs, 2);
AndroidUtilities.runOnUIThread(() -> {
putUsers(res.users, false);
putChats(res.chats, false);
putUsers(res2.users, false);
putChats(res2.chats, false);
if (proxyDialog != null) {
int lowerId = (int) proxyDialog.id;
if (lowerId < 0) {
TLRPC.Chat chat = getChat(-lowerId);
if (ChatObject.isNotInChat(chat) || chat.restricted) {
removeDialog(proxyDialog);
}
} else {
removeDialog(proxyDialog);
}
}
proxyDialog = res2.dialogs.get(0);
proxyDialog.id = did;
proxyDialog.folder_id = 0;
if (DialogObject.isChannel(proxyDialog)) {
channelsPts.put(-(int) proxyDialog.id, proxyDialog.pts);
}
Integer value = dialogs_read_inbox_max.get(proxyDialog.id);
if (value == null) {
value = 0;
}
dialogs_read_inbox_max.put(proxyDialog.id, Math.max(value, proxyDialog.read_inbox_max_id));
value = dialogs_read_outbox_max.get(proxyDialog.id);
if (value == null) {
value = 0;
}
dialogs_read_outbox_max.put(proxyDialog.id, Math.max(value, proxyDialog.read_outbox_max_id));
dialogs_dict.put(did, proxyDialog);
if (!res2.messages.isEmpty()) {
final SparseArray<TLRPC.User> usersDict1 = new SparseArray<>();
final SparseArray<TLRPC.Chat> chatsDict1 = new SparseArray<>();
for (int a = 0; a < res2.users.size(); a++) {
TLRPC.User u = res2.users.get(a);
usersDict1.put(u.id, u);
}
for (int a = 0; a < res2.chats.size(); a++) {
TLRPC.Chat c = res2.chats.get(a);
chatsDict1.put(c.id, c);
}
MessageObject messageObject = new MessageObject(currentAccount, res2.messages.get(0), usersDict1, chatsDict1, false);
dialogMessage.put(did, messageObject);
if (proxyDialog.last_message_date == 0) {
proxyDialog.last_message_date = messageObject.messageOwner.date;
}
}
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, true);
});
} else {
AndroidUtilities.runOnUIThread(() -> {
if (proxyDialog != null) {
int lowerId = (int) proxyDialog.id;
if (lowerId < 0) {
TLRPC.Chat chat = getChat(-lowerId);
if (ChatObject.isNotInChat(chat) || chat.restricted) {
removeDialog(proxyDialog);
}
} else {
removeDialog(proxyDialog);
}
proxyDialog = null;
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
}
});
}
checkingProxyInfo = false;
});
}
});
}
} else {
nextProxyInfoCheckTime = getConnectionsManager().getCurrentTime() + 60 * 60;
noDialog = true;
did = -res.peer.channel_id;
for (int a = 0; a < res.chats.size(); a++) {
TLRPC.Chat chat = res.chats.get(a);
if (chat.id == res.peer.channel_id) {
if (chat.kicked || chat.restricted) {
noDialog = true;
}
break;
}
}
}
if (noDialog) {
proxyDialogId = 0;
getGlobalMainSettings().edit().putLong("proxy_dialog", proxyDialogId).remove("proxyDialogAddress").commit();
checkingProxyInfoRequestId = 0;
checkingProxyInfo = false;
AndroidUtilities.runOnUIThread(this::removeProxyDialog);
promoDialogId = did;
if (res.proxy) {
promoDialogType = PROMO_TYPE_PROXY;
} else if (!TextUtils.isEmpty(res.psa_type)) {
promoDialogType = PROMO_TYPE_PSA;
promoPsaType = res.psa_type;
} else {
promoDialogType = PROMO_TYPE_OTHER;
}
});
} else {
removeCurrent = 2;
}
if (removeCurrent != 0) {
proxyDialogId = 0;
proxyDialogAddress = null;
getGlobalMainSettings().edit().putLong("proxy_dialog", proxyDialogId).remove("proxyDialogAddress").commit();
nextProxyInfoCheckTime = getConnectionsManager().getCurrentTime() + 60 * 60;
if (removeCurrent == 2) {
checkingProxyInfo = false;
if (checkingProxyInfoRequestId != 0) {
getConnectionsManager().cancelRequest(checkingProxyInfoRequestId, true);
checkingProxyInfoRequestId = 0;
proxyDialogAddress = proxyAddress + proxySecret;
promoPsaMessage = res.psa_message;
nextPromoInfoCheckTime = res.expires;
SharedPreferences.Editor editor = getGlobalMainSettings().edit();
editor.putLong("proxy_dialog", promoDialogId);
editor.putString("proxyDialogAddress", proxyDialogAddress);
editor.putInt("promo_dialog_type", promoDialogType);
if (promoPsaMessage != null) {
editor.putString("promo_psa_message", promoPsaMessage);
} else {
editor.remove("promo_psa_message");
}
if (promoPsaType != null) {
editor.putString("promo_psa_type", promoPsaType);
} else {
editor.remove("promo_psa_type");
}
editor.putInt("nextPromoInfoCheckTime", nextPromoInfoCheckTime);
editor.commit();
if (!noDialog) {
AndroidUtilities.runOnUIThread(() -> {
if (promoDialog != null && did != promoDialog.id) {
removePromoDialog();
}
promoDialog = dialogs_dict.get(did);
if (promoDialog != null) {
checkingPromoInfo = false;
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, true);
} else {
final SparseArray<TLRPC.User> usersDict = new SparseArray<>();
final SparseArray<TLRPC.Chat> chatsDict = new SparseArray<>();
for (int a = 0; a < res.users.size(); a++) {
TLRPC.User u = res.users.get(a);
usersDict.put(u.id, u);
}
for (int a = 0; a < res.chats.size(); a++) {
TLRPC.Chat c = res.chats.get(a);
chatsDict.put(c.id, c);
}
TLRPC.TL_messages_getPeerDialogs req1 = new TLRPC.TL_messages_getPeerDialogs();
TLRPC.TL_inputDialogPeer peer = new TLRPC.TL_inputDialogPeer();
if (res.peer.user_id != 0) {
peer.peer = new TLRPC.TL_inputPeerUser();
peer.peer.user_id = res.peer.user_id;
TLRPC.User user = usersDict.get(res.peer.user_id);
if (user != null) {
peer.peer.access_hash = user.access_hash;
}
} else if (res.peer.chat_id != 0) {
peer.peer = new TLRPC.TL_inputPeerChat();
peer.peer.chat_id = res.peer.chat_id;
TLRPC.Chat chat = chatsDict.get(res.peer.chat_id);
if (chat != null) {
peer.peer.access_hash = chat.access_hash;
}
} else {
peer.peer = new TLRPC.TL_inputPeerChannel();
peer.peer.channel_id = res.peer.channel_id;
TLRPC.Chat chat = chatsDict.get(res.peer.channel_id);
if (chat != null) {
peer.peer.access_hash = chat.access_hash;
}
}
req1.peers.add(peer);
checkingPromoInfoRequestId = getConnectionsManager().sendRequest(req1, (response1, error1) -> {
if (checkPromoId != lastCheckPromoId) {
return;
}
checkingPromoInfoRequestId = 0;
final TLRPC.TL_messages_peerDialogs res2 = (TLRPC.TL_messages_peerDialogs) response1;
if (res2 != null && !res2.dialogs.isEmpty()) {
getMessagesStorage().putUsersAndChats(res.users, res.chats, true, true);
TLRPC.TL_messages_dialogs dialogs = new TLRPC.TL_messages_dialogs();
dialogs.chats = res2.chats;
dialogs.users = res2.users;
dialogs.dialogs = res2.dialogs;
dialogs.messages = res2.messages;
getMessagesStorage().putDialogs(dialogs, 2);
AndroidUtilities.runOnUIThread(() -> {
putUsers(res.users, false);
putChats(res.chats, false);
putUsers(res2.users, false);
putChats(res2.chats, false);
if (promoDialog != null) {
int lowerId = (int) promoDialog.id;
if (lowerId < 0) {
TLRPC.Chat chat = getChat(-lowerId);
if (ChatObject.isNotInChat(chat) || chat.restricted) {
removeDialog(promoDialog);
}
} else {
removeDialog(promoDialog);
}
}
promoDialog = res2.dialogs.get(0);
promoDialog.id = did;
promoDialog.folder_id = 0;
if (DialogObject.isChannel(promoDialog)) {
channelsPts.put(-(int) promoDialog.id, promoDialog.pts);
}
Integer value = dialogs_read_inbox_max.get(promoDialog.id);
if (value == null) {
value = 0;
}
dialogs_read_inbox_max.put(promoDialog.id, Math.max(value, promoDialog.read_inbox_max_id));
value = dialogs_read_outbox_max.get(promoDialog.id);
if (value == null) {
value = 0;
}
dialogs_read_outbox_max.put(promoDialog.id, Math.max(value, promoDialog.read_outbox_max_id));
dialogs_dict.put(did, promoDialog);
if (!res2.messages.isEmpty()) {
final SparseArray<TLRPC.User> usersDict1 = new SparseArray<>();
final SparseArray<TLRPC.Chat> chatsDict1 = new SparseArray<>();
for (int a = 0; a < res2.users.size(); a++) {
TLRPC.User u = res2.users.get(a);
usersDict1.put(u.id, u);
}
for (int a = 0; a < res2.chats.size(); a++) {
TLRPC.Chat c = res2.chats.get(a);
chatsDict1.put(c.id, c);
}
MessageObject messageObject = new MessageObject(currentAccount, res2.messages.get(0), usersDict1, chatsDict1, false);
dialogMessage.put(did, messageObject);
if (promoDialog.last_message_date == 0) {
promoDialog.last_message_date = messageObject.messageOwner.date;
}
}
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload, true);
});
} else {
AndroidUtilities.runOnUIThread(() -> {
if (promoDialog != null) {
int lowerId = (int) promoDialog.id;
if (lowerId < 0) {
TLRPC.Chat chat = getChat(-lowerId);
if (ChatObject.isNotInChat(chat) || chat.restricted) {
removeDialog(promoDialog);
}
} else {
removeDialog(promoDialog);
}
promoDialog = null;
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
}
});
}
checkingPromoInfo = false;
});
}
});
}
} else {
nextPromoInfoCheckTime = getConnectionsManager().getCurrentTime() + 60 * 60;
noDialog = true;
}
AndroidUtilities.runOnUIThread(this::removeProxyDialog);
if (noDialog) {
promoDialogId = 0;
getGlobalMainSettings().edit().putLong("proxy_dialog", promoDialogId).remove("proxyDialogAddress").putInt("nextPromoInfoCheckTime", nextPromoInfoCheckTime).commit();
checkingPromoInfoRequestId = 0;
checkingPromoInfo = false;
AndroidUtilities.runOnUIThread(this::removePromoDialog);
}
});
if (removeCurrent != 0) {
promoDialogId = 0;
proxyDialogAddress = null;
nextPromoInfoCheckTime = getConnectionsManager().getCurrentTime() + 60 * 60;
getGlobalMainSettings().edit().putLong("proxy_dialog", promoDialogId).remove("proxyDialogAddress").putInt("nextPromoInfoCheckTime", nextPromoInfoCheckTime).commit();
AndroidUtilities.runOnUIThread(this::removePromoDialog);
}
}
private void removeProxyDialog() {
if (proxyDialog == null) {
private void removePromoDialog() {
if (promoDialog == null) {
return;
}
int lowerId = (int) proxyDialog.id;
int lowerId = (int) promoDialog.id;
if (lowerId < 0) {
TLRPC.Chat chat = getChat(-lowerId);
if (ChatObject.isNotInChat(chat) || chat.restricted) {
removeDialog(proxyDialog);
removeDialog(promoDialog);
}
} else {
removeDialog(proxyDialog);
removeDialog(promoDialog);
}
proxyDialog = null;
promoDialog = null;
sortDialogs(null);
getNotificationCenter().postNotificationName(NotificationCenter.dialogsNeedReload);
}
public boolean isProxyDialog(long did, boolean checkLeft) {
return proxyDialog != null && proxyDialog.id == did && (!checkLeft || isLeftProxyChannel);
public boolean isPromoDialog(long did, boolean checkLeft) {
return promoDialog != null && promoDialog.id == did && (!checkLeft || isLeftPromoChannel);
}
private String getUserNameForTyping(TLRPC.User user) {
@ -5255,7 +5297,7 @@ public class MessagesController extends BaseController implements NotificationCe
for (int a = 0; a < allDialogs.size(); a++) {
TLRPC.Dialog d = allDialogs.get(a);
if (!d.pinned) {
if (d.id != proxyDialogId) {
if (d.id != promoDialogId) {
break;
}
continue;
@ -5322,7 +5364,7 @@ public class MessagesController extends BaseController implements NotificationCe
if (!DialogObject.isPeerDialogId(dialogId) && !DialogObject.isSecretDialogId(dialogId)) {
continue;
}
if (folderId == 1 && (dialogId == selfUserId || dialogId == 777000 || isProxyDialog(dialogId, false))) {
if (folderId == 1 && (dialogId == selfUserId || dialogId == 777000 || isPromoDialog(dialogId, false))) {
continue;
}
TLRPC.Dialog dialog = dialogs_dict.get(dialogId);
@ -6209,7 +6251,7 @@ public class MessagesController extends BaseController implements NotificationCe
}
if (message.to_id.channel_id != 0) {
TLRPC.Chat chat = chatsDict.get(message.to_id.channel_id);
if (chat != null && chat.left && (proxyDialogId == 0 || proxyDialogId != -chat.id)) {
if (chat != null && chat.left && (promoDialogId == 0 || promoDialogId != -chat.id)) {
continue;
}
if (chat != null && chat.megagroup) {
@ -6299,8 +6341,8 @@ public class MessagesController extends BaseController implements NotificationCe
continue;
}
}
if (proxyDialogId != 0 && proxyDialogId == d.id) {
proxyDialog = d;
if (promoDialogId != 0 && promoDialogId == d.id) {
promoDialog = d;
}
if (d.last_message_date == 0) {
MessageObject mess = new_dialogMessage.get(d.id);
@ -6315,7 +6357,7 @@ public class MessagesController extends BaseController implements NotificationCe
if (!chat.megagroup) {
allowCheck = false;
}
if (chat.left && (proxyDialogId == 0 || proxyDialogId != d.id)) {
if (chat.left && (promoDialogId == 0 || promoDialogId != d.id)) {
continue;
}
}
@ -6868,7 +6910,7 @@ public class MessagesController extends BaseController implements NotificationCe
for (int a = 0; a < dialogsRes.messages.size(); a++) {
TLRPC.Message message = dialogsRes.messages.get(a);
if (proxyDialogId == 0 || proxyDialogId != message.dialog_id) {
if (promoDialogId == 0 || promoDialogId != message.dialog_id) {
if (message.to_id.channel_id != 0) {
TLRPC.Chat chat = chatsDict.get(message.to_id.channel_id);
if (chat != null && chat.left) {
@ -6887,7 +6929,7 @@ public class MessagesController extends BaseController implements NotificationCe
for (int a = 0; a < dialogsRes.dialogs.size(); a++) {
TLRPC.Dialog d = dialogsRes.dialogs.get(a);
DialogObject.initDialog(d);
if (proxyDialogId == 0 || proxyDialogId != d.id) {
if (promoDialogId == 0 || promoDialogId != d.id) {
if (DialogObject.isChannel(d)) {
TLRPC.Chat chat = chatsDict.get(-(int) d.id);
if (chat != null && chat.left) {
@ -8978,7 +9020,7 @@ public class MessagesController extends BaseController implements NotificationCe
continue;
}
if (!dialog.pinned) {
if (dialog.id != proxyDialogId) {
if (dialog.id != promoDialogId) {
break;
}
continue;
@ -9035,7 +9077,7 @@ public class MessagesController extends BaseController implements NotificationCe
continue;
}
if (!d.pinned) {
if (d.id != proxyDialogId) {
if (d.id != promoDialogId) {
break;
}
continue;
@ -9206,7 +9248,7 @@ public class MessagesController extends BaseController implements NotificationCe
continue;
}
if (!dialog.pinned) {
if (dialog.id != proxyDialogId) {
if (dialog.id != promoDialogId) {
break;
}
continue;
@ -11334,7 +11376,7 @@ public class MessagesController extends BaseController implements NotificationCe
if (chat != null) {
if (dialog == null && chat instanceof TLRPC.TL_channel && !chat.left) {
Utilities.stageQueue.postRunnable(() -> getChannelDifference(update.channel_id, 1, 0, null));
} else if (chat.left && dialog != null && (proxyDialog == null || proxyDialog.id != dialog.id)) {
} else if (chat.left && dialog != null && (promoDialog == null || promoDialog.id != dialog.id)) {
deleteDialog(dialog.id, 0);
}
}
@ -11835,7 +11877,13 @@ public class MessagesController extends BaseController implements NotificationCe
public boolean isDialogMuted(long dialog_id, TLRPC.Chat chat) {
int mute_type = notificationsPreferences.getInt("notify2_" + dialog_id, -1);
if (mute_type == -1) {
return !getNotificationsController().isGlobalNotificationsEnabled(dialog_id, ChatObject.isChannel(chat) && !chat.megagroup);
Boolean forceChannel;
if (chat != null) {
forceChannel = ChatObject.isChannel(chat) && !chat.megagroup;
} else {
forceChannel = null;
}
return !getNotificationsController().isGlobalNotificationsEnabled(dialog_id, forceChannel);
}
if (mute_type == 2) {
return true;
@ -12170,11 +12218,11 @@ public class MessagesController extends BaseController implements NotificationCe
}
Collections.sort(allDialogs, dialogComparator);
isLeftProxyChannel = true;
if (proxyDialog != null && proxyDialog.id < 0) {
TLRPC.Chat chat = getChat(-(int) proxyDialog.id);
isLeftPromoChannel = true;
if (promoDialog != null && promoDialog.id < 0) {
TLRPC.Chat chat = getChat(-(int) promoDialog.id);
if (chat != null && !chat.left) {
isLeftProxyChannel = false;
isLeftPromoChannel = false;
}
}
for (int a = 0, N = allDialogs.size(); a < N; a++) {
@ -12228,7 +12276,7 @@ public class MessagesController extends BaseController implements NotificationCe
if ((d.unread_count != 0 || d.unread_mark) && !isDialogMuted(d.id)) {
unreadUnmutedDialogs++;
}
if (proxyDialog != null && d.id == proxyDialog.id && isLeftProxyChannel) {
if (promoDialog != null && d.id == promoDialog.id && isLeftPromoChannel) {
allDialogs.remove(a);
a--;
N--;
@ -12236,9 +12284,9 @@ public class MessagesController extends BaseController implements NotificationCe
}
addDialogToItsFolder(-1, d);
}
if (proxyDialog != null && isLeftProxyChannel) {
allDialogs.add(0, proxyDialog);
addDialogToItsFolder(-2, proxyDialog);
if (promoDialog != null && isLeftPromoChannel) {
allDialogs.add(0, promoDialog);
addDialogToItsFolder(-2, promoDialog);
}
if (!selfAdded) {
TLRPC.User user = getUserConfig().getCurrentUser();

View File

@ -3643,7 +3643,7 @@ public class MessagesStorage extends BaseController {
}
private void updateFiltersReadCounter(LongSparseArray<Integer> dialogsToUpdate, LongSparseArray<Integer> dialogsToUpdateMentions, boolean read) throws Exception {
if (dialogFilters.isEmpty() || (dialogsToUpdate == null || dialogsToUpdate.size() == 0) && (dialogsToUpdateMentions == null || dialogsToUpdateMentions.size() == 0)) {
if ((dialogsToUpdate == null || dialogsToUpdate.size() == 0) && (dialogsToUpdateMentions == null || dialogsToUpdateMentions.size() == 0)) {
return;
}
for (int a = 0; a < 2; a++) {

View File

@ -638,7 +638,7 @@ public class ConnectionsManager extends BaseController {
}
AccountInstance accountInstance = AccountInstance.getInstance(a);
if (accountInstance.getUserConfig().isClientActivated()) {
accountInstance.getMessagesController().checkProxyInfo(true);
accountInstance.getMessagesController().checkPromoInfo(true);
}
}
}

View File

@ -61,7 +61,7 @@ public class TLRPC {
public static final int MESSAGE_FLAG_EDITED = 0x00008000;
public static final int MESSAGE_FLAG_MEGAGROUP = 0x80000000;
public static final int LAYER = 112;
public static final int LAYER = 113;
public static class TL_chatBannedRights extends TLObject {
public static int constructor = 0x9f120418;
@ -20469,105 +20469,6 @@ public class TLRPC {
}
}
public static abstract class help_ProxyData extends TLObject {
public static help_ProxyData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
help_ProxyData result = null;
switch (constructor) {
case 0xe09e1fb8:
result = new TL_help_proxyDataEmpty();
break;
case 0x2bf7ee23:
result = new TL_help_proxyDataPromo();
break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in help_ProxyData", constructor));
}
if (result != null) {
result.readParams(stream, exception);
}
return result;
}
}
public static class TL_help_proxyDataEmpty extends help_ProxyData {
public static int constructor = 0xe09e1fb8;
public int expires;
public void readParams(AbstractSerializedData stream, boolean exception) {
expires = stream.readInt32(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(expires);
}
}
public static class TL_help_proxyDataPromo extends help_ProxyData {
public static int constructor = 0x2bf7ee23;
public int expires;
public Peer peer;
public ArrayList<Chat> chats = new ArrayList<>();
public ArrayList<User> users = new ArrayList<>();
public void readParams(AbstractSerializedData stream, boolean exception) {
expires = stream.readInt32(exception);
peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
int magic = stream.readInt32(exception);
if (magic != 0x1cb5c415) {
if (exception) {
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
}
return;
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
chats.add(object);
}
magic = stream.readInt32(exception);
if (magic != 0x1cb5c415) {
if (exception) {
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
}
return;
}
count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
User object = User.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
users.add(object);
}
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(expires);
peer.serializeToStream(stream);
stream.writeInt32(0x1cb5c415);
int count = chats.size();
stream.writeInt32(count);
for (int a = 0; a < count; a++) {
chats.get(a).serializeToStream(stream);
}
stream.writeInt32(0x1cb5c415);
count = users.size();
stream.writeInt32(count);
for (int a = 0; a < count; a++) {
users.get(a).serializeToStream(stream);
}
}
}
public static abstract class MessageUserVote extends TLObject {
public int user_id;
@ -26730,6 +26631,125 @@ public class TLRPC {
}
}
public static abstract class help_PromoData extends TLObject {
public static help_PromoData TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
help_PromoData result = null;
switch (constructor) {
case 0x8c39793f:
result = new TL_help_promoData();
break;
case 0x98f6ac75:
result = new TL_help_promoDataEmpty();
break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in help_PromoData", constructor));
}
if (result != null) {
result.readParams(stream, exception);
}
return result;
}
}
public static class TL_help_promoData extends help_PromoData {
public static int constructor = 0x8c39793f;
public int flags;
public boolean proxy;
public int expires;
public Peer peer;
public ArrayList<Chat> chats = new ArrayList<>();
public ArrayList<User> users = new ArrayList<>();
public String psa_type;
public String psa_message;
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
proxy = (flags & 1) != 0;
expires = stream.readInt32(exception);
peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
int magic = stream.readInt32(exception);
if (magic != 0x1cb5c415) {
if (exception) {
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
}
return;
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
Chat object = Chat.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
chats.add(object);
}
magic = stream.readInt32(exception);
if (magic != 0x1cb5c415) {
if (exception) {
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
}
return;
}
count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
User object = User.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
users.add(object);
}
if ((flags & 2) != 0) {
psa_type = stream.readString(exception);
}
if ((flags & 4) != 0) {
psa_message = stream.readString(exception);
}
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
flags = proxy ? (flags | 1) : (flags &~ 1);
stream.writeInt32(flags);
stream.writeInt32(expires);
peer.serializeToStream(stream);
stream.writeInt32(0x1cb5c415);
int count = chats.size();
stream.writeInt32(count);
for (int a = 0; a < count; a++) {
chats.get(a).serializeToStream(stream);
}
stream.writeInt32(0x1cb5c415);
count = users.size();
stream.writeInt32(count);
for (int a = 0; a < count; a++) {
users.get(a).serializeToStream(stream);
}
if ((flags & 2) != 0) {
stream.writeString(psa_type);
}
if ((flags & 4) != 0) {
stream.writeString(psa_message);
}
}
}
public static class TL_help_promoDataEmpty extends help_PromoData {
public static int constructor = 0x98f6ac75;
public int expires;
public void readParams(AbstractSerializedData stream, boolean exception) {
expires = stream.readInt32(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(expires);
}
}
public static abstract class ChannelParticipant extends TLObject {
public int user_id;
public int kicked_by;
@ -31092,6 +31112,7 @@ public class TLRPC {
public String post_author;
public Peer saved_from_peer;
public int saved_from_msg_id;
public String psa_type;
public static MessageFwdHeader TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
MessageFwdHeader result = null;
@ -31099,9 +31120,12 @@ public class TLRPC {
case 0xc786ddcb:
result = new TL_messageFwdHeader_layer68();
break;
case 0xec338270:
case 0x353a686b:
result = new TL_messageFwdHeader();
break;
case 0xec338270:
result = new TL_messageFwdHeader_layer112();
break;
case 0xfadff4ac:
result = new TL_messageFwdHeader_layer72();
break;
@ -31154,6 +31178,70 @@ public class TLRPC {
}
public static class TL_messageFwdHeader extends MessageFwdHeader {
public static int constructor = 0x353a686b;
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
if ((flags & 1) != 0) {
from_id = stream.readInt32(exception);
}
if ((flags & 32) != 0) {
from_name = stream.readString(exception);
}
date = stream.readInt32(exception);
if ((flags & 2) != 0) {
channel_id = stream.readInt32(exception);
}
if ((flags & 4) != 0) {
channel_post = stream.readInt32(exception);
}
if ((flags & 8) != 0) {
post_author = stream.readString(exception);
}
if ((flags & 16) != 0) {
saved_from_peer = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 16) != 0) {
saved_from_msg_id = stream.readInt32(exception);
}
if ((flags & 64) != 0) {
psa_type = stream.readString(exception);
}
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(flags);
if ((flags & 1) != 0) {
stream.writeInt32(from_id);
}
if ((flags & 32) != 0) {
stream.writeString(from_name);
}
stream.writeInt32(date);
if ((flags & 2) != 0) {
stream.writeInt32(channel_id);
}
if ((flags & 4) != 0) {
stream.writeInt32(channel_post);
}
if ((flags & 8) != 0) {
stream.writeString(post_author);
}
if ((flags & 16) != 0) {
saved_from_peer.serializeToStream(stream);
}
if ((flags & 16) != 0) {
stream.writeInt32(saved_from_msg_id);
}
if ((flags & 64) != 0) {
stream.writeString(psa_type);
}
}
}
public static class TL_messageFwdHeader_layer112 extends TL_messageFwdHeader {
public static int constructor = 0xec338270;
@ -35279,6 +35367,34 @@ public class TLRPC {
}
}
public static class TL_help_getPromoData extends TLObject {
public static int constructor = 0xc0977421;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return help_PromoData.TLdeserialize(stream, constructor, exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_help_hidePromoData extends TLObject {
public static int constructor = 0x1e251c95;
public InputPeer peer;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return Bool.TLdeserialize(stream, constructor, exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
peer.serializeToStream(stream);
}
}
public static class TL_messages_readHistory extends TLObject {
public static int constructor = 0xe306d3a;
@ -39249,19 +39365,6 @@ public class TLRPC {
}
}
public static class TL_help_getProxyData extends TLObject {
public static int constructor = 0x3d7758e1;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return help_ProxyData.TLdeserialize(stream, constructor, exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_help_getDeepLinkInfo extends TLObject {
public static int constructor = 0x3fedc75f;

View File

@ -1997,7 +1997,9 @@ public class Theme {
public static RLottieDrawable dialogs_unarchiveDrawable;
public static RLottieDrawable dialogs_pinArchiveDrawable;
public static RLottieDrawable dialogs_unpinArchiveDrawable;
public static RLottieDrawable dialogs_hidePsaDrawable;
public static boolean dialogs_archiveDrawableRecolored;
public static boolean dialogs_hidePsaDrawableRecolored;
public static boolean dialogs_archiveAvatarDrawableRecolored;
private static int dialogs_holidayDrawableOffsetX;
private static int dialogs_holidayDrawableOffsetY;
@ -2123,6 +2125,7 @@ public class Theme {
public static Drawable[] chat_pollCheckDrawable = new Drawable[2];
public static Drawable[] chat_pollCrossDrawable = new Drawable[2];
public static Drawable[] chat_pollHintDrawable = new Drawable[2];
public static Drawable[] chat_psaHelpDrawable = new Drawable[2];
public static Drawable chat_msgCallUpGreenDrawable;
public static Drawable chat_msgCallDownRedDrawable;
@ -2510,6 +2513,8 @@ public class Theme {
public static final String key_chat_botProgress = "chat_botProgress";
public static final String key_chat_inForwardedNameText = "chat_inForwardedNameText";
public static final String key_chat_outForwardedNameText = "chat_outForwardedNameText";
public static final String key_chat_inPsaNameText = "chat_inPsaNameText";
public static final String key_chat_outPsaNameText = "chat_outPsaNameText";
public static final String key_chat_inViaBotNameText = "chat_inViaBotNameText";
public static final String key_chat_outViaBotNameText = "chat_outViaBotNameText";
public static final String key_chat_stickerViaBotNameText = "chat_stickerViaBotNameText";
@ -3220,6 +3225,8 @@ public class Theme {
defaultColors.put(key_chat_botProgress, 0xffffffff);
defaultColors.put(key_chat_inForwardedNameText, 0xff3886c7);
defaultColors.put(key_chat_outForwardedNameText, 0xff55ab4f);
defaultColors.put(key_chat_inPsaNameText, 0xff5a9c39);
defaultColors.put(key_chat_outPsaNameText, 0xff5a9c39);
defaultColors.put(key_chat_inViaBotNameText, 0xff3a8ccf);
defaultColors.put(key_chat_outViaBotNameText, 0xff55ab4f);
defaultColors.put(key_chat_stickerViaBotNameText, 0xffffffff);
@ -3709,6 +3716,9 @@ public class Theme {
fallbackKeys.put(key_chat_attachLocationText, key_chat_attachLocationBackground);
fallbackKeys.put(key_chat_attachPollText, key_chat_attachPollBackground);
fallbackKeys.put(key_chat_inPsaNameText, key_avatar_nameInMessageGreen);
fallbackKeys.put(key_chat_outPsaNameText, key_avatar_nameInMessageGreen);
themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_background));
themeAccentExclusionKeys.addAll(Arrays.asList(keys_avatar_nameInMessage));
themeAccentExclusionKeys.add(key_chat_attachFileBackground);
@ -6405,11 +6415,15 @@ public class Theme {
if (dialogs_unpinArchiveDrawable != null) {
dialogs_unpinArchiveDrawable.recycle();
}
if (dialogs_hidePsaDrawable != null) {
dialogs_hidePsaDrawable.recycle();
}
dialogs_archiveAvatarDrawable = new RLottieDrawable(R.raw.chats_archiveavatar, "chats_archiveavatar", AndroidUtilities.dp(36), AndroidUtilities.dp(36), false, null);
dialogs_archiveDrawable = new RLottieDrawable(R.raw.chats_archive, "chats_archive", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
dialogs_unarchiveDrawable = new RLottieDrawable(R.raw.chats_unarchive, "chats_unarchive", AndroidUtilities.dp(AndroidUtilities.dp(36)), AndroidUtilities.dp(36));
dialogs_pinArchiveDrawable = new RLottieDrawable(R.raw.chats_hide, "chats_hide", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
dialogs_unpinArchiveDrawable = new RLottieDrawable(R.raw.chats_unhide, "chats_unhide", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
dialogs_hidePsaDrawable = new RLottieDrawable(R.raw.chat_audio_record_delete, "chats_psahide", AndroidUtilities.dp(30), AndroidUtilities.dp(30));
applyCommonTheme();
}
@ -6445,6 +6459,15 @@ public class Theme {
dialogs_unpinArchiveDrawable.setLayerColor("Line.**", getNonAnimatedColor(key_chats_archiveIcon));
dialogs_unpinArchiveDrawable.commitApplyLayerColors();
dialogs_hidePsaDrawable.beginApplyLayerColors();
dialogs_hidePsaDrawable.setLayerColor("Line 1.**", getNonAnimatedColor(key_chats_archiveBackground));
dialogs_hidePsaDrawable.setLayerColor("Line 2.**", getNonAnimatedColor(key_chats_archiveBackground));
dialogs_hidePsaDrawable.setLayerColor("Line 3.**", getNonAnimatedColor(key_chats_archiveBackground));
dialogs_hidePsaDrawable.setLayerColor("Cup Red.**", getNonAnimatedColor(key_chats_archiveIcon));
dialogs_hidePsaDrawable.setLayerColor("Box.**", getNonAnimatedColor(key_chats_archiveIcon));
dialogs_hidePsaDrawable.commitApplyLayerColors();
dialogs_hidePsaDrawableRecolored = false;
dialogs_archiveDrawable.beginApplyLayerColors();
dialogs_archiveDrawable.setLayerColor("Arrow.**", getNonAnimatedColor(key_chats_archiveBackground));
dialogs_archiveDrawable.setLayerColor("Box2.**", getNonAnimatedColor(key_chats_archiveIcon));
@ -6732,6 +6755,7 @@ public class Theme {
chat_pollCheckDrawable[a] = resources.getDrawable(R.drawable.poll_right).mutate();
chat_pollCrossDrawable[a] = resources.getDrawable(R.drawable.poll_wrong).mutate();
chat_pollHintDrawable[a] = resources.getDrawable(R.drawable.smiles_panel_objects).mutate();
chat_psaHelpDrawable[a] = resources.getDrawable(R.drawable.msg_psa).mutate();
}
calllog_msgCallUpRedDrawable = resources.getDrawable(R.drawable.ic_call_made_green_18dp).mutate();
@ -7113,6 +7137,9 @@ public class Theme {
setDrawableColor(chat_pollHintDrawable[0], getColor(key_chat_inPreviewInstantText));
setDrawableColor(chat_pollHintDrawable[1], getColor(key_chat_outPreviewInstantText));
setDrawableColor(chat_psaHelpDrawable[0], getColor(key_chat_inViews));
setDrawableColor(chat_psaHelpDrawable[1], getColor(key_chat_outViews));
setDrawableColorByKey(chat_composeShadowDrawable, key_chat_messagePanelShadow);
int color = getColor(key_chat_outAudioSeekbarFill);

View File

@ -177,7 +177,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
searchResultMessages.clear();
}
searchWas = true;
if (!searchAdapterHelper.isSearchInProgress() && delegate != null) {
if (!searchAdapterHelper.isSearchInProgress() && delegate != null && reqId == 0) {
delegate.searchStateChanged(false);
}
notifyDataSetChanged();
@ -220,6 +220,9 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
}
public void loadMoreSearchMessages() {
if (reqId != 0) {
return;
}
searchMessagesInternal(lastMessagesSearchString, lastMessagesSearchId);
}
@ -315,10 +318,10 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
notifyDataSetChanged();
}
}
if (delegate != null) {
reqId = 0;
if (!searchAdapterHelper.isSearchInProgress() && delegate != null) {
delegate.searchStateChanged(false);
}
reqId = 0;
}), ConnectionsManager.RequestFlagFailOnServerErrors);
}

View File

@ -182,7 +182,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
default void didPressInstantButton(ChatMessageCell cell, int type) {
}
default void didPressPollHint(ChatMessageCell cell, int x, int y) {
default void didPressHint(ChatMessageCell cell, int type) {
}
default String getAdminRank(int uid) {
@ -334,6 +334,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
private int noSoundCenterX;
private int forwardNameCenterX;
private long lastAnimationTime;
private long lastNamesAnimationTime;
private int documentAttachType;
private TLRPC.Document documentAttach;
private boolean drawPhotoImage;
@ -502,6 +503,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
private boolean hintButtonVisible;
private float hintButtonProgress;
private boolean hasPsaHint;
private int psaHelpX;
private int psaHelpY;
private boolean psaHintPressed;
private boolean psaButtonVisible;
private float psaButtonProgress;
private TLRPC.TL_messageReactions lastReactions;
private boolean autoPlayingMedia;
@ -1267,7 +1275,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (event.getAction() == MotionEvent.ACTION_UP) {
if (pollHintPressed) {
playSoundEffect(SoundEffectConstants.CLICK);
delegate.didPressPollHint(this, pollHintX + AndroidUtilities.dp(12), pollHintY);
delegate.didPressHint(this, 0);
pollHintPressed = false;
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null) {
selectorDrawable.setState(StateSet.NOTHING);
@ -1764,6 +1772,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
pressedBotButton = -1;
pressedVoteButton = -1;
pollHintPressed = false;
psaHintPressed = false;
linkPreviewPressed = false;
otherPressed = false;
sharePressed = false;
@ -1793,6 +1802,17 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (isAvatarVisible && avatarImage.isInsideImage(x, y + getTop())) {
avatarPressed = true;
result = true;
} else if (psaButtonVisible && psaHelpX != -1 && x >= psaHelpX && x <= psaHelpX + AndroidUtilities.dp(40) && y >= psaHelpY && y <= psaHelpY + AndroidUtilities.dp(40)) {
psaHintPressed = true;
createSelectorDrawable();
selectorDrawableMaskType = 3;
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null) {
selectorDrawable.setBounds(psaHelpX - AndroidUtilities.dp(8), psaHelpY - AndroidUtilities.dp(8), psaHelpX + AndroidUtilities.dp(32), psaHelpY + AndroidUtilities.dp(32));
selectorDrawable.setState(pressedState);
selectorDrawable.setHotspot(x, y);
}
result = true;
invalidate();
} else if (drawForwardedName && forwardedNameLayout[0] != null && x >= forwardNameX && x <= forwardNameX + forwardedNameWidth && y >= forwardNameY && y <= forwardNameY + AndroidUtilities.dp(32)) {
if (viaWidth != 0 && x >= forwardNameX + viaNameWidth + AndroidUtilities.dp(4)) {
forwardBotPressed = true;
@ -1855,6 +1875,16 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
avatarPressed = false;
}
}
} else if (psaHintPressed) {
if (event.getAction() == MotionEvent.ACTION_UP) {
playSoundEffect(SoundEffectConstants.CLICK);
delegate.didPressHint(this, 1);
psaHintPressed = false;
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null) {
selectorDrawable.setState(StateSet.NOTHING);
}
invalidate();
}
} else if (forwardNamePressed) {
if (event.getAction() == MotionEvent.ACTION_UP) {
forwardNamePressed = false;
@ -2674,6 +2704,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
pressedBotButton = -1;
pressedVoteButton = -1;
pollHintPressed = false;
psaHintPressed = false;
linkPreviewHeight = 0;
mediaOffsetY = 0;
documentAttachType = DOCUMENT_ATTACH_TYPE_NONE;
@ -2720,6 +2751,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
imageBackgroundGradientRotation = 45;
imageBackgroundSideColor = 0;
mediaBackground = false;
hasPsaHint = messageObject.messageOwner.fwd_from != null && !TextUtils.isEmpty(messageObject.messageOwner.fwd_from.psa_type);
if (hasPsaHint) {
createSelectorDrawable();
}
photoImage.setAlpha(1.0f);
if (messageChanged || dataChanged) {
pollButtons.clear();
@ -5281,16 +5316,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
imagePressed = false;
gamePreviewPressed = false;
if (instantPressed) {
if (pressedVoteButton != -1 || pollHintPressed || psaHintPressed || instantPressed) {
instantPressed = instantButtonPressed = false;
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null) {
selectorDrawable.setState(StateSet.NOTHING);
}
invalidate();
}
if (pressedVoteButton != -1 || pollHintPressed) {
pressedVoteButton = -1;
pollHintPressed = false;
psaHintPressed = false;
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null) {
selectorDrawable.setState(StateSet.NOTHING);
}
@ -5301,15 +5331,28 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
}
public void showPollHintButton(boolean show, boolean animated) {
if (hintButtonVisible == show) {
return;
public void showHintButton(boolean show, boolean animated, int type) {
if (type == -1 || type == 0) {
if (hintButtonVisible == show) {
return;
}
hintButtonVisible = show;
if (!animated) {
hintButtonProgress = show ? 1.0f : 0.0f;
} else {
invalidate();
}
}
hintButtonVisible = show;
if (!animated) {
hintButtonProgress = show ? 1.0f : 0.0f;
} else {
invalidate();
if (type == -1 || type == 1) {
if (psaButtonVisible == show) {
return;
}
psaButtonVisible = show;
if (!animated) {
psaButtonProgress = show ? 1.0f : 0.0f;
} else {
invalidate();
}
}
}
@ -5748,6 +5791,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (Build.VERSION.SDK_INT < 21) {
return;
}
int color;
if (psaHintPressed) {
color = Theme.getColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outViews : Theme.key_chat_inViews);
} else {
color = Theme.getColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outPreviewInstantText : Theme.key_chat_inPreviewInstantText);
}
if (selectorDrawable == null) {
final Paint maskPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
maskPaint.setColor(0xffffffff);
@ -5811,7 +5860,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
selectorDrawable = new RippleDrawable(colorStateList, null, maskDrawable);
selectorDrawable.setCallback(this);
} else {
Theme.setSelectorDrawableColor(selectorDrawable, Theme.getColor(currentMessageObject.isOutOwner() ? Theme.key_chat_outPreviewInstantText : Theme.key_chat_inPreviewInstantText) & 0x19ffffff, true);
Theme.setSelectorDrawableColor(selectorDrawable, color & 0x19ffffff, true);
}
selectorDrawable.setVisible(true, false);
}
@ -8206,7 +8255,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
boolean authorName = (!pinnedTop || ChatObject.isChannel(currentChat) && !currentChat.megagroup) && drawName && isChat && !currentMessageObject.isOutOwner();
boolean viaBot = (messageObject.messageOwner.fwd_from == null || messageObject.type == 14) && viaUsername != null;
if (authorName || viaBot) {
if (!hasPsaHint && (authorName || viaBot)) {
drawNameLayout = true;
nameWidth = getMaxNameWidth();
if (nameWidth < 0) {
@ -8330,6 +8379,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
forwardedNameWidth = getMaxNameWidth();
String forwardedString = getForwardedMessageText(messageObject);
if (hasPsaHint) {
forwardedNameWidth -= AndroidUtilities.dp(36);
}
String from = LocaleController.getString("From", R.string.From);
String fromFormattedString = LocaleController.getString("FromFormatted", R.string.FromFormatted);
int idx = fromFormattedString.indexOf("%1$s");
@ -8358,9 +8411,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
lastLine = TextUtils.ellipsize(lastLine, Theme.chat_forwardNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END);
try {
forwardedNameLayout[1] = new StaticLayout(lastLine, Theme.chat_forwardNamePaint, forwardedNameWidth + AndroidUtilities.dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
lastLine = TextUtils.ellipsize(AndroidUtilities.replaceTags(LocaleController.getString("ForwardedMessage", R.string.ForwardedMessage)), Theme.chat_forwardNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END);
lastLine = TextUtils.ellipsize(AndroidUtilities.replaceTags(forwardedString), Theme.chat_forwardNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END);
forwardedNameLayout[0] = new StaticLayout(lastLine, Theme.chat_forwardNamePaint, forwardedNameWidth + AndroidUtilities.dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
forwardedNameWidth = Math.max((int) Math.ceil(forwardedNameLayout[0].getLineWidth(0)), (int) Math.ceil(forwardedNameLayout[1].getLineWidth(0)));
if (hasPsaHint) {
forwardedNameWidth += AndroidUtilities.dp(36);
}
forwardNameOffsetX[0] = forwardedNameLayout[0].getLineLeft(0);
forwardNameOffsetX[1] = forwardedNameLayout[1].getLineLeft(0);
if (messageObject.type != 5) {
@ -8494,7 +8550,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} else if (currentForwardName != null) {
currentForwardNameString = currentForwardName;
}
name = LocaleController.getString("ForwardedMessage", R.string.ForwardedMessage);
name = getForwardedMessageText(messageObject);
String from = LocaleController.getString("From", R.string.From);
String fromFormattedString = LocaleController.getString("FromFormatted", R.string.FromFormatted);
int idx = fromFormattedString.indexOf("%1$s");
@ -8563,6 +8619,18 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
requestLayout();
}
private String getForwardedMessageText(MessageObject messageObject) {
if (hasPsaHint) {
String forwardedString = LocaleController.getString("PsaMessage_" + messageObject.messageOwner.fwd_from.psa_type);
if (forwardedString == null) {
forwardedString = LocaleController.getString("PsaMessageDefault", R.string.PsaMessageDefault);
}
return forwardedString;
} else {
return LocaleController.getString("ForwardedMessage", R.string.ForwardedMessage);
}
}
public int getCaptionHeight() {
return addedCaptionHeight;
}
@ -8979,6 +9047,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
public void drawNamesLayout(Canvas canvas) {
long newAnimationTime = SystemClock.elapsedRealtime();
long dt = newAnimationTime - lastNamesAnimationTime;
if (dt > 17) {
dt = 17;
}
lastNamesAnimationTime = newAnimationTime;
if (drawNameLayout && nameLayout != null) {
canvas.save();
@ -9059,10 +9134,18 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
} else {
forwardNameY = AndroidUtilities.dp(10 + (drawNameLayout ? 19 : 0));
if (currentMessageObject.isOutOwner()) {
Theme.chat_forwardNamePaint.setColor(Theme.getColor(Theme.key_chat_outForwardedNameText));
if (hasPsaHint) {
Theme.chat_forwardNamePaint.setColor(Theme.getColor(Theme.key_chat_outPsaNameText));
} else {
Theme.chat_forwardNamePaint.setColor(Theme.getColor(Theme.key_chat_outForwardedNameText));
}
forwardNameX = backgroundDrawableLeft + AndroidUtilities.dp(11) + getExtraTextX();
} else {
Theme.chat_forwardNamePaint.setColor(Theme.getColor(Theme.key_chat_inForwardedNameText));
if (hasPsaHint) {
Theme.chat_forwardNamePaint.setColor(Theme.getColor(Theme.key_chat_inPsaNameText));
} else {
Theme.chat_forwardNamePaint.setColor(Theme.getColor(Theme.key_chat_inForwardedNameText));
}
if (mediaBackground) {
forwardNameX = backgroundDrawableLeft + AndroidUtilities.dp(11) + getExtraTextX();
} else {
@ -9076,6 +9159,46 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
forwardedNameLayout[a].draw(canvas);
canvas.restore();
}
if (hasPsaHint) {
if (psaButtonVisible || psaButtonProgress > 0) {
Drawable drawable = Theme.chat_psaHelpDrawable[currentMessageObject.isOutOwner() ? 1 : 0];
if (pollVoteInProgress) {
drawable.setAlpha((int) (255 * pollAnimationProgress));
} else {
drawable.setAlpha(255);
}
psaHelpX = currentBackgroundDrawable.getBounds().right - drawable.getIntrinsicWidth() - AndroidUtilities.dp(currentMessageObject.isOutOwner() ? 20 : 14);
psaHelpY = forwardNameY + AndroidUtilities.dp(4);
int cx = psaHelpX + drawable.getIntrinsicWidth() / 2;
int cy = psaHelpY + drawable.getIntrinsicHeight() / 2;
float scale = psaButtonVisible && psaButtonProgress < 1 ? AnimationProperties.overshootInterpolator.getInterpolation(psaButtonProgress) : psaButtonProgress;
int w = (int) (drawable.getIntrinsicWidth() * scale);
int h = (int) (drawable.getIntrinsicHeight() * scale);
drawable.setBounds(cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2);
drawable.draw(canvas);
if (Build.VERSION.SDK_INT >= 21 && selectorDrawable != null && selectorDrawableMaskType == 3) {
canvas.save();
canvas.scale(psaButtonProgress, psaButtonProgress, selectorDrawable.getBounds().centerX(), selectorDrawable.getBounds().centerY());
selectorDrawable.draw(canvas);
canvas.restore();
}
}
if (psaButtonVisible && psaButtonProgress < 1.0f) {
psaButtonProgress += dt / 180.0f;
if (psaButtonProgress > 1.0f) {
psaButtonProgress = 1.0f;
}
invalidate();
} else if (!psaButtonVisible && psaButtonProgress > 0.0f) {
psaButtonProgress -= dt / 180.0f;
if (psaButtonProgress < 0.0f) {
psaButtonProgress = 0.0f;
}
invalidate();
}
}
}
if (replyNameLayout != null) {

View File

@ -152,6 +152,8 @@ public class DialogCell extends BaseCell {
private int timeTop;
private StaticLayout timeLayout;
private boolean promoDialog;
private boolean drawCheck1;
private boolean drawCheck2;
private boolean drawClock;
@ -1007,9 +1009,22 @@ public class DialogCell extends BaseCell {
}
}
if (dialogsType == 0 && MessagesController.getInstance(currentAccount).isProxyDialog(currentDialogId, true)) {
promoDialog = false;
MessagesController messagesController = MessagesController.getInstance(currentAccount);
if (dialogsType == 0 && messagesController.isPromoDialog(currentDialogId, true)) {
drawPinBackground = true;
timeString = LocaleController.getString("UseProxySponsor", R.string.UseProxySponsor);
promoDialog = true;
if (messagesController.promoDialogType == MessagesController.PROMO_TYPE_PROXY) {
timeString = LocaleController.getString("UseProxySponsor", R.string.UseProxySponsor);
} else if (messagesController.promoDialogType == MessagesController.PROMO_TYPE_PSA) {
timeString = LocaleController.getString("PsaType_" + messagesController.promoPsaType);
if (TextUtils.isEmpty(timeString)) {
timeString = LocaleController.getString("PsaTypeDefault", R.string.PsaTypeDefault);
}
if (!TextUtils.isEmpty(messagesController.promoPsaMessage)) {
messageString = messagesController.promoPsaMessage;
}
}
}
if (currentDialogFolderId != 0) {
@ -1737,7 +1752,12 @@ public class DialogCell extends BaseCell {
translationDrawable = Theme.dialogs_pinArchiveDrawable;
}
} else {
if (folderId == 0) {
if (promoDialog) {
backgroundColor = Theme.getColor(Theme.key_chats_archiveBackground);
revealBackgroundColor = Theme.getColor(Theme.key_chats_archivePinBackground);
archive = LocaleController.getString("PsaHide", R.string.PsaHide);
translationDrawable = Theme.dialogs_hidePsaDrawable;
} else if (folderId == 0) {
backgroundColor = Theme.getColor(Theme.key_chats_archiveBackground);
revealBackgroundColor = Theme.getColor(Theme.key_chats_archivePinBackground);
archive = LocaleController.getString("Archive", R.string.Archive);
@ -1760,9 +1780,19 @@ public class DialogCell extends BaseCell {
if (currentRevealProgress < 1.0f) {
Theme.dialogs_pinnedPaint.setColor(backgroundColor);
canvas.drawRect(tx - AndroidUtilities.dp(8), 0, getMeasuredWidth(), getMeasuredHeight(), Theme.dialogs_pinnedPaint);
if (currentRevealProgress == 0 && Theme.dialogs_archiveDrawableRecolored) {
Theme.dialogs_archiveDrawable.setLayerColor("Arrow.**", Theme.getNonAnimatedColor(Theme.key_chats_archiveBackground));
Theme.dialogs_archiveDrawableRecolored = false;
if (currentRevealProgress == 0) {
if (Theme.dialogs_archiveDrawableRecolored) {
Theme.dialogs_archiveDrawable.setLayerColor("Arrow.**", Theme.getNonAnimatedColor(Theme.key_chats_archiveBackground));
Theme.dialogs_archiveDrawableRecolored = false;
}
if (Theme.dialogs_hidePsaDrawableRecolored) {
Theme.dialogs_hidePsaDrawable.beginApplyLayerColors();
Theme.dialogs_hidePsaDrawable.setLayerColor("Line 1.**", Theme.getNonAnimatedColor(Theme.key_chats_archiveBackground));
Theme.dialogs_hidePsaDrawable.setLayerColor("Line 2.**", Theme.getNonAnimatedColor(Theme.key_chats_archiveBackground));
Theme.dialogs_hidePsaDrawable.setLayerColor("Line 3.**", Theme.getNonAnimatedColor(Theme.key_chats_archiveBackground));
Theme.dialogs_hidePsaDrawable.commitApplyLayerColors();
Theme.dialogs_hidePsaDrawableRecolored = false;
}
}
}
int drawableX = getMeasuredWidth() - AndroidUtilities.dp(43) - translationDrawable.getIntrinsicWidth() / 2;
@ -1783,6 +1813,14 @@ public class DialogCell extends BaseCell {
Theme.dialogs_archiveDrawable.setLayerColor("Arrow.**", Theme.getNonAnimatedColor(Theme.key_chats_archivePinBackground));
Theme.dialogs_archiveDrawableRecolored = true;
}
if (!Theme.dialogs_hidePsaDrawableRecolored) {
Theme.dialogs_hidePsaDrawable.beginApplyLayerColors();
Theme.dialogs_hidePsaDrawable.setLayerColor("Line 1.**", Theme.getNonAnimatedColor(Theme.key_chats_archivePinBackground));
Theme.dialogs_hidePsaDrawable.setLayerColor("Line 2.**", Theme.getNonAnimatedColor(Theme.key_chats_archivePinBackground));
Theme.dialogs_hidePsaDrawable.setLayerColor("Line 3.**", Theme.getNonAnimatedColor(Theme.key_chats_archivePinBackground));
Theme.dialogs_hidePsaDrawable.commitApplyLayerColors();
Theme.dialogs_hidePsaDrawableRecolored = true;
}
}
canvas.save();

View File

@ -72,6 +72,7 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
private ArrayList<Theme.ThemeInfo> darkThemes;
private ArrayList<Theme.ThemeInfo> defaultThemes;
private int currentType;
private int prevCount;
private class ThemesListAdapter extends RecyclerListView.SelectionAdapter {
@ -107,7 +108,7 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
@Override
public int getItemCount() {
return defaultThemes.size() + darkThemes.size();
return prevCount = defaultThemes.size() + darkThemes.size();
}
}
@ -728,6 +729,9 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
}
public void notifyDataSetChanged(int width) {
if (prevCount == adapter.getItemCount()) {
return;
}
adapter.notifyDataSetChanged();
Theme.ThemeInfo t = currentType == ThemeActivity.THEME_TYPE_NIGHT ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme();
if (prevThemeInfo != t) {

View File

@ -353,7 +353,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private UndoView topUndoView;
private boolean openKeyboardOnAttachMenuClose;
private MessageObject pollHintMessageObject;
private MessageObject hintMessageObject;
private int hintMessageType;
private RecyclerListView messagesSearchListView;
private MessagesSearchAdapter messagesSearchAdapter;
@ -11576,7 +11577,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
((ChatMessageCell) pollView).shakeView();
pollView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
showPollSolution(cell.getMessageObject(), results);
cell.showPollHintButton(false, true);
cell.showHintButton(false, true, 0);
}
break;
}
@ -12319,17 +12320,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
private void showPollSolution(MessageObject messageObject, TLRPC.PollResults results) {
if (results == null || topUndoView == null || TextUtils.isEmpty(results.solution)) {
private void showInfoHint(MessageObject messageObject, CharSequence text, int type) {
if (topUndoView == null) {
return;
}
CharSequence text;
if (!results.solution_entities.isEmpty()) {
text = new SpannableStringBuilder(results.solution);
MessageObject.addEntitiesToText(text, results.solution_entities, false, true, true, false);
} else {
text = results.solution;
}
Runnable runnable = () -> {
if (chatListView != null) {
int count = chatListView.getChildCount();
@ -12340,15 +12334,30 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
ChatMessageCell cell = (ChatMessageCell) view;
MessageObject message = cell.getMessageObject();
if (message != null && message.equals(pollHintMessageObject)) {
cell.showPollHintButton(true, true);
if (message != null && message.equals(hintMessageObject)) {
cell.showHintButton(true, true, type);
}
}
}
pollHintMessageObject = null;
hintMessageObject = null;
};
topUndoView.showWithAction(0, UndoView.ACTION_QUIZ_VOTE_INFO, text, runnable, runnable);
pollHintMessageObject = messageObject;
topUndoView.showWithAction(0, UndoView.ACTION_TEXT_INFO, text, runnable, runnable);
hintMessageObject = messageObject;
hintMessageType = type;
}
private void showPollSolution(MessageObject messageObject, TLRPC.PollResults results) {
if (results == null || TextUtils.isEmpty(results.solution)) {
return;
}
CharSequence text;
if (!results.solution_entities.isEmpty()) {
text = new SpannableStringBuilder(results.solution);
MessageObject.addEntitiesToText(text, results.solution_entities, false, true, true, false);
} else {
text = results.solution;
}
showInfoHint(messageObject, text, 0);
}
private void updateSearchButtons(int mask, int num, int count) {
@ -12442,6 +12451,48 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
showScheduledOrNoSoundHint();
if (!backward && firstOpen) {
if (getMessagesController().isPromoDialog(dialog_id, true)) {
int type = getMessagesController().promoDialogType;
String message;
SharedPreferences preferences = MessagesController.getGlobalNotificationsSettings();
boolean check;
if (type == MessagesController.PROMO_TYPE_PROXY) {
if (preferences.getLong("proxychannel", 0) != dialog_id) {
message = LocaleController.getString("UseProxySponsorInfo", R.string.UseProxySponsorInfo);
} else {
message = null;
}
} else if (type == MessagesController.PROMO_TYPE_PSA) {
String psaType = getMessagesController().promoPsaType;
if (!preferences.getBoolean(psaType + "_shown", false)) {
message = LocaleController.getString("PsaInfo_" + psaType);
if (TextUtils.isEmpty(message)) {
message = LocaleController.getString("PsaInfoDefault", R.string.PsaInfoDefault);
}
} else {
message = null;
}
} else {
message = null;
}
if (!TextUtils.isEmpty(message)) {
if (topUndoView != null) {
if (type == MessagesController.PROMO_TYPE_PROXY) {
preferences.edit().putLong("proxychannel", dialog_id).commit();
} else if (type == MessagesController.PROMO_TYPE_PSA) {
String psaType = getMessagesController().promoPsaType;
preferences.edit().putBoolean(psaType + "_shown", true).commit();
}
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(message);
MessageObject.addLinks(false, stringBuilder);
topUndoView.showWithAction(0, UndoView.ACTION_TEXT_INFO, stringBuilder, null, null);
}
}
}
firstOpen = false;
}
}
}
@ -13245,20 +13296,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return AndroidUtilities.dp(48);
});
if (firstOpen) {
if (getMessagesController().isProxyDialog(dialog_id, true)) {
SharedPreferences preferences = MessagesController.getGlobalNotificationsSettings();
if (preferences.getLong("proxychannel", 0) != dialog_id) {
preferences.edit().putLong("proxychannel", dialog_id).commit();
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("UseProxySponsorInfo", R.string.UseProxySponsorInfo));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showDialog(builder.create());
}
}
}
checkActionBarMenu();
if (replyImageLocation != null && replyImageView != null) {
replyImageView.setImage(ImageLocation.getForObject(replyImageLocation, replyImageLocationObject), "50_50", ImageLocation.getForObject(replyImageThumbLocation, replyImageLocationObject), "50_50_b", null, replyImageSize, replyImageCacheType, replyingMessageObject);
@ -16447,13 +16484,24 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatMessageCell.setDelegate(new ChatMessageCell.ChatMessageCellDelegate() {
@Override
public void didPressPollHint(ChatMessageCell cell, int x, int y) {
if (getParentActivity() == null) {
return;
public void didPressHint(ChatMessageCell cell, int type) {
if (type == 0) {
TLRPC.TL_messageMediaPoll media = (TLRPC.TL_messageMediaPoll) cell.getMessageObject().messageOwner.media;
showPollSolution(cell.getMessageObject(), media.results);
} else if (type == 1) {
MessageObject messageObject = cell.getMessageObject();
if (TextUtils.isEmpty(messageObject.messageOwner.fwd_from.psa_type)) {
return;
}
CharSequence text = LocaleController.getString("PsaMessageInfo_" + messageObject.messageOwner.fwd_from.psa_type);
if (TextUtils.isEmpty(text)) {
text = LocaleController.getString("PsaMessageInfoDefault", R.string.PsaMessageInfoDefault);
}
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(text);
MessageObject.addLinks(false, stringBuilder);
showInfoHint(messageObject, stringBuilder, 1);
}
TLRPC.TL_messageMediaPoll media = (TLRPC.TL_messageMediaPoll) cell.getMessageObject().messageOwner.media;
showPollSolution(cell.getMessageObject(), media.results);
cell.showPollHintButton(false, true);
cell.showHintButton(false, true, type);
}
@Override
@ -17144,10 +17192,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (holder.itemView instanceof ChatMessageCell) {
final ChatMessageCell messageCell = (ChatMessageCell) holder.itemView;
MessageObject message = messageCell.getMessageObject();
if (pollHintMessageObject != null && pollHintMessageObject.equals(message)) {
messageCell.showPollHintButton(false, false);
} else {
messageCell.showPollHintButton(true, false);
messageCell.showHintButton(true, false, -1);
if (hintMessageObject != null && hintMessageObject.equals(message)) {
messageCell.showHintButton(false, false, hintMessageType);
}
boolean selected = false;
@ -17629,6 +17676,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_timeBackgroundPaint, null, null, Theme.key_chat_mediaTimeBackground));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inForwardedNameText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outForwardedNameText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPsaNameText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPsaNameText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inViaBotNameText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outViaBotNameText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerViaBotNameText));
@ -17750,6 +17799,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPollWrongAnswer));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_pollHintDrawable[0]}, null, Theme.key_chat_inPreviewInstantText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_pollHintDrawable[1]}, null, Theme.key_chat_outPreviewInstantText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_psaHelpDrawable[0]}, null, Theme.key_chat_inViews));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_psaHelpDrawable[1]}, null, Theme.key_chat_outViews));
themeDescriptions.add(new ThemeDescription(messagesSearchListView, 0, new Class[]{DialogCell.class}, null, Theme.avatarDrawables, null, Theme.key_avatar_text));
themeDescriptions.add(new ThemeDescription(messagesSearchListView, 0, new Class[]{DialogCell.class}, Theme.dialogs_countPaint, null, null, Theme.key_chats_unreadCounter));

View File

@ -2111,6 +2111,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
currentAttachLayout.setVisibility(View.GONE);
currentAttachLayout.onHidden();
currentAttachLayout = photoLayout;
setAllowNestedScroll(true);
if (currentAttachLayout.getParent() == null) {
containerView.addView(currentAttachLayout, 0, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
}

View File

@ -217,6 +217,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
notificationCenter.addObserver(this, NotificationCenter.mediaDidLoad);
notificationCenter.addObserver(this, NotificationCenter.messagesDeleted);
notificationCenter.addObserver(this, NotificationCenter.replaceMessagesObjects);
notificationCenter.addObserver(this, NotificationCenter.chatInfoDidLoad);
}
public void addDelegate(SharedMediaPreloaderDelegate delegate) {
@ -240,6 +241,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
notificationCenter.removeObserver(this, NotificationCenter.mediaDidLoad);
notificationCenter.removeObserver(this, NotificationCenter.messagesDeleted);
notificationCenter.removeObserver(this, NotificationCenter.replaceMessagesObjects);
notificationCenter.removeObserver(this, NotificationCenter.chatInfoDidLoad);
}
public int[] getLastMediaCount() {
@ -439,6 +441,11 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
}
}
}
} else if (id == NotificationCenter.chatInfoDidLoad) {
TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
if (dialogId < 0 && chatFull.id == -dialogId) {
setChatInfo(chatFull);
}
}
}
@ -448,6 +455,13 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
parentFragment.getMediaDataController().getMediaCounts(mergeDialogId, parentFragment.getClassGuid());
}
}
private void setChatInfo(TLRPC.ChatFull chatInfo) {
if (chatInfo != null && chatInfo.migrated_from_chat_id != 0 && mergeDialogId == 0) {
mergeDialogId = -chatInfo.migrated_from_chat_id;
parentFragment.getMediaDataController().getMediaCounts(mergeDialogId, parentFragment.getClassGuid());
}
}
}
private PhotoViewer.PhotoViewerProvider provider = new PhotoViewer.EmptyPhotoViewerProvider() {
@ -638,13 +652,13 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
private boolean isActionModeShowed;
public SharedMediaLayout(Context context, long did, SharedMediaPreloader preloader, int commonGroupsCount, ArrayList<Integer> sortedUsers, TLRPC.ChatFull chatInfo, ProfileActivity parent) {
public SharedMediaLayout(Context context, long did, SharedMediaPreloader preloader, int commonGroupsCount, ArrayList<Integer> sortedUsers, TLRPC.ChatFull chatInfo, boolean membersFirst, ProfileActivity parent) {
super(context);
sharedMediaPreloader = preloader;
int[] mediaCount = preloader.getLastMediaCount();
hasMedia = new int[]{mediaCount[0], mediaCount[1], mediaCount[2], mediaCount[3], mediaCount[4], mediaCount[5], commonGroupsCount};
if (chatInfo != null) {
if (membersFirst) {
initialTab = 7;
} else {
for (int a = 0; a < hasMedia.length; a++) {
@ -1360,7 +1374,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter
} else {
threshold = 6;
}
if (visibleItemCount != 0 && firstVisibleItem + visibleItemCount > totalItemCount - threshold && !sharedMediaData[mediaPage.selectedType].loading) {
if (firstVisibleItem + visibleItemCount > totalItemCount - threshold && !sharedMediaData[mediaPage.selectedType].loading) {
int type;
if (mediaPage.selectedType == 0) {
type = MediaDataController.MEDIA_PHOTOVIDEO;

View File

@ -98,7 +98,7 @@ public class UndoView extends FrameLayout {
public final static int ACTION_FILTERS_AVAILABLE = 15;
public final static int ACTION_DICE_INFO = 16;
public final static int ACTION_DICE_NO_SEND_INFO = 17;
public final static int ACTION_QUIZ_VOTE_INFO = 18;
public final static int ACTION_TEXT_INFO = 18;
public final static int ACTION_CACHE_WAS_CLEARED = 19;
private CharSequence infoText;
@ -519,7 +519,7 @@ public class UndoView extends FrameLayout {
subinfoTextView.setVisibility(GONE);
leftImageView.setVisibility(VISIBLE);
} else if (currentAction == ACTION_QUIZ_VOTE_INFO) {
} else if (currentAction == ACTION_TEXT_INFO) {
CharSequence info = (CharSequence) infoObject;
timeLeft = Math.max(4000, Math.min(info.length() / 50 * 1600, 10000));
infoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
@ -638,8 +638,8 @@ public class UndoView extends FrameLayout {
}
width -= AndroidUtilities.dp(16);
measureChildWithMargins(infoTextView, MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), 0, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), 0);
undoViewHeight = infoTextView.getMeasuredHeight() + AndroidUtilities.dp(currentAction == ACTION_DICE_INFO || currentAction == ACTION_DICE_NO_SEND_INFO || currentAction == ACTION_QUIZ_VOTE_INFO ? 14 : 28);
if (currentAction == ACTION_QUIZ_VOTE_INFO) {
undoViewHeight = infoTextView.getMeasuredHeight() + AndroidUtilities.dp(currentAction == ACTION_DICE_INFO || currentAction == ACTION_DICE_NO_SEND_INFO || currentAction == ACTION_TEXT_INFO ? 14 : 28);
if (currentAction == ACTION_TEXT_INFO) {
undoViewHeight = Math.max(undoViewHeight, AndroidUtilities.dp(52));
}
}

View File

@ -170,6 +170,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
private int archivePullViewState;
private RadialProgressView progressView;
private int lastItemsCount;
private DialogsItemAnimator dialogsItemAnimator;
public ViewPage(Context context) {
super(context);
@ -258,7 +259,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
private int dialogRemoveFinished;
private int dialogInsertFinished;
private int dialogChangeFinished;
private DialogsItemAnimator dialogsItemAnimator;
private AlertDialog permissionDialog;
private boolean askAboutContacts = true;
@ -306,6 +306,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
private int canClearCacheCount;
private int canReportSpamCount;
private int canUnarchiveCount;
private boolean canDeletePsaSelected;
private int topPadding;
@ -998,7 +999,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
appliedPaddingTop = getPaddingTop();
if ((dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0) && !dialogsItemAnimator.isRunning()) {
if ((dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0) && !parentPage.dialogsItemAnimator.isRunning()) {
onDialogAnimationFinished();
}
}
@ -1155,7 +1156,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
@Override
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
if (waitingForDialogsAnimationEnd() || parentLayout != null && parentLayout.isInPreviewMode()) {
if (waitingForDialogsAnimationEnd(parentPage) || parentLayout != null && parentLayout.isInPreviewMode()) {
return 0;
}
if (swipingFolder && swipeFolderBack) {
@ -1174,7 +1175,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
movingView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
return makeMovementFlags(ItemTouchHelper.UP | ItemTouchHelper.DOWN, 0);
} else {
if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE || !allowSwipeDuringCurrentTouch || dialogId == getUserConfig().clientUserId || dialogId == 777000 || getMessagesController().isProxyDialog(dialogId, false)) {
if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE || !allowSwipeDuringCurrentTouch || dialogId == getUserConfig().clientUserId || dialogId == 777000 || getMessagesController().isPromoDialog(dialogId, false) && getMessagesController().promoDialogType != MessagesController.PROMO_TYPE_PSA) {
return 0;
}
swipeFolderBack = false;
@ -1242,83 +1243,91 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
int pinnedNum = dialog.pinnedNum;
slidingView = null;
parentPage.listView.invalidate();
int added = getMessagesController().addDialogToFolder(dialog.id, folderId == 0 ? 1 : 0, -1, 0);
int lastItemPosition = parentPage.layoutManager.findLastVisibleItemPosition();
if (lastItemPosition == count - 1) {
parentPage.layoutManager.findViewByPosition(lastItemPosition).requestLayout();
}
if (added != 2 || position != 0) {
dialogsItemAnimator.prepareForRemove();
if (getMessagesController().isPromoDialog(dialog.id, false)) {
getMessagesController().hidePromoDialog();
parentPage.dialogsItemAnimator.prepareForRemove();
parentPage.lastItemsCount--;
parentPage.dialogsAdapter.notifyItemRemoved(position);
dialogRemoveFinished = 2;
}
if (folderId == 0) {
if (added == 2) {
dialogsItemAnimator.prepareForRemove();
if (position == 0) {
dialogChangeFinished = 2;
setDialogsListFrozen(true);
parentPage.dialogsAdapter.notifyItemChanged(0);
} else {
parentPage.lastItemsCount++;
parentPage.dialogsAdapter.notifyItemInserted(0);
if (!SharedConfig.archiveHidden && parentPage.layoutManager.findFirstVisibleItemPosition() == 0) {
disableActionBarScrolling = true;
parentPage.listView.smoothScrollBy(0, -AndroidUtilities.dp(SharedConfig.useThreeLinesLayout ? 78 : 72));
}
}
ArrayList<TLRPC.Dialog> dialogs = getDialogsArray(currentAccount, parentPage.dialogsType, folderId, false);
frozenDialogsList.add(0, dialogs.get(0));
} else if (added == 1) {
RecyclerView.ViewHolder holder = parentPage.listView.findViewHolderForAdapterPosition(0);
if (holder != null && holder.itemView instanceof DialogCell) {
DialogCell cell = (DialogCell) holder.itemView;
cell.checkCurrentDialogIndex(true);
cell.animateArchiveAvatar();
}
} else {
int added = getMessagesController().addDialogToFolder(dialog.id, folderId == 0 ? 1 : 0, -1, 0);
if (added != 2 || position != 0) {
parentPage.dialogsItemAnimator.prepareForRemove();
parentPage.lastItemsCount--;
parentPage.dialogsAdapter.notifyItemRemoved(position);
dialogRemoveFinished = 2;
}
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
boolean hintShowed = preferences.getBoolean("archivehint_l", false) || SharedConfig.archiveHidden;
if (!hintShowed) {
preferences.edit().putBoolean("archivehint_l", true).commit();
}
getUndoView().showWithAction(dialog.id, hintShowed ? UndoView.ACTION_ARCHIVE : UndoView.ACTION_ARCHIVE_HINT, null, () -> {
dialogsListFrozen = true;
getMessagesController().addDialogToFolder(dialog.id, 0, pinnedNum, 0);
dialogsListFrozen = false;
ArrayList<TLRPC.Dialog> dialogs = getMessagesController().getDialogs(0);
int index = dialogs.indexOf(dialog);
if (index >= 0) {
ArrayList<TLRPC.Dialog> archivedDialogs = getMessagesController().getDialogs(1);
if (!archivedDialogs.isEmpty() || index != 1) {
dialogInsertFinished = 2;
if (folderId == 0) {
if (added == 2) {
parentPage.dialogsItemAnimator.prepareForRemove();
if (position == 0) {
dialogChangeFinished = 2;
setDialogsListFrozen(true);
dialogsItemAnimator.prepareForRemove();
parentPage.dialogsAdapter.notifyItemChanged(0);
} else {
parentPage.lastItemsCount++;
parentPage.dialogsAdapter.notifyItemInserted(index);
}
if (archivedDialogs.isEmpty()) {
dialogs.remove(0);
if (index == 1) {
dialogChangeFinished = 2;
setDialogsListFrozen(true);
parentPage.dialogsAdapter.notifyItemChanged(0);
} else {
frozenDialogsList.remove(0);
dialogsItemAnimator.prepareForRemove();
parentPage.lastItemsCount--;
parentPage.dialogsAdapter.notifyItemRemoved(0);
parentPage.dialogsAdapter.notifyItemInserted(0);
if (!SharedConfig.archiveHidden && parentPage.layoutManager.findFirstVisibleItemPosition() == 0) {
disableActionBarScrolling = true;
parentPage.listView.smoothScrollBy(0, -AndroidUtilities.dp(SharedConfig.useThreeLinesLayout ? 78 : 72));
}
}
} else {
parentPage.dialogsAdapter.notifyDataSetChanged();
ArrayList<TLRPC.Dialog> dialogs = getDialogsArray(currentAccount, parentPage.dialogsType, folderId, false);
frozenDialogsList.add(0, dialogs.get(0));
} else if (added == 1) {
RecyclerView.ViewHolder holder = parentPage.listView.findViewHolderForAdapterPosition(0);
if (holder != null && holder.itemView instanceof DialogCell) {
DialogCell cell = (DialogCell) holder.itemView;
cell.checkCurrentDialogIndex(true);
cell.animateArchiveAvatar();
}
}
});
}
if (folderId != 0 && frozenDialogsList.isEmpty()) {
parentPage.listView.setEmptyView(null);
parentPage.progressView.setVisibility(View.INVISIBLE);
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
boolean hintShowed = preferences.getBoolean("archivehint_l", false) || SharedConfig.archiveHidden;
if (!hintShowed) {
preferences.edit().putBoolean("archivehint_l", true).commit();
}
getUndoView().showWithAction(dialog.id, hintShowed ? UndoView.ACTION_ARCHIVE : UndoView.ACTION_ARCHIVE_HINT, null, () -> {
dialogsListFrozen = true;
getMessagesController().addDialogToFolder(dialog.id, 0, pinnedNum, 0);
dialogsListFrozen = false;
ArrayList<TLRPC.Dialog> dialogs = getMessagesController().getDialogs(0);
int index = dialogs.indexOf(dialog);
if (index >= 0) {
ArrayList<TLRPC.Dialog> archivedDialogs = getMessagesController().getDialogs(1);
if (!archivedDialogs.isEmpty() || index != 1) {
dialogInsertFinished = 2;
setDialogsListFrozen(true);
parentPage.dialogsItemAnimator.prepareForRemove();
parentPage.lastItemsCount++;
parentPage.dialogsAdapter.notifyItemInserted(index);
}
if (archivedDialogs.isEmpty()) {
dialogs.remove(0);
if (index == 1) {
dialogChangeFinished = 2;
setDialogsListFrozen(true);
parentPage.dialogsAdapter.notifyItemChanged(0);
} else {
frozenDialogsList.remove(0);
parentPage.dialogsItemAnimator.prepareForRemove();
parentPage.lastItemsCount--;
parentPage.dialogsAdapter.notifyItemRemoved(0);
}
}
} else {
parentPage.dialogsAdapter.notifyDataSetChanged();
}
});
}
if (folderId != 0 && frozenDialogsList.isEmpty()) {
parentPage.listView.setEmptyView(null);
parentPage.progressView.setVisibility(View.INVISIBLE);
}
}
};
setDialogsListFrozen(true);
@ -1351,7 +1360,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} else if (animationType == ItemTouchHelper.ANIMATION_TYPE_DRAG) {
if (movingView != null) {
View view = movingView;
AndroidUtilities.runOnUIThread(() -> view.setBackgroundDrawable(null), dialogsItemAnimator.getMoveDuration());
AndroidUtilities.runOnUIThread(() -> view.setBackgroundDrawable(null), parentPage.dialogsItemAnimator.getMoveDuration());
movingView = null;
}
}
@ -2124,7 +2133,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
viewPage.listView = new DialogsRecyclerView(context, viewPage);
viewPage.listView.setClipToPadding(false);
viewPage.listView.setPivotY(0);
dialogsItemAnimator = new DialogsItemAnimator() {
viewPage.dialogsItemAnimator = new DialogsItemAnimator() {
@Override
public void onRemoveStarting(RecyclerView.ViewHolder item) {
super.onRemoveStarting(item);
@ -2170,7 +2179,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
}
};
viewPage.listView.setItemAnimator(dialogsItemAnimator);
viewPage.listView.setItemAnimator(viewPage.dialogsItemAnimator);
viewPage.listView.setVerticalScrollBarEnabled(true);
viewPage.listView.setInstantClick(true);
viewPage.layoutManager = new LinearLayoutManager(context) {
@ -2386,7 +2395,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
dialogsItemAnimator.onListScroll(-dy);
viewPage.dialogsItemAnimator.onListScroll(-dy);
checkListLoad(viewPage);
if (wasManualScroll && floatingButtonContainer.getVisibility() != View.GONE && recyclerView.getChildCount() > 0) {
int firstVisibleItem = viewPage.layoutManager.findFirstVisibleItemPosition();
@ -2863,7 +2872,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
@Override
protected boolean canUndo() {
return !dialogsItemAnimator.isRunning();
for (int a = 0; a < viewPages.length; a++) {
if (viewPages[a].dialogsItemAnimator.isRunning()) {
return false;
}
}
return true;
}
};
contentView.addView(undoView[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
@ -3737,8 +3751,8 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
return !onlySelect && initialDialogsType == 0 && folderId == 0 && getMessagesController().hasHiddenArchive();
}
private boolean waitingForDialogsAnimationEnd() {
return dialogsItemAnimator.isRunning() || dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0;
private boolean waitingForDialogsAnimationEnd(ViewPage viewPage) {
return viewPage.dialogsItemAnimator.isRunning() || dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0;
}
private void onDialogAnimationFinished() {
@ -3840,7 +3854,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
int lower_id = (int) dialog.id;
if (isDialogPinned(dialog)) {
pinnedCount++;
} else if (!getMessagesController().isProxyDialog(dialog.id, false)) {
} else if (!getMessagesController().isPromoDialog(dialog.id, false)) {
break;
}
}
@ -3915,7 +3929,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
} else {
pinnedCount++;
}
} else if (!getMessagesController().isProxyDialog(dialog.id, false)) {
} else if (!getMessagesController().isPromoDialog(dialog.id, false)) {
break;
}
}
@ -4108,62 +4122,78 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
} else if (action == delete || action == clear) {
if (count == 1) {
AlertsCreator.createClearOrDeleteDialogAlert(DialogsActivity.this, action == clear, chat, user, lower_id == 0, (param) -> {
hideActionMode(false);
if (action == clear && ChatObject.isChannel(chat) && (!chat.megagroup || !TextUtils.isEmpty(chat.username))) {
getMessagesController().deleteDialog(selectedDialog, 2, param);
} else {
if (action == delete && folderId != 0 && getDialogsArray(currentAccount, viewPages[0].dialogsType, folderId, false).size() == 1) {
viewPages[0].progressView.setVisibility(View.INVISIBLE);
}
getUndoView().showWithAction(selectedDialog, action == clear ? UndoView.ACTION_CLEAR : UndoView.ACTION_DELETE, () -> {
if (action == clear) {
getMessagesController().deleteDialog(selectedDialog, 1, param);
} else {
if (chat != null) {
if (ChatObject.isNotInChat(chat)) {
getMessagesController().deleteDialog(selectedDialog, 0, param);
} else {
TLRPC.User currentUser = getMessagesController().getUser(getUserConfig().getClientUserId());
getMessagesController().deleteUserFromChat((int) -selectedDialog, currentUser, null);
}
} else {
getMessagesController().deleteDialog(selectedDialog, 0, param);
if (isBot) {
getMessagesController().blockUser((int) selectedDialog);
}
}
if (AndroidUtilities.isTablet()) {
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, selectedDialog);
}
MessagesController.getInstance(currentAccount).checkIfFolderEmpty(folderId);
if (canDeletePsaSelected) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("PsaHideChatAlertTitle", R.string.PsaHideChatAlertTitle));
builder.setMessage(LocaleController.getString("PsaHideChatAlertText", R.string.PsaHideChatAlertText));
builder.setPositiveButton(LocaleController.getString("PsaHide", R.string.PsaHide), (dialog1, which) -> {
getMessagesController().hidePromoDialog();
hideActionMode(false);
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
} else {
AlertsCreator.createClearOrDeleteDialogAlert(DialogsActivity.this, action == clear, chat, user, lower_id == 0, (param) -> {
hideActionMode(false);
if (action == clear && ChatObject.isChannel(chat) && (!chat.megagroup || !TextUtils.isEmpty(chat.username))) {
getMessagesController().deleteDialog(selectedDialog, 2, param);
} else {
if (action == delete && folderId != 0 && getDialogsArray(currentAccount, viewPages[0].dialogsType, folderId, false).size() == 1) {
viewPages[0].progressView.setVisibility(View.INVISIBLE);
}
});
}
});
getUndoView().showWithAction(selectedDialog, action == clear ? UndoView.ACTION_CLEAR : UndoView.ACTION_DELETE, () -> {
if (action == clear) {
getMessagesController().deleteDialog(selectedDialog, 1, param);
} else {
if (chat != null) {
if (ChatObject.isNotInChat(chat)) {
getMessagesController().deleteDialog(selectedDialog, 0, param);
} else {
TLRPC.User currentUser = getMessagesController().getUser(getUserConfig().getClientUserId());
getMessagesController().deleteUserFromChat((int) -selectedDialog, currentUser, null);
}
} else {
getMessagesController().deleteDialog(selectedDialog, 0, param);
if (isBot) {
getMessagesController().blockUser((int) selectedDialog);
}
}
if (AndroidUtilities.isTablet()) {
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, selectedDialog);
}
MessagesController.getInstance(currentAccount).checkIfFolderEmpty(folderId);
}
});
}
});
}
return;
} else {
if (action == clear && canClearCacheCount != 0) {
getMessagesController().deleteDialog(selectedDialog, 2, false);
if (getMessagesController().isPromoDialog(selectedDialog, true)) {
getMessagesController().hidePromoDialog();
} else {
if (action == clear) {
getMessagesController().deleteDialog(selectedDialog, 1, false);
if (action == clear && canClearCacheCount != 0) {
getMessagesController().deleteDialog(selectedDialog, 2, false);
} else {
if (chat != null) {
if (ChatObject.isNotInChat(chat)) {
getMessagesController().deleteDialog(selectedDialog, 0, false);
} else {
TLRPC.User currentUser = getMessagesController().getUser(getUserConfig().getClientUserId());
getMessagesController().deleteUserFromChat((int) -selectedDialog, currentUser, null);
}
if (action == clear) {
getMessagesController().deleteDialog(selectedDialog, 1, false);
} else {
getMessagesController().deleteDialog(selectedDialog, 0, false);
if (isBot) {
getMessagesController().blockUser((int) selectedDialog);
if (chat != null) {
if (ChatObject.isNotInChat(chat)) {
getMessagesController().deleteDialog(selectedDialog, 0, false);
} else {
TLRPC.User currentUser = getMessagesController().getUser(getUserConfig().getClientUserId());
getMessagesController().deleteUserFromChat((int) -selectedDialog, currentUser, null);
}
} else {
getMessagesController().deleteDialog(selectedDialog, 0, false);
if (isBot) {
getMessagesController().blockUser((int) selectedDialog);
}
}
if (AndroidUtilities.isTablet()) {
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, selectedDialog);
}
}
if (AndroidUtilities.isTablet()) {
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, selectedDialog);
}
}
}
@ -4218,6 +4248,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
int canDeleteCount = 0;
int canUnpinCount = 0;
int canArchiveCount = 0;
canDeletePsaSelected = false;
canUnarchiveCount = 0;
canUnmuteCount = 0;
canMuteCount = 0;
@ -4253,7 +4284,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (folderId == 1 || dialog.folder_id == 1) {
canUnarchiveCount++;
} else if (selectedDialog != selfUserId && selectedDialog != 777000 && !getMessagesController().isProxyDialog(selectedDialog, false)) {
} else if (selectedDialog != selfUserId && selectedDialog != 777000 && !getMessagesController().isPromoDialog(selectedDialog, false)) {
canArchiveCount++;
}
@ -4276,8 +4307,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
if (DialogObject.isChannel(dialog)) {
final TLRPC.Chat chat = getMessagesController().getChat(-lower_id);
CharSequence[] items;
if (getMessagesController().isProxyDialog(dialog.id, true)) {
if (getMessagesController().isPromoDialog(dialog.id, true)) {
canClearCacheCount++;
if (getMessagesController().promoDialogType == MessagesController.PROMO_TYPE_PSA) {
canDeleteCount++;
canDeletePsaSelected = true;
}
} else {
if (pinned) {
canUnpinCount++;
@ -5458,6 +5493,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveDrawable}, "Box2", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveDrawable}, "Box1", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_hidePsaDrawable}, "Line 1", Theme.key_chats_archiveBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_hidePsaDrawable}, "Line 2", Theme.key_chats_archiveBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_hidePsaDrawable}, "Line 3", Theme.key_chats_archiveBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_hidePsaDrawable}, "Cup Red", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_hidePsaDrawable}, "Box", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unarchiveDrawable}, "Arrow1", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unarchiveDrawable}, "Arrow2", Theme.key_chats_archivePinBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unarchiveDrawable}, "Box2", Theme.key_chats_archiveIcon));

View File

@ -315,7 +315,7 @@ public class LoginActivity extends BaseFragment {
MessagesController.getInstance(currentAccount).putUser(res.user, false);
ContactsController.getInstance(currentAccount).checkAppAccount();
MessagesController.getInstance(currentAccount).getBlockedUsers(true);
MessagesController.getInstance(currentAccount).checkProxyInfo(true);
MessagesController.getInstance(currentAccount).checkPromoInfo(true);
ConnectionsManager.getInstance(currentAccount).updateDcSettings();
needFinishActivity(false);
} else {
@ -1176,7 +1176,7 @@ public class LoginActivity extends BaseFragment {
MessagesStorage.getInstance(currentAccount).putUsersAndChats(users, null, true, true);
MessagesController.getInstance(currentAccount).putUser(res.user, false);
ContactsController.getInstance(currentAccount).checkAppAccount();
MessagesController.getInstance(currentAccount).checkProxyInfo(true);
MessagesController.getInstance(currentAccount).checkPromoInfo(true);
ConnectionsManager.getInstance(currentAccount).updateDcSettings();
needFinishActivity(afterSignup);
}

View File

@ -1388,8 +1388,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
did = -chat_id;
}
ArrayList<Integer> users = chatInfo != null && chatInfo.participants != null && chatInfo.participants.participants.size() > 5 ? sortedUsers : null;
TLRPC.ChatFull chatFull = users != null ? chatInfo : null;
sharedMediaLayout = new SharedMediaLayout(context, did, sharedMediaPreloader, userInfo != null ? userInfo.common_chats_count : 0, sortedUsers, chatFull, this) {
sharedMediaLayout = new SharedMediaLayout(context, did, sharedMediaPreloader, userInfo != null ? userInfo.common_chats_count : 0, sortedUsers, chatInfo, users != null, this) {
@Override
protected void onSelectedTabChanged() {
updateSelectedMediaTabText();
@ -3782,6 +3781,9 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
mergeDialogId = -chatInfo.migrated_from_chat_id;
MediaDataController.getInstance(currentAccount).getMediaCounts(mergeDialogId, classGuid);
}
if (sharedMediaLayout != null) {
sharedMediaLayout.setChatInfo(chatInfo);
}
fetchUsersFromChannelInfo();
}

View File

@ -195,7 +195,7 @@ public class NekoSettingsActivity extends BaseFragment {
}
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
if (UserConfig.getInstance(a).isClientActivated()) {
MessagesController.getInstance(a).checkProxyInfo(true);
MessagesController.getInstance(a).checkPromoInfo(true);
}
}
} else if (position == saveCacheToPrivateDirectoryRow) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -976,7 +976,18 @@
<string name="DiceInfo2">Send a **:dice:** emoji to any chat to roll a die.</string>
<string name="DartInfo">Send a **:darts:** emoji to try your luck.</string>
<string name="DiceEmojiInfo">Send a %1$s emoji to try your luck.</string>
<string name="SendDice">SEND</string>Send a dart emoji
<string name="SendDice">SEND</string>
<string name="PsaType_covid">PSA</string>
<string name="PsaTypeDefault">PSA</string>
<string name="PsaInfo_covid">This message provides you with a public service announcement in relation to the ungoing Covid-19 pandemic. Learn more about this initiative at https://telegram.org/blog/coronavirus</string>
<string name="PsaInfoDefault">PSA info test</string>
<string name="PsaMessage_covid">Covid-19 Notification</string>
<string name="PsaMessageInfo_covid">This message provides you with a public service announcement in relation to the ungoing Covid-19 pandemic. Learn more about this initiative at https://telegram.org/blog/coronavirus</string>
<string name="PsaMessageDefault">Important Notification</string>
<string name="PsaMessageInfoDefault">This is an important notification.</string>
<string name="PsaHideChatAlertTitle">Hide chat</string>
<string name="PsaHideChatAlertText">Are you sure you want to hide the selected chat?</string>
<string name="PsaHide">Hide</string>
<!--notification-->
<string name="MessageLifetimeChanged">%1$s set the self-destruct timer to %2$s</string>
<string name="MessageLifetimeChangedOutgoing">You set the self-destruct timer to %1$s</string>