Update to 8.1.2 (2432)

This commit is contained in:
xaxtix 2021-09-27 19:38:27 +03:00
parent 58aded63e9
commit 09f95ec069
15 changed files with 94 additions and 51 deletions

View file

@ -299,7 +299,7 @@ android {
} }
} }
defaultConfig.versionCode = 2428 defaultConfig.versionCode = 2432
applicationVariants.all { variant -> applicationVariants.all { variant ->
variant.outputs.all { output -> variant.outputs.all { output ->
@ -318,7 +318,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 29 targetSdkVersion 29
versionName "8.0.1" versionName "8.1.2"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi'] vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

View file

@ -19,8 +19,8 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true; public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true; public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = true/* || Build.VERSION.SDK_INT <= 28*/; public static boolean NO_SCOPED_STORAGE = true/* || Build.VERSION.SDK_INT <= 28*/;
public static int BUILD_VERSION = 2431; public static int BUILD_VERSION = 2432;
public static String BUILD_VERSION_STRING = "8.1.1"; public static String BUILD_VERSION_STRING = "8.1.2";
public static int APP_ID = 4; public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
public static String SMS_HASH = isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT"); public static String SMS_HASH = isStandaloneApp() ? "w0lkcmTZkKh" : (DEBUG_VERSION ? "O2P2z+/jBpJ" : "oLeq9AcOZkT");

View file

@ -3999,10 +3999,27 @@ public class MediaDataController extends BaseController {
if (messageObject == null) { if (messageObject == null) {
continue; continue;
} }
if (messageObject.getId() > 0 && messageObject.isReply() && messageObject.replyMessageObject == null) { if (messageObject.getId() > 0 && messageObject.isReply()) {
int messageId = messageObject.messageOwner.reply_to.reply_to_msg_id; int messageId = messageObject.messageOwner.reply_to.reply_to_msg_id;
long did = MessageObject.getReplyToDialogId(messageObject.messageOwner); long channelId = 0;
long channelId = messageObject.messageOwner.peer_id != null ? messageObject.messageOwner.peer_id.channel_id : 0; if (messageObject.messageOwner.reply_to.reply_to_peer_id != null) {
if (messageObject.messageOwner.reply_to.reply_to_peer_id.channel_id != 0) {
channelId = messageObject.messageOwner.reply_to.reply_to_peer_id.channel_id;
}
} else
if (messageObject.messageOwner.peer_id.channel_id != 0) {
channelId = messageObject.messageOwner.peer_id.channel_id;
}
if (messageObject.replyMessageObject != null) {
if (messageObject.replyMessageObject.messageOwner == null || messageObject.replyMessageObject.messageOwner.peer_id == null || messageObject.messageOwner instanceof TLRPC.TL_messageEmpty) {
continue;
}
if (messageObject.replyMessageObject.messageOwner.peer_id.channel_id == channelId) {
continue;
}
}
SparseArray<ArrayList<MessageObject>> sparseArray = replyMessageOwners.get(dialogId); SparseArray<ArrayList<MessageObject>> sparseArray = replyMessageOwners.get(dialogId);
ArrayList<Integer> ids = dialogReplyMessagesIds.get(channelId); ArrayList<Integer> ids = dialogReplyMessagesIds.get(channelId);
if (sparseArray == null) { if (sparseArray == null) {
@ -4013,12 +4030,12 @@ public class MediaDataController extends BaseController {
ids = new ArrayList<>(); ids = new ArrayList<>();
dialogReplyMessagesIds.put(channelId, ids); dialogReplyMessagesIds.put(channelId, ids);
} }
ArrayList<MessageObject> arrayList = sparseArray.get(messageObject.messageOwner.reply_to.reply_to_msg_id); ArrayList<MessageObject> arrayList = sparseArray.get(messageId);
if (arrayList == null) { if (arrayList == null) {
arrayList = new ArrayList<>(); arrayList = new ArrayList<>();
sparseArray.put(messageObject.messageOwner.reply_to.reply_to_msg_id, arrayList); sparseArray.put(messageId, arrayList);
if (!ids.contains(messageObject.messageOwner.reply_to.reply_to_msg_id)) { if (!ids.contains(messageId)) {
ids.add(messageObject.messageOwner.reply_to.reply_to_msg_id); ids.add(messageId);
} }
} }
arrayList.add(messageObject); arrayList.add(messageObject);
@ -4090,6 +4107,12 @@ public class MediaDataController extends BaseController {
getConnectionsManager().sendRequest(req, (response, error) -> { getConnectionsManager().sendRequest(req, (response, error) -> {
if (error == null) { if (error == null) {
TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response; TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response;
for (int i = 0; i < messagesRes.messages.size(); i++) {
TLRPC.Message message = messagesRes.messages.get(i);
if (message.dialog_id == 0) {
message.dialog_id = dialogId;
}
}
MessageObject.fixMessagePeer(messagesRes.messages, channelId); MessageObject.fixMessagePeer(messagesRes.messages, channelId);
ImageLoader.saveMessagesThumbs(messagesRes.messages); ImageLoader.saveMessagesThumbs(messagesRes.messages);
broadcastReplyMessages(messagesRes.messages, replyMessageOwners, messagesRes.users, messagesRes.chats, dialogId, false); broadcastReplyMessages(messagesRes.messages, replyMessageOwners, messagesRes.users, messagesRes.chats, dialogId, false);

View file

@ -2958,8 +2958,8 @@ public class MessageObject {
: LocaleController.formatString("ChatThemeDisabled", R.string.ChatThemeDisabled, userName, emoticon); : LocaleController.formatString("ChatThemeDisabled", R.string.ChatThemeDisabled, userName, emoticon);
} else { } else {
messageText = isUserSelf messageText = isUserSelf
? LocaleController.formatString("ChangedChatThemeYou", R.string.ChatThemeChangedYou, emoticon) ? LocaleController.formatString("ChatThemeChangedYou", R.string.ChatThemeChangedYou, emoticon)
: LocaleController.formatString("ChangedChatThemeTo", R.string.ChatThemeChangedTo, userName, emoticon); : LocaleController.formatString("ChatThemeChangedTo", R.string.ChatThemeChangedTo, userName, emoticon);
} }
} }
} }

View file

@ -48,6 +48,8 @@ import java.util.concurrent.atomic.AtomicLong;
import androidx.annotation.UiThread; import androidx.annotation.UiThread;
import androidx.collection.LongSparseArray; import androidx.collection.LongSparseArray;
import com.google.android.exoplayer2.util.Log;
public class MessagesStorage extends BaseController { public class MessagesStorage extends BaseController {
public interface IntCallback { public interface IntCallback {
@ -440,7 +442,12 @@ public class MessagesStorage extends BaseController {
} }
} }
if (version < LAST_DB_VERSION) { if (version < LAST_DB_VERSION) {
try {
updateDbToLastVersion(version); updateDbToLastVersion(version);
} catch (Exception e) {
FileLog.e(e);
throw new RuntimeException("malformed");
}
} }
} }
} catch (Exception e) { } catch (Exception e) {
@ -460,6 +467,13 @@ public class MessagesStorage extends BaseController {
openDatabase(openTries == 1 ? 2 : 3); openDatabase(openTries == 1 ? 2 : 3);
} }
} }
AndroidUtilities.runOnUIThread(() -> {
if (databaseMigrationInProgress) {
databaseMigrationInProgress = false;
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.onDatabaseMigration, false);
}
});
loadDialogFilters(); loadDialogFilters();
loadUnreadMessages(); loadUnreadMessages();
loadPendingTasks(); loadPendingTasks();
@ -1264,8 +1278,12 @@ public class MessagesStorage extends BaseController {
SQLiteCursor cursor; SQLiteCursor cursor;
try {
cursor = database.queryFinalized("SELECT mid, uid, read_state, send_state, date, data, out, ttl, media, replydata, imp, mention, forwards, replies_data, thread_reply_id FROM messages WHERE 1"); cursor = database.queryFinalized("SELECT mid, uid, read_state, send_state, date, data, out, ttl, media, replydata, imp, mention, forwards, replies_data, thread_reply_id FROM messages WHERE 1");
} catch (Exception e) {
cursor = null;
FileLog.e(e);
}
if (cursor != null) { if (cursor != null) {
SQLitePreparedStatement statement = database.executeFast("REPLACE INTO messages_v2 VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); SQLitePreparedStatement statement = database.executeFast("REPLACE INTO messages_v2 VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
int num = 0; int num = 0;

View file

@ -130,8 +130,6 @@ public class NotificationsController extends BaseController {
private int notificationId; private int notificationId;
private String notificationGroup; private String notificationGroup;
private int lastInternalNotificationId;
static { static {
if (Build.VERSION.SDK_INT >= 26 && ApplicationLoader.applicationContext != null) { if (Build.VERSION.SDK_INT >= 26 && ApplicationLoader.applicationContext != null) {
notificationManager = NotificationManagerCompat.from(ApplicationLoader.applicationContext); notificationManager = NotificationManagerCompat.from(ApplicationLoader.applicationContext);
@ -158,8 +156,6 @@ public class NotificationsController extends BaseController {
public NotificationsController(int instance) { public NotificationsController(int instance) {
super(instance); super(instance);
lastInternalNotificationId = instance * 1000000 + 5000;
notificationId = currentAccount + 1; notificationId = currentAccount + 1;
notificationGroup = "messages" + (currentAccount == 0 ? "" : currentAccount); notificationGroup = "messages" + (currentAccount == 0 ? "" : currentAccount);
SharedPreferences preferences = getAccountInstance().getNotificationsSettings(); SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
@ -3892,7 +3888,10 @@ public class NotificationsController extends BaseController {
arrayList.add(messageObject); arrayList.add(messageObject);
} }
LongSparseArray<Integer> oldIdsWear = wearNotificationsIds.clone(); LongSparseArray<Integer> oldIdsWear = new LongSparseArray<>();
for (int i = 0; i < wearNotificationsIds.size(); i++) {
oldIdsWear.put(wearNotificationsIds.keyAt(i), wearNotificationsIds.valueAt(i));
}
wearNotificationsIds.clear(); wearNotificationsIds.clear();
class NotificationHolder { class NotificationHolder {
@ -3914,7 +3913,7 @@ public class NotificationsController extends BaseController {
void call() { void call() {
if (BuildVars.LOGS_ENABLED) { if (BuildVars.LOGS_ENABLED) {
FileLog.w("show dialog notification with id " + id); FileLog.w("show dialog notification with id " + id + " " + dialogId + " user=" + user + " chat=" + chat);
} }
try { try {
notificationManager.notify(id, notification.build()); notificationManager.notify(id, notification.build());
@ -3947,7 +3946,7 @@ public class NotificationsController extends BaseController {
Integer internalId = oldIdsWear.get(dialogId); Integer internalId = oldIdsWear.get(dialogId);
if (internalId == null) { if (internalId == null) {
internalId = lastInternalNotificationId++; internalId = (int) dialogId + (int) (dialogId >> 32);
} else { } else {
oldIdsWear.remove(dialogId); oldIdsWear.remove(dialogId);
} }

View file

@ -232,9 +232,6 @@ public class DialogsAdapter extends RecyclerListView.SelectionAdapter {
} }
currentCount = count; currentCount = count;
if (BuildVars.LOGS_ENABLED) {
FileLog.d("DialogsAdapter dialogsCount=" + dialogsCount + " dialogsType=" + dialogsType);
}
return count; return count;
} }

View file

@ -574,7 +574,9 @@ public class GroupCallUserCell extends FrameLayout {
} }
private void applyParticipantChanges(boolean animated, boolean internal) { private void applyParticipantChanges(boolean animated, boolean internal) {
TLRPC.Chat chat = accountInstance.getMessagesController().getChat(currentCall.chatId); if (currentCall == null) {
return;
}
muteButton.setEnabled(!isSelfUser() || participant.raise_hand_rating != 0); muteButton.setEnabled(!isSelfUser() || participant.raise_hand_rating != 0);
boolean hasVoice; boolean hasVoice;

View file

@ -15814,13 +15814,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private void clearHistory(boolean overwrite, TLRPC.TL_updates_channelDifferenceTooLong differenceTooLong) { private void clearHistory(boolean overwrite, TLRPC.TL_updates_channelDifferenceTooLong differenceTooLong) {
if (overwrite) { if (overwrite) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("clear history by overwrite firstLoading=" + firstLoading + " minMessage=" + minMessageId[0] + " topMessage=" + differenceTooLong.dialog.top_message);
}
if (firstLoading) { if (firstLoading) {
waitingForLoad.clear();
chatWasReset = true; chatWasReset = true;
last_message_id = differenceTooLong.dialog.top_message; last_message_id = differenceTooLong.dialog.top_message;
createUnreadMessageAfterId = 0; createUnreadMessageAfterId = 0;
} else { } else {
if (differenceTooLong.dialog.top_message > minMessageId[0]) { if (differenceTooLong.dialog.top_message > minMessageId[0]) {
last_message_id = Math.max(last_message_id, differenceTooLong.dialog.top_message);
createUnreadMessageAfterId = Math.max(minMessageId[0] + 1, differenceTooLong.dialog.read_inbox_max_id); createUnreadMessageAfterId = Math.max(minMessageId[0] + 1, differenceTooLong.dialog.read_inbox_max_id);
} }
} }
@ -23827,7 +23830,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (BuildVars.LOGS_ENABLED) { if (BuildVars.LOGS_ENABLED) {
FileLog.d("notify data set changed"); FileLog.d("notify data set changed");
} }
if (animated && fragmentOpened && BuildVars.DEBUG_VERSION) { if (animated && fragmentOpened) {
if (chatListView.getItemAnimator() != chatListItemAnimator) { if (chatListView.getItemAnimator() != chatListItemAnimator) {
chatListView.setItemAnimator(chatListItemAnimator); chatListView.setItemAnimator(chatListItemAnimator);
} }

View file

@ -565,7 +565,7 @@ public class ChatThemeBottomSheet extends BottomSheet implements NotificationCen
} }
private void onAnimationStart() { private void onAnimationStart() {
if (adapter != null) { if (adapter != null && adapter.items != null) {
for (ChatThemeItem item : adapter.items) { for (ChatThemeItem item : adapter.items) {
item.isDark = forceDark; item.isDark = forceDark;
} }

View file

@ -2145,14 +2145,14 @@ public class ShareAlert extends BottomSheet implements NotificationCenter.Notifi
itemsCount += recentSearchObjects.size(); itemsCount += recentSearchObjects.size();
} }
lastFilledItem = itemsCount++; lastFilledItem = itemsCount++;
return itemsCount; return lastItemCont = itemsCount;
} else { } else {
firstEmptyViewCell = itemsCount++; firstEmptyViewCell = itemsCount++;
searchResultsStartRow = itemsCount; searchResultsStartRow = itemsCount;
itemsCount += (searchResult.size() + searchAdapterHelper.getLocalServerSearch().size()); itemsCount += (searchResult.size() + searchAdapterHelper.getLocalServerSearch().size());
if (itemsCount == 1) { if (itemsCount == 1) {
firstEmptyViewCell = -1; firstEmptyViewCell = -1;
return 0; return lastItemCont = itemsCount = 0;
} }
lastFilledItem = itemsCount++; lastFilledItem = itemsCount++;
} }

View file

@ -381,7 +381,6 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
lastTappedTime = System.currentTimeMillis(); lastTappedTime = System.currentTimeMillis();
timeIntervals.clear(); timeIntervals.clear();
animationIndexes.clear(); animationIndexes.clear();
;
timeIntervals.add(0L); timeIntervals.add(0L);
animationIndexes.add(animation); animationIndexes.add(animation);
} else { } else {

View file

@ -306,7 +306,7 @@ public class ExternalActionActivity extends Activity implements ActionBarLayout.
} }
} }
final long bot_id = intent.getLongExtra("bot_id", 0); final long bot_id = intent.getLongExtra("bot_id", intent.getIntExtra("bot_id", 0));
final String nonce = intent.getStringExtra("nonce"); final String nonce = intent.getStringExtra("nonce");
final String payload = intent.getStringExtra("payload"); final String payload = intent.getStringExtra("payload");
final TLRPC.TL_account_getAuthorizationForm req = new TLRPC.TL_account_getAuthorizationForm(); final TLRPC.TL_account_getAuthorizationForm req = new TLRPC.TL_account_getAuthorizationForm();

View file

@ -1506,6 +1506,7 @@ public class LoginActivity extends BaseFragment {
TLRPC.TL_help_getCountriesList req = new TLRPC.TL_help_getCountriesList(); TLRPC.TL_help_getCountriesList req = new TLRPC.TL_help_getCountriesList();
req.lang_code = ""; req.lang_code = "";
getConnectionsManager().sendRequest(req, (response, error) -> { getConnectionsManager().sendRequest(req, (response, error) -> {
AndroidUtilities.runOnUIThread(() -> {
if (error == null) { if (error == null) {
countriesArray.clear(); countriesArray.clear();
codesMap.clear(); codesMap.clear();
@ -1526,6 +1527,7 @@ public class LoginActivity extends BaseFragment {
} }
} }
} }
});
}, ConnectionsManager.RequestFlagWithoutLogin | ConnectionsManager.RequestFlagFailOnServerErrors); }, ConnectionsManager.RequestFlagWithoutLogin | ConnectionsManager.RequestFlagFailOnServerErrors);
} }

View file

@ -2497,7 +2497,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
} }
if (position == settingsKeyRow) { if (position == settingsKeyRow) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("chat_id", DialogObject.getEncryptedChatId(dialogId)); args.putInt("chat_id", DialogObject.getEncryptedChatId(dialogId));
presentFragment(new IdenticonActivity(args)); presentFragment(new IdenticonActivity(args));
} else if (position == settingsTimerRow) { } else if (position == settingsTimerRow) {
showDialog(AlertsCreator.createTTLAlert(getParentActivity(), currentEncryptedChat, null).create()); showDialog(AlertsCreator.createTTLAlert(getParentActivity(), currentEncryptedChat, null).create());