Skip to content

Commit

Permalink
update to 11.2.3 (5335)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkaraush committed Oct 17, 2024
1 parent 1e89182 commit 9b78d43
Show file tree
Hide file tree
Showing 188 changed files with 14,174 additions and 4,848 deletions.
8 changes: 4 additions & 4 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ android {
minifyEnabled false
shrinkResources false
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro', '../TMessagesProj/proguard-rules-beta.pro'
ndk.debugSymbolLevel = 'FULL'
buildConfigField "String", "BUILD_VERSION_STRING", "\"" + APP_VERSION_NAME + "\""
buildConfigField "String", "APP_CENTER_HASH", "\"\""
Expand All @@ -129,7 +129,7 @@ android {
jniDebuggable false
minifyEnabled true
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro', '../TMessagesProj/proguard-rules-beta.pro'
ndk.debugSymbolLevel = 'FULL'
buildConfigField "String", "BUILD_VERSION_STRING", "\"" + APP_VERSION_NAME + "\""
buildConfigField "String", "APP_CENTER_HASH", "\"" + getProps("APP_CENTER_HASH_PRIVATE") + "\""
Expand All @@ -142,7 +142,7 @@ android {
jniDebuggable false
minifyEnabled true
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro', '../TMessagesProj/proguard-rules-beta.pro'
ndk.debugSymbolLevel = 'FULL'
buildConfigField "String", "BUILD_VERSION_STRING", "\"" + APP_VERSION_NAME + "\""
buildConfigField "String", "APP_CENTER_HASH", "\"" + getProps("APP_CENTER_HASH_PUBLIC") + "\""
Expand All @@ -155,7 +155,7 @@ android {
jniDebuggable false
minifyEnabled true
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro', '../TMessagesProj/proguard-rules-beta.pro'
ndk.debugSymbolLevel = 'FULL'
buildConfigField "String", "BUILD_VERSION_STRING", "\"" + APP_VERSION_NAME + "\""
buildConfigField "String", "APP_CENTER_HASH", "\"" + getProps("APP_CENTER_HASH_HARDCORE") + "\""
Expand Down
6 changes: 3 additions & 3 deletions TMessagesProj/jni/TgNetWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jint getTimeDifference(JNIEnv *env, jclass c, jint instanceNum) {
void sendRequest(JNIEnv *env, jclass c, jint instanceNum, jlong object, jint flags, jint datacenterId, jint connectionType, jboolean immediate, jint token) {
TL_api_request *request = new TL_api_request();
request->request = (NativeByteBuffer *) (intptr_t) object;
ConnectionsManager::getInstance(instanceNum).sendRequest(request, ([instanceNum, token](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId) {
ConnectionsManager::getInstance(instanceNum).sendRequest(request, ([instanceNum, token](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId, int32_t dcId) {
TL_api_response *resp = (TL_api_response *) response;
jlong ptr = 0;
jint errorCode = 0;
Expand All @@ -117,7 +117,7 @@ void sendRequest(JNIEnv *env, jclass c, jint instanceNum, jlong object, jint fla
errorText = jniEnv[instanceNum]->NewStringUTF("UTF-8 ERROR");
}
}
jniEnv[instanceNum]->CallStaticVoidMethod(jclass_ConnectionsManager, jclass_ConnectionsManager_onRequestComplete, instanceNum, token, ptr, errorCode, errorText, networkType, responseTime, msgId);
jniEnv[instanceNum]->CallStaticVoidMethod(jclass_ConnectionsManager, jclass_ConnectionsManager_onRequestComplete, instanceNum, token, ptr, errorCode, errorText, networkType, responseTime, msgId, dcId);
if (errorText != nullptr) {
jniEnv[instanceNum]->DeleteLocalRef(errorText);
}
Expand Down Expand Up @@ -561,7 +561,7 @@ extern "C" int registerNativeTgNetFunctions(JavaVM *vm, JNIEnv *env) {
if (jclass_ConnectionsManager_onRequestClear == 0) {
return JNI_FALSE;
}
jclass_ConnectionsManager_onRequestComplete = env->GetStaticMethodID(jclass_ConnectionsManager, "onRequestComplete", "(IIJILjava/lang/String;IJJ)V");
jclass_ConnectionsManager_onRequestComplete = env->GetStaticMethodID(jclass_ConnectionsManager, "onRequestComplete", "(IIJILjava/lang/String;IJJI)V");
if (jclass_ConnectionsManager_onRequestComplete == 0) {
return JNI_FALSE;
}
Expand Down
30 changes: 18 additions & 12 deletions TMessagesProj/jni/tgnet/ConnectionsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,8 @@ void ConnectionsManager::cleanUp(bool resetKeys, int32_t datacenterId) {
auto error = new TL_error();
error->code = -1000;
error->text = "";
request->onComplete(nullptr, error, 0, 0, request->messageId);
int32_t dcId = request->datacenterId != DEFAULT_DATACENTER_ID ? request->datacenterId : currentDatacenterId;
request->onComplete(nullptr, error, 0, 0, request->messageId, dcId);
delete error;
}
iter = requestsQueue.erase(iter);
Expand All @@ -646,7 +647,8 @@ void ConnectionsManager::cleanUp(bool resetKeys, int32_t datacenterId) {
auto error = new TL_error();
error->code = -1000;
error->text = "";
request->onComplete(nullptr, error, 0, 0, request->messageId);
int32_t dcId = request->datacenterId != DEFAULT_DATACENTER_ID ? request->datacenterId : currentDatacenterId;
request->onComplete(nullptr, error, 0, 0, request->messageId, dcId);
delete error;
}
DEBUG_D("1) erase request %d 0x%" PRIx64, request->requestToken, request->messageId);
Expand Down Expand Up @@ -1205,7 +1207,8 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
for (auto iter = runningRequests.begin(); iter != runningRequests.end(); iter++) {
Request *request = iter->get();
if (request->respondsToMessageId(requestMid)) {
request->onComplete(response, nullptr, connection->currentNetworkType, timeMessage, requestMid);
int32_t dcId = request->datacenterId != DEFAULT_DATACENTER_ID ? request->datacenterId : currentDatacenterId;
request->onComplete(response, nullptr, connection->currentNetworkType, timeMessage, requestMid, dcId);
request->completed = true;
DEBUG_D("4) erase request %d 0x%" PRIx64, request->requestToken, request->messageId);
runningRequests.erase(iter);
Expand Down Expand Up @@ -1450,12 +1453,13 @@ void ConnectionsManager::processServerResponse(TLObject *message, int64_t messag
}

if (!discardResponse) {
int32_t dcId = request->datacenterId != DEFAULT_DATACENTER_ID ? request->datacenterId : currentDatacenterId;
if (implicitError != nullptr || error2 != nullptr) {
isError = true;
request->onComplete(nullptr, implicitError != nullptr ? implicitError : error2, connection->currentNetworkType, timeMessage, request->messageId);
request->onComplete(nullptr, implicitError != nullptr ? implicitError : error2, connection->currentNetworkType, timeMessage, request->messageId, dcId);
delete error2;
} else {
request->onComplete(response->result.get(), nullptr, connection->currentNetworkType, timeMessage, request->messageId);
request->onComplete(response->result.get(), nullptr, connection->currentNetworkType, timeMessage, request->messageId, dcId);
}
}

Expand Down Expand Up @@ -2104,7 +2108,7 @@ bool ConnectionsManager::cancelRequestInternal(int32_t token, int64_t messageId,
auto dropAnswer = new TL_rpc_drop_answer();
dropAnswer->req_msg_id = request->messageId;
if (onCancelled != nullptr) {
sendRequest(dropAnswer, ([onCancelled](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId) -> void {
sendRequest(dropAnswer, ([onCancelled](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId, int32_t dcId) -> void {
if (onCancelled != nullptr) {
onCancelled();
}
Expand Down Expand Up @@ -2161,7 +2165,8 @@ void ConnectionsManager::failNotRunningRequest(int32_t token) {
auto error = new TL_error();
error->code = -2000;
error->text = "CANCELLED_REQUEST";
request->onComplete(nullptr, error, 0, 0, request->messageId);
int32_t dcId = request->datacenterId != DEFAULT_DATACENTER_ID ? request->datacenterId : currentDatacenterId;
request->onComplete(nullptr, error, 0, 0, request->messageId, dcId);

request->cancelled = true;
if (LOGS_ENABLED) DEBUG_D("cancelled queued rpc request %p - %s", request->rawRequest, typeid(*request->rawRequest).name());
Expand Down Expand Up @@ -2304,7 +2309,7 @@ void ConnectionsManager::requestSaltsForDatacenter(Datacenter *datacenter, bool
requestingSaltsForDc.push_back(id);
auto request = new TL_get_future_salts();
request->num = 32;
sendRequest(request, [&, datacenter, id, media](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId) {
sendRequest(request, [&, datacenter, id, media](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId, int32_t dcId) {
auto iter = std::find(requestingSaltsForDc.begin(), requestingSaltsForDc.end(), id);
if (iter != requestingSaltsForDc.end()) {
requestingSaltsForDc.erase(iter);
Expand Down Expand Up @@ -2339,7 +2344,7 @@ void ConnectionsManager::registerForInternalPushUpdates() {
request->token_type = 7;
request->token = to_string_uint64((uint64_t) pushSessionId);

sendRequest(request, [&](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId) {
sendRequest(request, [&](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId, int32_t dcId) {
if (error == nullptr) {
registeredForInternalPush = true;
if (LOGS_ENABLED) DEBUG_D("registered for internal push");
Expand Down Expand Up @@ -2562,7 +2567,8 @@ void ConnectionsManager::processRequestQueue(uint32_t connectionTypes, uint32_t
auto error = new TL_error();
error->code = -123;
error->text = "RETRY_LIMIT";
request->onComplete(nullptr, error, connection->currentNetworkType, 0, request->messageId);
int32_t dcId = request->datacenterId != DEFAULT_DATACENTER_ID ? request->datacenterId : currentDatacenterId;
request->onComplete(nullptr, error, connection->currentNetworkType, 0, request->messageId, dcId);
delete error;
DEBUG_D("12) erase request %d 0x%" PRIx64, request->requestToken, request->messageId);
iter = runningRequests.erase(iter);
Expand Down Expand Up @@ -3273,7 +3279,7 @@ void ConnectionsManager::updateDcSettings(uint32_t dcNum, bool workaround, bool
}

auto request = new TL_help_getConfig();
sendRequest(request, [&, workaround](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId) {
sendRequest(request, [&, workaround](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId, int32_t dcId) {
if ((!workaround && !updatingDcSettings) || (workaround && !updatingDcSettingsWorkaround)) {
return;
}
Expand Down Expand Up @@ -3422,7 +3428,7 @@ void ConnectionsManager::authorizeOnMovingDatacenter() {
auto request = new TL_auth_importAuthorization();
request->id = currentUserId;
request->bytes = std::move(movingAuthorization);
sendRequest(request, [&](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId) {
sendRequest(request, [&](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId, int32_t dcId) {
if (error == nullptr) {
authorizedOnMovingDatacenter();
} else {
Expand Down
4 changes: 2 additions & 2 deletions TMessagesProj/jni/tgnet/Datacenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1447,14 +1447,14 @@ void Datacenter::exportAuthorization() {
auto request = new TL_auth_exportAuthorization();
request->dc_id = datacenterId;
if (LOGS_ENABLED) DEBUG_D("dc%u begin export authorization", datacenterId);
ConnectionsManager::getInstance(instanceNum).sendRequest(request, [&](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId) {
ConnectionsManager::getInstance(instanceNum).sendRequest(request, [&](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId, int32_t dcId) {
if (error == nullptr) {
auto res = (TL_auth_exportedAuthorization *) response;
auto request2 = new TL_auth_importAuthorization();
request2->bytes = std::move(res->bytes);
request2->id = res->id;
if (LOGS_ENABLED) DEBUG_D("dc%u begin import authorization", datacenterId);
ConnectionsManager::getInstance(instanceNum).sendRequest(request2, [&](TLObject *response2, TL_error *error2, int32_t networkType, int64_t responseTime, int64_t msgId) {
ConnectionsManager::getInstance(instanceNum).sendRequest(request2, [&](TLObject *response2, TL_error *error2, int32_t networkType, int64_t responseTime, int64_t msgId, int32_t dcId) {
if (error2 == nullptr) {
authorized = true;
ConnectionsManager::getInstance(instanceNum).onDatacenterExportAuthorizationComplete(this);
Expand Down
2 changes: 1 addition & 1 deletion TMessagesProj/jni/tgnet/Defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class NativeByteBuffer;
class Handshake;
class ConnectionSocket;

typedef std::function<void(TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId)> onCompleteFunc;
typedef std::function<void(TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId, int32_t dcId)> onCompleteFunc;
typedef std::function<void()> onQuickAckFunc;
typedef std::function<void()> onWriteToSocketFunc;
typedef std::function<void()> onRequestClearFunc;
Expand Down
4 changes: 2 additions & 2 deletions TMessagesProj/jni/tgnet/Handshake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ void Handshake::processHandshakeResponse_serverDHParamsAnswer(TLObject *message,
request->encrypted_message = currentDatacenter->createRequestsData(array, nullptr, connection, true);
};

authKeyPendingRequestId = ConnectionsManager::getInstance(currentDatacenter->instanceNum).sendRequest(request, [&](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId) {
authKeyPendingRequestId = ConnectionsManager::getInstance(currentDatacenter->instanceNum).sendRequest(request, [&](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId, int32_t dcId) {
authKeyPendingMessageId = 0;
authKeyPendingRequestId = 0;
if (response != nullptr && typeid(*response) == typeid(TL_boolTrue)) {
Expand Down Expand Up @@ -989,7 +989,7 @@ void Handshake::loadCdnConfig(Datacenter *datacenter) {
loadingCdnKeys = true;
auto request = new TL_help_getCdnConfig();

ConnectionsManager::getInstance(datacenter->instanceNum).sendRequest(request, [&, datacenter](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId) {
ConnectionsManager::getInstance(datacenter->instanceNum).sendRequest(request, [&, datacenter](TLObject *response, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msgId, int32_t dcId) {
if (response != nullptr) {
auto config = (TL_cdnConfig *) response;
size_t count = config->public_keys.size();
Expand Down
4 changes: 2 additions & 2 deletions TMessagesProj/jni/tgnet/Request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ void Request::clear(bool time) {
}
}

void Request::onComplete(TLObject *result, TL_error *error, int32_t networkType, int64_t responseTime, int64_t requestMsgId) {
void Request::onComplete(TLObject *result, TL_error *error, int32_t networkType, int64_t responseTime, int64_t requestMsgId, int32_t dcId) {
if (onCompleteRequestCallback != nullptr && (result != nullptr || error != nullptr)) {
completedSent = true;
onCompleteRequestCallback(result, error, networkType, responseTime, requestMsgId);
onCompleteRequestCallback(result, error, networkType, responseTime, requestMsgId, dcId);
}
}

Expand Down
2 changes: 1 addition & 1 deletion TMessagesProj/jni/tgnet/Request.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Request {
void addRespondMessageId(int64_t id);
bool respondsToMessageId(int64_t id);
void clear(bool time);
void onComplete(TLObject *result, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msg_id);
void onComplete(TLObject *result, TL_error *error, int32_t networkType, int64_t responseTime, int64_t msg_id, int32_t dcId);
void onQuickAck();
void onWriteToSocket();
bool isMediaRequest();
Expand Down
8 changes: 8 additions & 0 deletions TMessagesProj/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,14 @@
</intent-filter>
</receiver>

<receiver
android:name=".CopyCodeReceiver"
android:exported="false">
<intent-filter>
<action android:name="org.telegram.messenger.ACTION_COPY_CODE"/>
</intent-filter>
</receiver>

<receiver
android:name=".NotificationsDisabledReceiver"
android:exported="false">
Expand Down
1 change: 1 addition & 0 deletions TMessagesProj/src/main/assets/darkblue.attheme
Original file line number Diff line number Diff line change
Expand Up @@ -446,3 +446,4 @@ iv_backgroundGray=-14737633
iv_navigationBackground=-16777216
table_background=177390847
table_border=436207615
dialogCardShadow=1073741824
1 change: 1 addition & 0 deletions TMessagesProj/src/main/assets/night.attheme
Original file line number Diff line number Diff line change
Expand Up @@ -471,3 +471,4 @@ iv_backgroundGray=-14737633
iv_navigationBackground=-16777216
table_background=177390847
table_border=436207615
dialogCardShadow=1073741824

This comment has been minimized.

Copy link
@ANG377

ANG377 Nov 9, 2024

Loading

1 comment on commit 9b78d43

@ANG377
Copy link

@ANG377 ANG377 commented on 9b78d43 Nov 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Please sign in to comment.