From df90eface5ebd755ea86c3a4eec66fe5b6e29041 Mon Sep 17 00:00:00 2001 From: DrKLO Date: Sat, 15 Feb 2020 21:17:30 +0300 Subject: [PATCH] Update to 5.15.0 (1869) --- TMessagesProj/build.gradle | 2 +- .../jni/libtgvoip/VoIPController.cpp | 2 +- .../jni/tgnet/ConnectionsManager.cpp | 2 +- .../org/telegram/messenger/BuildVars.java | 2 +- .../telegram/messenger/MessagesStorage.java | 7 ++++ .../java/org/telegram/ui/ActionBar/Theme.java | 5 ++- .../ui/Components/SharedMediaLayout.java | 39 +++++++++++++++++++ 7 files changed, 54 insertions(+), 5 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index b5a03a11d..87d9a9ebe 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -283,7 +283,7 @@ android { } } - defaultConfig.versionCode = 1868 + defaultConfig.versionCode = 1869 applicationVariants.all { variant -> variant.outputs.all { output -> diff --git a/TMessagesProj/jni/libtgvoip/VoIPController.cpp b/TMessagesProj/jni/libtgvoip/VoIPController.cpp index de0820e6a..53cf34a6c 100755 --- a/TMessagesProj/jni/libtgvoip/VoIPController.cpp +++ b/TMessagesProj/jni/libtgvoip/VoIPController.cpp @@ -3074,7 +3074,7 @@ static void initMachTimestart() { double VoIPController::GetCurrentTime(){ #if defined(__linux__) struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); + clock_gettime(CLOCK_BOOTTIME, &ts); return ts.tv_sec+(double)ts.tv_nsec/1000000000.0; #elif defined(__APPLE__) static pthread_once_t token = PTHREAD_ONCE_INIT; diff --git a/TMessagesProj/jni/tgnet/ConnectionsManager.cpp b/TMessagesProj/jni/tgnet/ConnectionsManager.cpp index 98ccf0b36..2da3ac4e3 100644 --- a/TMessagesProj/jni/tgnet/ConnectionsManager.cpp +++ b/TMessagesProj/jni/tgnet/ConnectionsManager.cpp @@ -552,7 +552,7 @@ int64_t ConnectionsManager::getCurrentTimeMillis() { } int64_t ConnectionsManager::getCurrentTimeMonotonicMillis() { - clock_gettime(CLOCK_MONOTONIC, &timeSpecMonotonic); + clock_gettime(CLOCK_BOOTTIME, &timeSpecMonotonic); return (int64_t) timeSpecMonotonic.tv_sec * 1000 + (int64_t) timeSpecMonotonic.tv_nsec / 1000000; } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index e40f47417..2a18a6c0c 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java @@ -19,7 +19,7 @@ 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 = 1868; + public static int BUILD_VERSION = 1869; public static String BUILD_VERSION_STRING = "5.15.0"; public static int APP_ID = 4; public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103"; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java index 1b1cf5446..0c6cac97c 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessagesStorage.java @@ -7390,6 +7390,13 @@ public class MessagesStorage extends BaseController { state_media.bindInteger(4, MediaDataController.getMediaType(message)); state_media.bindByteBuffer(5, data); state_media.step(); + } else if (message instanceof TLRPC.TL_messageService && message.action instanceof TLRPC.TL_messageActionHistoryClear) { + try { + database.executeFast(String.format(Locale.US, "DELETE FROM media_v2 WHERE mid = %d", message.id)).stepThis().dispose(); + database.executeFast("DELETE FROM media_counts_v2 WHERE uid = " + dialog_id).stepThis().dispose(); + } catch (Exception e2) { + FileLog.e(e2); + } } data.reuse(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java index c466cb767..e54336450 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java @@ -7211,11 +7211,14 @@ public class Theme { return getDefaultColor(key); } } + if (key.equals(key_windowBackgroundWhite) || key.equals(key_windowBackgroundGray)) { + return 0xff000000 | color; + } return color; } public static void setColor(String key, int color, boolean useDefault) { - if (key.equals(key_chat_wallpaper) || key.equals(key_chat_wallpaper_gradient_to)) { + if (key.equals(key_chat_wallpaper) || key.equals(key_chat_wallpaper_gradient_to) || key.equals(key_windowBackgroundWhite) || key.equals(key_windowBackgroundGray)) { color = 0xff000000 | color; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java index 5de0fdfa9..1ee8831b3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/SharedMediaLayout.java @@ -202,6 +202,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter notificationCenter.addObserver(this, NotificationCenter.messageReceivedByServer); notificationCenter.addObserver(this, NotificationCenter.mediaDidLoad); notificationCenter.addObserver(this, NotificationCenter.messagesDeleted); + notificationCenter.addObserver(this, NotificationCenter.replaceMessagesObjects); } public void addDelegate(SharedMediaPreloaderDelegate delegate) { @@ -224,6 +225,7 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter notificationCenter.removeObserver(this, NotificationCenter.messageReceivedByServer); notificationCenter.removeObserver(this, NotificationCenter.mediaDidLoad); notificationCenter.removeObserver(this, NotificationCenter.messagesDeleted); + notificationCenter.removeObserver(this, NotificationCenter.replaceMessagesObjects); } public int[] getLastMediaCount() { @@ -391,6 +393,43 @@ public class SharedMediaLayout extends FrameLayout implements NotificationCenter } } loadMediaCounts(); + } else if (id == NotificationCenter.replaceMessagesObjects) { + long did = (long) args[0]; + if (did != dialogId && did != mergeDialogId) { + return; + } + int loadIndex = did == dialogId ? 0 : 1; + ArrayList messageObjects = (ArrayList) args[1]; + for (int b = 0, N = messageObjects.size(); b < N; b++) { + MessageObject messageObject = messageObjects.get(b); + int mid = messageObject.getId(); + int type = MediaDataController.getMediaType(messageObject.messageOwner); + for (int a = 0; a < sharedMediaData.length; a++) { + MessageObject old = sharedMediaData[a].messagesDict[loadIndex].get(mid); + if (old != null) { + int oldType = MediaDataController.getMediaType(messageObject.messageOwner); + if (type == -1 || oldType != type) { + sharedMediaData[a].deleteMessage(mid, loadIndex); + if (loadIndex == 0) { + if (mediaCount[a] > 0) { + mediaCount[a]--; + } + } else { + if (mediaMergeCount[a] > 0) { + mediaMergeCount[a]--; + } + } + } else { + int idx = sharedMediaData[a].messages.indexOf(old); + if (idx >= 0) { + sharedMediaData[a].messagesDict[loadIndex].put(mid, messageObject); + sharedMediaData[a].messages.set(idx, messageObject); + } + } + break; + } + } + } } }