Update to 7.2.1 (2135)

This commit is contained in:
DrKLO 2020-10-30 20:44:29 +03:00
parent 002c01ecd3
commit 8726c6d11f
11 changed files with 75 additions and 34 deletions

View file

@ -285,7 +285,7 @@ android {
}
}
defaultConfig.versionCode = 2134
defaultConfig.versionCode = 2135
applicationVariants.all { variant ->
variant.outputs.all { output ->
@ -304,7 +304,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionName "7.2.0"
versionName "7.2.1"
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

View file

@ -18,7 +18,7 @@ public class BuildVars {
public static boolean LOGS_ENABLED = false;
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static int BUILD_VERSION = 2134;
public static int BUILD_VERSION = 2135;
public static String BUILD_VERSION_STRING = "7.2.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -3644,6 +3644,9 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
public static void saveFilesFromMessages(Context context, AccountInstance accountInstance, ArrayList<MessageObject> messageObjects, final MessagesStorage.IntCallback onSaved) {
if (messageObjects == null || messageObjects.isEmpty()) {
return;
}
new MediaLoader(context, accountInstance, messageObjects, onSaved).start();
}

View file

@ -3064,7 +3064,6 @@ public class MessagesStorage extends BaseController {
if (messagesOnly == 0 || messagesOnly == 3) {
database.executeFast("DELETE FROM dialogs WHERE did = " + did).stepThis().dispose();
database.executeFast("DELETE FROM chat_settings_v2 WHERE uid = " + did).stepThis().dispose();
database.executeFast("DELETE FROM chat_pinned_v2 WHERE uid = " + did).stepThis().dispose();
database.executeFast("DELETE FROM chat_pinned_count WHERE uid = " + did).stepThis().dispose();
database.executeFast("DELETE FROM channel_users_v2 WHERE did = " + did).stepThis().dispose();
@ -3073,11 +3072,10 @@ public class MessagesStorage extends BaseController {
int high_id = (int) (did >> 32);
if (lower_id != 0) {
if (lower_id < 0) {
//database.executeFast("DELETE FROM chats WHERE uid = " + (-lower_id)).stepThis().dispose();
database.executeFast("DELETE FROM chat_settings_v2 WHERE uid = " + (-lower_id)).stepThis().dispose();
}
} else {
database.executeFast("DELETE FROM enc_chats WHERE uid = " + high_id).stepThis().dispose();
//database.executeFast("DELETE FROM secret_holes WHERE uid = " + high_id).stepThis().dispose();
}
} else if (messagesOnly == 2) {
SQLiteCursor cursor = database.queryFinalized("SELECT last_mid_i, last_mid FROM dialogs WHERE did = " + did);
@ -3091,7 +3089,9 @@ public class MessagesStorage extends BaseController {
NativeByteBuffer data = cursor2.byteBufferValue(0);
if (data != null) {
TLRPC.Message message = TLRPC.Message.TLdeserialize(data, data.readInt32(false), false);
message.readAttachPath(data, getUserConfig().clientUserId);
if (message != null) {
message.readAttachPath(data, getUserConfig().clientUserId);
}
data.reuse();
if (message != null) {
messageId = message.id;
@ -5009,14 +5009,21 @@ public class MessagesStorage extends BaseController {
if (ids == null) {
database.executeFast("DELETE FROM chat_pinned_v2 WHERE uid = " + dialogId).stepThis().dispose();
if (dialogId < 0) {
database.executeFast("UPDATE chat_settings_v2 SET pinned = " + 0 + " WHERE uid = " + dialogId).stepThis().dispose();
database.executeFast(String.format(Locale.US, "UPDATE chat_settings_v2 SET pinned = 0 WHERE uid = %d", -dialogId)).stepThis().dispose();
} else {
database.executeFast("UPDATE user_settings SET pinned = " + 0 + " WHERE uid = " + dialogId).stepThis().dispose();
database.executeFast(String.format(Locale.US, "UPDATE user_settings SET pinned = 0 WHERE uid = %d", dialogId)).stepThis().dispose();
}
newCount = 0;
endReached = true;
} else {
database.executeFast(String.format("DELETE FROM chat_pinned_v2 WHERE uid = " + dialogId + " AND mid IN(%s)", TextUtils.join(",", ids))).stepThis().dispose();
String idsStr = TextUtils.join(",", ids);
if (dialogId < 0) {
database.executeFast(String.format(Locale.US, "UPDATE chat_settings_v2 SET pinned = 0 WHERE uid = %d AND pinned IN (%s)", -dialogId, idsStr)).stepThis().dispose();
} else {
database.executeFast(String.format(Locale.US, "UPDATE user_settings SET pinned = 0 WHERE uid = %d AND pinned IN (%s)", dialogId, idsStr)).stepThis().dispose();
}
database.executeFast(String.format(Locale.US, "DELETE FROM chat_pinned_v2 WHERE uid = %d AND mid IN(%s)", dialogId, idsStr)).stepThis().dispose();
SQLiteCursor cursor = database.queryFinalized("SELECT changes()");
int updatedCount = cursor.next() ? cursor.intValue(0) : 0;
@ -8990,6 +8997,14 @@ public class MessagesStorage extends BaseController {
for (int a = 0, N = messagesByDialogs.size(); a < N; a++) {
long did = messagesByDialogs.keyAt(a);
ArrayList<Integer> mids = messagesByDialogs.valueAt(a);
int lowerId = (int) did;
if (lowerId != 0) {
if (lowerId < 0) {
database.executeFast(String.format(Locale.US, "UPDATE chat_settings_v2 SET pinned = 0 WHERE uid = %d AND pinned IN (%s)", -lowerId, mids)).stepThis().dispose();
} else {
database.executeFast(String.format(Locale.US, "UPDATE user_settings SET pinned = 0 WHERE uid = %d AND pinned IN (%s)", lowerId, mids)).stepThis().dispose();
}
}
database.executeFast(String.format(Locale.US, "DELETE FROM chat_pinned_v2 WHERE uid = %d AND mid IN(%s)", did, TextUtils.join(",", mids))).stepThis().dispose();
int updatedCount = 0;
cursor = database.queryFinalized("SELECT changes()");
@ -9332,7 +9347,9 @@ public class MessagesStorage extends BaseController {
state.dispose();
}
database.executeFast(String.format(Locale.US, "DELETE FROM chat_pinned_v2 WHERE uid = %d AND mid <= %d", -channelId, maxMessageId)).stepThis().dispose();
database.executeFast(String.format(Locale.US, "UPDATE chat_settings_v2 SET pinned = 0 WHERE uid = %d AND pinned <= %d", channelId, maxMessageId)).stepThis().dispose();
database.executeFast(String.format(Locale.US, "DELETE FROM chat_pinned_v2 WHERE uid = %d AND mid <= %d", channelId, maxMessageId)).stepThis().dispose();
int updatedCount = 0;
cursor = database.queryFinalized("SELECT changes()");
if (cursor.next()) {

View file

@ -5220,7 +5220,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
}
}
private static boolean prepareSendingDocumentInternal(AccountInstance accountInstance, String path, String originalPath, Uri uri, String mime, long dialogId, MessageObject replyToMsg, MessageObject replyToTopMsg, CharSequence caption, final ArrayList<TLRPC.MessageEntity> entities, final MessageObject editingMessageObject, long[] groupId, boolean isGroupFinal, boolean forceDocument, boolean notify, int scheduleDate, Boolean[] withThumb) {
private static boolean prepareSendingDocumentInternal(AccountInstance accountInstance, String path, String originalPath, Uri uri, String mime, long dialogId, MessageObject replyToMsg, MessageObject replyToTopMsg, CharSequence caption, final ArrayList<TLRPC.MessageEntity> entities, final MessageObject editingMessageObject, long[] groupId, boolean isGroupFinal, boolean forceDocument, boolean notify, int scheduleDate, Integer[] docType) {
if ((path == null || path.length() == 0) && uri == null) {
return false;
}
@ -5448,19 +5448,25 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
if (originalPath != null) {
params.put("originalPath", originalPath);
}
if (forceDocument) {
if (forceDocument && attributeAudio == null) {
params.put("forceDocument", "1");
}
if (parentFinal != null) {
params.put("parentObject", parentFinal);
}
Boolean prevWithThumb = false;
if (withThumb != null) {
prevWithThumb = withThumb[0];
withThumb[0] = document.mime_type != null && (document.mime_type.toLowerCase().startsWith("image/") || document.mime_type.toLowerCase().startsWith("video/mp4")) || MessageObject.canPreviewDocument(document);
Integer prevType = 0;
if (docType != null) {
prevType = docType[0];
if (document.mime_type != null && (document.mime_type.toLowerCase().startsWith("image/") || document.mime_type.toLowerCase().startsWith("video/mp4")) || MessageObject.canPreviewDocument(document)) {
docType[0] = 1;
} else if (attributeAudio != null) {
docType[0] = 2;
} else {
docType[0] = 0;
}
}
if (groupId != null) {
if (withThumb != null && prevWithThumb != null && prevWithThumb != withThumb[0]) {
if (docType != null && prevType != null && prevType != docType[0]) {
finishGroup(accountInstance, groupId[0], scheduleDate);
groupId[0] = Utilities.random.nextLong();
}
@ -5605,7 +5611,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
boolean error = false;
long[] groupId = new long[1];
int mediaCount = 0;
Boolean[] withThumb = new Boolean[1];
Integer[] docType = new Integer[1];
boolean isEncrypted = (int) dialogId == 0;
int enryptedLayer = 0;
@ -5630,7 +5636,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
}
mediaCount++;
long prevGroupId = groupId[0];
if (!prepareSendingDocumentInternal(accountInstance, paths.get(a), originalPaths.get(a), null, mime, dialogId, replyToMsg, replyToTopMsg, captionFinal, null, editingMessageObject, groupId, mediaCount == 10 || a == count - 1, true, notify, scheduleDate, withThumb)) {
if (!prepareSendingDocumentInternal(accountInstance, paths.get(a), originalPaths.get(a), null, mime, dialogId, replyToMsg, replyToTopMsg, captionFinal, null, editingMessageObject, groupId, mediaCount == 10 || a == count - 1, true, notify, scheduleDate, docType)) {
error = true;
}
if (prevGroupId != groupId[0]) {
@ -5653,7 +5659,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
}
mediaCount++;
long prevGroupId = groupId[0];
if (!prepareSendingDocumentInternal(accountInstance, null, null, uris.get(a), mime, dialogId, replyToMsg, replyToTopMsg, captionFinal, null, editingMessageObject, groupId, mediaCount == 10 || a == count - 1, true, notify, scheduleDate, withThumb)) {
if (!prepareSendingDocumentInternal(accountInstance, null, null, uris.get(a), mime, dialogId, replyToMsg, replyToTopMsg, captionFinal, null, editingMessageObject, groupId, mediaCount == 10 || a == count - 1, true, notify, scheduleDate, docType)) {
error = true;
}
if (prevGroupId != groupId[0]) {

View file

@ -199,7 +199,7 @@ public class SharedConfig {
public static void loadConfig() {
synchronized (sync) {
if (configLoaded) {
if (configLoaded || ApplicationLoader.applicationContext == null) {
return;
}

View file

@ -645,6 +645,9 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
searchWas = false;
lastSearchId = 0;
waitingResponseCount = 0;
if (delegate != null) {
delegate.searchStateChanged(false, true);
}
searchMessagesInternal(null, 0);
notifyDataSetChanged();
localTipDates.clear();

View file

@ -2312,7 +2312,7 @@ public class DialogCell extends BaseCell {
StatusDrawable statusDrawable = Theme.getChatStatusDrawable(printingStringType);
if (statusDrawable != null) {
canvas.save();
int left = LocaleController.isRTL ? messageLeft + messageLayout.getWidth() - statusDrawable.getIntrinsicWidth() : messageLeft;
int left = (LocaleController.isRTL || messageLayout.isRtlCharAt(0)) ? messageLeft + messageLayout.getWidth() - statusDrawable.getIntrinsicWidth() : messageLeft;
if (printingStringType == 1 || printingStringType == 4) {
canvas.translate(left, messageTop + (printingStringType == 1 ? AndroidUtilities.dp(1) : 0));
} else {

View file

@ -6632,7 +6632,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private void searchUserMessages(TLRPC.User user, TLRPC.Chat chat) {
searchingUserMessages = user;
searchingChatMessages = chat;
if (searchingUserMessages == null && searchingChatMessages == null) {
if (searchItem == null || searchingUserMessages == null && searchingChatMessages == null) {
return;
}
String name;
@ -6923,7 +6923,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (!inPreviewMode && chatActivityEnterView != null) {
if (chatActivityEnterView.getAnimatedTop() != 0) {
chatListViewPaddingTop += chatActivityEnterView.getHeightWithTopView() - AndroidUtilities.dp(51) - chatActivityEnterView.getAnimatedTop();
} else {
} else if (!chatActivityEnterView.pannelAniamationInProgress()) {
chatListViewPaddingTop -= chatListView.getTranslationY();
}
}
@ -18081,6 +18081,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
messageObjects.add(selectedObject);
}
MediaController.saveFilesFromMessages(getParentActivity(), getAccountInstance(), messageObjects, (count) -> {
if (getParentActivity() == null) {
return;
}
if (count > 0) {
BulletinFactory.of(this).createDownloadBulletin(isMusic ? BulletinFactory.FileType.AUDIOS : BulletinFactory.FileType.UNKNOWNS, count).show();
}
@ -18104,6 +18107,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
path = FileLoader.getPathToMessage(selectedObject.messageOwner).toString();
}
MediaController.saveFile(path, getParentActivity(), 2, fileName, selectedObject.getDocument() != null ? selectedObject.getDocument().mime_type : "", () -> {
if (getParentActivity() == null) {
return;
}
final BulletinFactory.FileType fileType;
if (photo) {
fileType = BulletinFactory.FileType.PHOTO_TO_DOWNLOADS;

View file

@ -35,6 +35,8 @@ public class SlotsDrawable extends RLottieDrawable {
private int[] secondFrameCounts = new int[3];
private int[] secondFrameNums = new int[3];
private boolean playWinAnimation;
public SlotsDrawable(String diceEmoji, int w, int h) {
super(diceEmoji, w, h);
@ -82,7 +84,7 @@ public class SlotsDrawable extends RLottieDrawable {
secondFrameNums[a] = secondFrameCounts[a] - 1;
}
}
if (autoRepeatPlayCount == 1) {
if (playWinAnimation) {
if (frameNums[0] + 1 < frameCounts[0]) {
frameNums[0]++;
} else {
@ -92,10 +94,12 @@ public class SlotsDrawable extends RLottieDrawable {
getFrame(nativePtrs[0], Math.max(frameNums[0], 0), backgroundBitmap, width, height, backgroundBitmap.getRowBytes(), true);
for (int a = 0; a < secondNativePtrs.length; a++) {
getFrame(secondNativePtrs[a], secondFrameNums[a] >= 0 ? secondFrameNums[a] : (secondFrameCounts[a] - 1), backgroundBitmap, width, height, backgroundBitmap.getRowBytes(), false);
if (secondFrameNums[a] + 1 < secondFrameCounts[a]) {
secondFrameNums[a]++;
} else {
secondFrameNums[a] = -1;
if (!nextFrameIsLast) {
if (secondFrameNums[a] + 1 < secondFrameCounts[a]) {
secondFrameNums[a]++;
} else {
secondFrameNums[a] = -1;
}
}
}
result = getFrame(nativePtrs[4], frameNums[4], backgroundBitmap, width, height, backgroundBitmap.getRowBytes(), false);
@ -104,12 +108,11 @@ public class SlotsDrawable extends RLottieDrawable {
}
if (secondFrameNums[0] == -1 && secondFrameNums[1] == -1 && secondFrameNums[2] == -1) {
nextFrameIsLast = true;
autoRepeatPlayCount++;
}
if (left == right && right == center) {
if (secondFrameNums[0] == secondFrameCounts[0] - 100) {
if (autoRepeatPlayCount == 0) {
autoRepeatPlayCount++;
}
playWinAnimation = true;
if (left == ReelValue.sevenWin) {
Runnable runnable = onFinishCallback.get();
if (runnable != null) {

View file

@ -867,7 +867,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
proximityButton.setContentDescription(LocaleController.getString("AccDescrLocationNotify", R.string.AccDescrLocationNotify));
mapViewClip.addView(proximityButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 40 : 44, Build.VERSION.SDK_INT >= 21 ? 40 : 44, Gravity.RIGHT | Gravity.TOP, 0, 12 + 50, 12, 0));
proximityButton.setOnClickListener(v -> {
if (getParentActivity() == null || myLocation == null || !checkGpsEnabled()) {
if (getParentActivity() == null || myLocation == null || !checkGpsEnabled() || googleMap == null) {
return;
}
if (hintView != null) {
@ -1836,6 +1836,9 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
}
private void createCircle(int meters) {
if (googleMap == null) {
return;
}
List<PatternItem> PATTERN_POLYGON_ALPHA = Arrays.asList(new Gap(20), new Dash(20));
CircleOptions circleOptions = new CircleOptions();