Skip to content

Commit

Permalink
update to 9.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
xaxtix committed Apr 27, 2023
1 parent 3c9a4c1 commit e77ac04
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 57 deletions.
2 changes: 1 addition & 1 deletion TMessagesProj/jni/tgnet/Defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#define USE_DEBUG_SESSION false
#define READ_BUFFER_SIZE 1024 * 1024 * 2
//#define DEBUG_VERSION
#define DEBUG_VERSION
#define PFS_ENABLED 1
#define DEFAULT_DATACENTER_ID INT_MAX
#define DC_UPDATE_TIME 60 * 60
Expand Down
54 changes: 28 additions & 26 deletions TMessagesProj/jni/tgnet/Handshake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -940,32 +940,33 @@ void Handshake::loadCdnConfig(Datacenter *datacenter) {
if (loadingCdnKeys) {
return;
}
if (cdnPublicKeysFingerprints.empty()) {
if (cdnConfig == nullptr) {
cdnConfig = new Config(datacenter->instanceNum, "cdnkeys.dat");
}
NativeByteBuffer *buffer = cdnConfig->readConfig();
if (buffer != nullptr) {
uint32_t version = buffer->readUint32(nullptr);
if (version >= 1) {
size_t count = buffer->readUint32(nullptr);
for (uint32_t a = 0; a < count; a++) {
int dcId = buffer->readInt32(nullptr);
cdnPublicKeys[dcId] = buffer->readString(nullptr);
cdnPublicKeysFingerprints[dcId] = buffer->readUint64(nullptr);
}
}
buffer->reuse();
if (!cdnPublicKeysFingerprints.empty()) {
size_t count = cdnWaitingDatacenters.size();
for (uint32_t a = 0; a < count; a++) {
cdnWaitingDatacenters[a]->beginHandshake(HandshakeTypeCurrent, false);
}
cdnWaitingDatacenters.clear();
return;
}
}
}
if (LOGS_ENABLED) DEBUG_D("account%u dc%u loadCdnConfig", datacenter->instanceNum, datacenter->datacenterId);
// if (cdnPublicKeysFingerprints.empty()) {
// if (cdnConfig == nullptr) {
// cdnConfig = new Config(datacenter->instanceNum, "cdnkeys.dat");
// }
// NativeByteBuffer *buffer = cdnConfig->readConfig();
// if (buffer != nullptr) {
// uint32_t version = buffer->readUint32(nullptr);
// if (version >= 1) {
// size_t count = buffer->readUint32(nullptr);
// for (uint32_t a = 0; a < count; a++) {
// int dcId = buffer->readInt32(nullptr);
// cdnPublicKeys[dcId] = buffer->readString(nullptr);
// cdnPublicKeysFingerprints[dcId] = buffer->readUint64(nullptr);
// }
// }
// buffer->reuse();
// if (!cdnPublicKeysFingerprints.empty()) {
// size_t count = cdnWaitingDatacenters.size();
// for (uint32_t a = 0; a < count; a++) {
// cdnWaitingDatacenters[a]->beginHandshake(HandshakeTypeCurrent, false);
// }
// cdnWaitingDatacenters.clear();
// return;
// }
// }
// }
loadingCdnKeys = true;
auto request = new TL_help_getCdnConfig();

Expand Down Expand Up @@ -1008,6 +1009,7 @@ void Handshake::loadCdnConfig(Datacenter *datacenter) {
buffer->reuse();
BIO_free(keyBio);
count = cdnWaitingDatacenters.size();
if (LOGS_ENABLED) DEBUG_D("account%u dc%u cdnConfig loaded begin handshake", datacenter->instanceNum, datacenter->datacenterId);
for (uint32_t a = 0; a < count; a++) {
cdnWaitingDatacenters[a]->beginHandshake(HandshakeTypeCurrent, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
public static int BUILD_VERSION = 3341;
public static String BUILD_VERSION_STRING = "9.6.2";
public static int BUILD_VERSION = 3343;
public static String BUILD_VERSION_STRING = "9.6.3";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

Expand Down
24 changes: 11 additions & 13 deletions TMessagesProj/src/main/java/org/telegram/messenger/FileLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -801,11 +801,8 @@ private FileLoadOperation loadFileInternal(final TLRPC.Document document, final
public void didPreFinishLoading(FileLoadOperation operation, File finalFile) {
FileLoaderPriorityQueue queue = operation.getQueue();
fileLoaderQueue.postRunnable(() -> {
FileLoadOperation currentOperation = loadOperationPaths.get(fileName);
if (currentOperation != null) {
currentOperation.preFinished = true;
queue.checkLoadingOperations();
}
operation.preFinished = true;
queue.checkLoadingOperations();
});
}

Expand All @@ -832,13 +829,13 @@ public void didFinishLoadingFile(FileLoadOperation operation, File finalFile) {
}
}

checkDownloadQueue(operation.getQueue(), fileName, 100);
checkDownloadQueue(operation, operation.getQueue(), 100);
}

@Override
public void didFailedLoadingFile(FileLoadOperation operation, int reason) {
loadOperationPathsUI.remove(fileName);
checkDownloadQueue(operation.getQueue(), fileName);
checkDownloadQueue(operation, operation.getQueue());
if (delegate != null) {
delegate.fileDidFailedLoad(fileName, reason);
}
Expand Down Expand Up @@ -986,15 +983,16 @@ protected FileLoadOperation loadStreamFile(final FileLoadOperationStream stream,
return result[0];
}

private void checkDownloadQueue(FileLoaderPriorityQueue queue, String fileName) {
checkDownloadQueue(queue, fileName, 0);
private void checkDownloadQueue(FileLoadOperation operation, FileLoaderPriorityQueue queue) {
checkDownloadQueue(operation, queue, 0);
}

private void checkDownloadQueue(FileLoaderPriorityQueue queue, String fileName, long delay) {
private void checkDownloadQueue(FileLoadOperation operation, FileLoaderPriorityQueue queue, long delay) {
fileLoaderQueue.postRunnable(() -> {
FileLoadOperation operation = loadOperationPaths.remove(fileName);
queue.remove(operation);
queue.checkLoadingOperations();
if (queue.remove(operation)) {
loadOperationPaths.remove(operation.getFileName());
queue.checkLoadingOperations();
}
}, delay);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ public void checkLoadingOperations() {
}
}

public void remove(FileLoadOperation operation) {
public boolean remove(FileLoadOperation operation) {
if (operation == null) {
return;
return false;
}
allOperations.remove(operation);
return allOperations.remove(operation);
}

public int getCount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6954,8 +6954,8 @@ public void onRingtoneUploaded(String filePath, TLRPC.Document document, boolean
ringtoneDataStore.onRingtoneUploaded(filePath, document, error);
}

public void checkRingtones() {
ringtoneDataStore.loadUserRingtones();
public void checkRingtones(boolean force) {
ringtoneDataStore.loadUserRingtones(force);
}

public boolean saveToRingtones(TLRPC.Document document) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15871,7 +15871,7 @@ public boolean processUpdateArray(ArrayList<TLRPC.Update> updates, ArrayList<TLR
TLRPC.TL_updatePendingJoinRequests update = (TLRPC.TL_updatePendingJoinRequests) baseUpdate;
getMemberRequestsController().onPendingRequestsUpdated(update);
} else if (baseUpdate instanceof TLRPC.TL_updateSavedRingtones) {
getMediaDataController().ringtoneDataStore.loadUserRingtones();
getMediaDataController().ringtoneDataStore.loadUserRingtones(true);
} else if (baseUpdate instanceof TLRPC.TL_updateTranscribeAudio) {
FileLog.e("Received legacy TL_updateTranscribeAudio update");
} else if (baseUpdate instanceof TLRPC.TL_updateTranscribedAudio) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public void applySoundSettings(TLRPC.NotificationSound settings, SharedPreferenc
} else if (settings instanceof TLRPC.TL_notificationSoundRingtone) {
TLRPC.TL_notificationSoundRingtone soundRingtone = (TLRPC.TL_notificationSoundRingtone) settings;
editor.putLong(soundDocPref, soundRingtone.id);
MediaDataController.getInstance(currentAccount).checkRingtones();
MediaDataController.getInstance(currentAccount).checkRingtones(true);
if (serverUpdate && dialogId != 0) {
editor.putBoolean("custom_" + dialogId, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ public RingtoneDataStore(int currentAccount) {
FileLog.e(e);
}
AndroidUtilities.runOnUIThread(() -> {
loadUserRingtones();
loadUserRingtones(false);
});
}

public void loadUserRingtones() {
boolean needReload = System.currentTimeMillis() - lastReloadTimeMs > reloadTimeoutMs;
public void loadUserRingtones(boolean force) {
boolean needReload = force || System.currentTimeMillis() - lastReloadTimeMs > reloadTimeoutMs;
TLRPC.TL_account_getSavedRingtones req = new TLRPC.TL_account_getSavedRingtones();
req.hash = queryHash;
if (needReload) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ private void checkMessageObjectForAudio(CacheModel.FileInfo fileInfo, int positi
message.media.flags |= 3;
message.media.document = new TLRPC.TL_document();
message.flags |= TLRPC.MESSAGE_FLAG_HAS_MEDIA | TLRPC.MESSAGE_FLAG_HAS_FROM_ID;
message.dialog_id = fileInfo.dialogId;

String ext = FileLoader.getFileExtension(fileInfo.file);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected void onDraw(Canvas canvas) {
if (suggestions.contains("VALIDATE_PHONE_NUMBER") || suggestions.contains("VALIDATE_PASSWORD")) {
int countTop = AndroidUtilities.dp(12.5f);
int countWidth = AndroidUtilities.dp(9);
int countLeft = getMeasuredWidth() - countWidth - AndroidUtilities.dp(25);
int countLeft = LocaleController.isRTL ? countWidth + AndroidUtilities.dp(25) : getMeasuredWidth() - countWidth - AndroidUtilities.dp(25);

int x = countLeft - AndroidUtilities.dp(5.5f);
rect.set(x, countTop, x + countWidth + AndroidUtilities.dp(14), countTop + AndroidUtilities.dp(23));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2010,7 +2010,13 @@ private void updateTitle(boolean shutdown) {
} else {
optionsButton.setVisibility(View.VISIBLE);
}
if (MessagesController.getInstance(currentAccount).isChatNoForwards(messageObject.getChatId())) {
final long dialogId = messageObject.getDialogId();
final boolean noforwards = (
dialogId < 0 && MessagesController.getInstance(currentAccount).isChatNoForwards(-dialogId) ||
MessagesController.getInstance(currentAccount).isChatNoForwards(messageObject.getChatId()) ||
messageObject.messageOwner.noforwards
);
if (noforwards) {
optionsButton.hideSubItem(1);
optionsButton.hideSubItem(2);
optionsButton.hideSubItem(5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ private void updateActionMode() {
}

private void loadTones() {
getMediaDataController().ringtoneDataStore.loadUserRingtones();
getMediaDataController().ringtoneDataStore.loadUserRingtones(false);
serverTones.clear();
systemTones.clear();

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Sat Mar 12 05:53:50 MSK 2016
APP_VERSION_CODE=3341
APP_VERSION_NAME=9.6.2
APP_VERSION_CODE=3343
APP_VERSION_NAME=9.6.3
APP_PACKAGE=org.telegram.messenger
RELEASE_KEY_PASSWORD=android
RELEASE_KEY_ALIAS=androidkey
Expand Down

0 comments on commit e77ac04

Please sign in to comment.