Skip to content

Commit

Permalink
Update to 5.15.0 (1869)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKLO committed Feb 15, 2020
1 parent dae819b commit df90efa
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 5 deletions.
2 changes: 1 addition & 1 deletion TMessagesProj/build.gradle
Expand Up @@ -283,7 +283,7 @@ android {
}
}

defaultConfig.versionCode = 1868
defaultConfig.versionCode = 1869

applicationVariants.all { variant ->
variant.outputs.all { output ->
Expand Down
2 changes: 1 addition & 1 deletion TMessagesProj/jni/libtgvoip/VoIPController.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion TMessagesProj/jni/tgnet/ConnectionsManager.cpp
Expand Up @@ -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;
}

Expand Down
Expand Up @@ -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";
Expand Down
Expand Up @@ -7390,6 +7390,13 @@ public void putMessages(final TLRPC.messages_Messages messages, final long dialo
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();

Expand Down
Expand Up @@ -7211,11 +7211,14 @@ public static int getColor(String key, boolean[] isDefault, boolean ignoreAnimat
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;
}

Expand Down
Expand Up @@ -202,6 +202,7 @@ public SharedMediaPreloader(BaseFragment fragment) {
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) {
Expand All @@ -224,6 +225,7 @@ public void onDestroy(BaseFragment fragment) {
notificationCenter.removeObserver(this, NotificationCenter.messageReceivedByServer);
notificationCenter.removeObserver(this, NotificationCenter.mediaDidLoad);
notificationCenter.removeObserver(this, NotificationCenter.messagesDeleted);
notificationCenter.removeObserver(this, NotificationCenter.replaceMessagesObjects);
}

public int[] getLastMediaCount() {
Expand Down Expand Up @@ -391,6 +393,43 @@ public void didReceivedNotification(int id, int account, Object... args) {
}
}
loadMediaCounts();
} else if (id == NotificationCenter.replaceMessagesObjects) {
long did = (long) args[0];
if (did != dialogId && did != mergeDialogId) {
return;
}
int loadIndex = did == dialogId ? 0 : 1;
ArrayList<MessageObject> messageObjects = (ArrayList<MessageObject>) 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;
}
}
}
}
}

Expand Down

0 comments on commit df90efa

Please sign in to comment.