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 ->
variant.outputs.all { output ->
@ -318,7 +318,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionName "8.0.1"
versionName "8.1.2"
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 CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = true/* || Build.VERSION.SDK_INT <= 28*/;
public static int BUILD_VERSION = 2431;
public static String BUILD_VERSION_STRING = "8.1.1";
public static int BUILD_VERSION = 2432;
public static String BUILD_VERSION_STRING = "8.1.2";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";
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) {
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;
long did = MessageObject.getReplyToDialogId(messageObject.messageOwner);
long channelId = messageObject.messageOwner.peer_id != null ? messageObject.messageOwner.peer_id.channel_id : 0;
long channelId = 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);
ArrayList<Integer> ids = dialogReplyMessagesIds.get(channelId);
if (sparseArray == null) {
@ -4013,12 +4030,12 @@ public class MediaDataController extends BaseController {
ids = new ArrayList<>();
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) {
arrayList = new ArrayList<>();
sparseArray.put(messageObject.messageOwner.reply_to.reply_to_msg_id, arrayList);
if (!ids.contains(messageObject.messageOwner.reply_to.reply_to_msg_id)) {
ids.add(messageObject.messageOwner.reply_to.reply_to_msg_id);
sparseArray.put(messageId, arrayList);
if (!ids.contains(messageId)) {
ids.add(messageId);
}
}
arrayList.add(messageObject);
@ -4090,6 +4107,12 @@ public class MediaDataController extends BaseController {
getConnectionsManager().sendRequest(req, (response, error) -> {
if (error == null) {
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);
ImageLoader.saveMessagesThumbs(messagesRes.messages);
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);
} else {
messageText = isUserSelf
? LocaleController.formatString("ChangedChatThemeYou", R.string.ChatThemeChangedYou, emoticon)
: LocaleController.formatString("ChangedChatThemeTo", R.string.ChatThemeChangedTo, userName, emoticon);
? LocaleController.formatString("ChatThemeChangedYou", R.string.ChatThemeChangedYou, 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.collection.LongSparseArray;
import com.google.android.exoplayer2.util.Log;
public class MessagesStorage extends BaseController {
public interface IntCallback {
@ -440,7 +442,12 @@ public class MessagesStorage extends BaseController {
}
}
if (version < LAST_DB_VERSION) {
updateDbToLastVersion(version);
try {
updateDbToLastVersion(version);
} catch (Exception e) {
FileLog.e(e);
throw new RuntimeException("malformed");
}
}
}
} catch (Exception e) {
@ -460,6 +467,13 @@ public class MessagesStorage extends BaseController {
openDatabase(openTries == 1 ? 2 : 3);
}
}
AndroidUtilities.runOnUIThread(() -> {
if (databaseMigrationInProgress) {
databaseMigrationInProgress = false;
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.onDatabaseMigration, false);
}
});
loadDialogFilters();
loadUnreadMessages();
loadPendingTasks();
@ -1264,8 +1278,12 @@ public class MessagesStorage extends BaseController {
SQLiteCursor cursor;
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");
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");
} catch (Exception e) {
cursor = null;
FileLog.e(e);
}
if (cursor != null) {
SQLitePreparedStatement statement = database.executeFast("REPLACE INTO messages_v2 VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
int num = 0;

View file

@ -130,8 +130,6 @@ public class NotificationsController extends BaseController {
private int notificationId;
private String notificationGroup;
private int lastInternalNotificationId;
static {
if (Build.VERSION.SDK_INT >= 26 && ApplicationLoader.applicationContext != null) {
notificationManager = NotificationManagerCompat.from(ApplicationLoader.applicationContext);
@ -158,8 +156,6 @@ public class NotificationsController extends BaseController {
public NotificationsController(int instance) {
super(instance);
lastInternalNotificationId = instance * 1000000 + 5000;
notificationId = currentAccount + 1;
notificationGroup = "messages" + (currentAccount == 0 ? "" : currentAccount);
SharedPreferences preferences = getAccountInstance().getNotificationsSettings();
@ -3892,7 +3888,10 @@ public class NotificationsController extends BaseController {
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();
class NotificationHolder {
@ -3914,7 +3913,7 @@ public class NotificationsController extends BaseController {
void call() {
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 {
notificationManager.notify(id, notification.build());
@ -3947,7 +3946,7 @@ public class NotificationsController extends BaseController {
Integer internalId = oldIdsWear.get(dialogId);
if (internalId == null) {
internalId = lastInternalNotificationId++;
internalId = (int) dialogId + (int) (dialogId >> 32);
} else {
oldIdsWear.remove(dialogId);
}

View file

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

View file

@ -574,7 +574,9 @@ public class GroupCallUserCell extends FrameLayout {
}
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);
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) {
if (overwrite) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("clear history by overwrite firstLoading=" + firstLoading + " minMessage=" + minMessageId[0] + " topMessage=" + differenceTooLong.dialog.top_message);
}
if (firstLoading) {
waitingForLoad.clear();
chatWasReset = true;
last_message_id = differenceTooLong.dialog.top_message;
createUnreadMessageAfterId = 0;
} else {
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);
}
}
@ -23827,7 +23830,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (BuildVars.LOGS_ENABLED) {
FileLog.d("notify data set changed");
}
if (animated && fragmentOpened && BuildVars.DEBUG_VERSION) {
if (animated && fragmentOpened) {
if (chatListView.getItemAnimator() != chatListItemAnimator) {
chatListView.setItemAnimator(chatListItemAnimator);
}

View file

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

View file

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

View file

@ -381,7 +381,6 @@ public class EmojiAnimationsOverlay implements NotificationCenter.NotificationCe
lastTappedTime = System.currentTimeMillis();
timeIntervals.clear();
animationIndexes.clear();
;
timeIntervals.add(0L);
animationIndexes.add(animation);
} 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 payload = intent.getStringExtra("payload");
final TLRPC.TL_account_getAuthorizationForm req = new TLRPC.TL_account_getAuthorizationForm();

View file

@ -1506,26 +1506,28 @@ public class LoginActivity extends BaseFragment {
TLRPC.TL_help_getCountriesList req = new TLRPC.TL_help_getCountriesList();
req.lang_code = "";
getConnectionsManager().sendRequest(req, (response, error) -> {
if (error == null) {
countriesArray.clear();
codesMap.clear();
phoneFormatMap.clear();
TLRPC.TL_help_countriesList help_countriesList = (TLRPC.TL_help_countriesList) response;
for (int i = 0; i < help_countriesList.countries.size(); i++) {
TLRPC.TL_help_country c = help_countriesList.countries.get(i);
for (int k = 0; k < c.country_codes.size(); k++) {
CountrySelectActivity.Country countryWithCode = new CountrySelectActivity.Country();
countryWithCode.name = c.default_name;
countryWithCode.code = c.country_codes.get(k).country_code;
AndroidUtilities.runOnUIThread(() -> {
if (error == null) {
countriesArray.clear();
codesMap.clear();
phoneFormatMap.clear();
TLRPC.TL_help_countriesList help_countriesList = (TLRPC.TL_help_countriesList) response;
for (int i = 0; i < help_countriesList.countries.size(); i++) {
TLRPC.TL_help_country c = help_countriesList.countries.get(i);
for (int k = 0; k < c.country_codes.size(); k++) {
CountrySelectActivity.Country countryWithCode = new CountrySelectActivity.Country();
countryWithCode.name = c.default_name;
countryWithCode.code = c.country_codes.get(k).country_code;
countriesArray.add(countryWithCode);
codesMap.put(c.country_codes.get(k).country_code, countryWithCode);
if (c.country_codes.get(k).patterns.size() > 0) {
phoneFormatMap.put(c.country_codes.get(k).country_code, c.country_codes.get(k).patterns.get(0));
countriesArray.add(countryWithCode);
codesMap.put(c.country_codes.get(k).country_code, countryWithCode);
if (c.country_codes.get(k).patterns.size() > 0) {
phoneFormatMap.put(c.country_codes.get(k).country_code, c.country_codes.get(k).patterns.get(0));
}
}
}
}
}
});
}, ConnectionsManager.RequestFlagWithoutLogin | ConnectionsManager.RequestFlagFailOnServerErrors);
}

View file

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