Skip to content

Commit

Permalink
Merge remote-tracking branch 'nekox/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Mar 28, 2023
2 parents 23ba3c0 + b93a338 commit 9893918
Show file tree
Hide file tree
Showing 11,938 changed files with 521,496 additions and 131,862 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
37 changes: 19 additions & 18 deletions .github/scripts/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def sendMessage(message, user_id = BOT_TARGET, entities = None) -> int:
"text": message,
"entities": entities
}
print(message)
print(entities)
resp = requests.post(API_PREFIX + "sendMessage", json=data).json()
print(resp)
return int(resp["result"]["message_id"])
Expand Down Expand Up @@ -105,6 +107,8 @@ def sendRelease():
text += " "
text += addEntity(entities, text, "bold", VERSION_NAME)
text += "\n\n"
if "entities" not in admin_resp:
admin_resp["entities"] = list()
resp_entities = admin_resp["entities"]
for en in resp_entities:
copy = en.copy()
Expand Down Expand Up @@ -140,24 +144,21 @@ def sendCIRelease():
print(sys.argv)
if len(sys.argv) != 2:
print("Run Type: release, ci, debug")
sys.stdout.flush()
sys.stderr.flush()
exit(1)
mode = sys.argv[1]
try:
if mode == "release":
sendRelease()
elif mode == "ci":
if COMMIT_MESSAGE.startswith("ci"):
CI_CHANNEL_ID = BOT_TARGET
sendCIRelease()
elif mode == "debug":
APK_CHANNEL_ID = "@test_channel_nekox"
UPDATE_CHANNEL_ID = "@test_channel_nekox"
UPDATE_METADATA_CHANNEL_ID = "@test_channel_nekox"
sendRelease()
else:
print("unknown mode")
exit(1)
except Exception as e:
print(e)
exit(1)
if mode == "release":
sendRelease()
elif mode == "ci":
if COMMIT_MESSAGE.startswith("ci"):
CI_CHANNEL_ID = BOT_TARGET
sendCIRelease()
elif mode == "debug":
APK_CHANNEL_ID = "@test_channel_nekox"
UPDATE_CHANNEL_ID = "@test_channel_nekox"
UPDATE_METADATA_CHANNEL_ID = "@test_channel_nekox"
sendRelease()
else:
print("unknown mode")

30 changes: 16 additions & 14 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import cn.hutool.core.util.RuntimeUtil
apply plugin: "com.android.application"
apply plugin: "kotlin-android"

def verName = "9.3.3"
def verCode = 1125
def verName = "9.5.6"
def verCode = 1126


def officialVer = "9.3.3"
def officialCode = 3026
def officialVer = "9.5.6"
def officialCode = 3237

def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")

Expand Down Expand Up @@ -69,8 +69,8 @@ def nativeTarget = System.getenv("NATIVE_TARGET")
if (nativeTarget == null) nativeTarget = ""

android {
compileSdkVersion 32
buildToolsVersion "32.0.0"
compileSdkVersion 33
buildToolsVersion "33.0.0"
ndkVersion rootProject.ext.ndkVersion

defaultConfig.applicationId = "xyz.nextalone.nagram"
Expand Down Expand Up @@ -313,26 +313,27 @@ def playCoreVersion = "1.10.3"

dependencies {

implementation "androidx.browser:browser:1.4.0"
implementation "androidx.core:core-ktx:1.8.0"
implementation "androidx.browser:browser:1.5.0"
implementation "androidx.core:core-ktx:1.9.0"
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.viewpager:viewpager:1.0.0"
implementation "androidx.exifinterface:exifinterface:1.3.3"
implementation "androidx.exifinterface:exifinterface:1.3.6"
implementation "androidx.interpolator:interpolator:1.0.0"
implementation "androidx.dynamicanimation:dynamicanimation:1.0.0"
implementation "androidx.multidex:multidex:2.0.1"
implementation "androidx.sharetarget:sharetarget:1.2.0"

compileOnly "org.checkerframework:checker-qual:3.16.0"
compileOnly "org.checkerframework:checker-compat-qual:2.5.5"
// just follow official
compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'

// don"t change this :)
//noinspection GradleDependency
implementation "com.googlecode.mp4parser:isoparser:1.0.6"

implementation "com.google.code.gson:gson:2.8.8"
implementation "com.google.code.gson:gson:2.8.9"
implementation "org.osmdroid:osmdroid-android:6.1.10"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1"

implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.10"
Expand All @@ -344,6 +345,7 @@ dependencies {
implementation "cn.hutool:hutool-crypto:5.7.13"
implementation 'cn.hutool:hutool-http:5.7.5'
implementation "com.jakewharton:process-phoenix:2.1.2"
implementation 'com.google.guava:guava:31.1-android'

compileOnly 'org.yaml:snakeyaml:1.29'
fullImplementation 'org.yaml:snakeyaml:1.29'
Expand All @@ -369,7 +371,7 @@ dependencies {
releaseImplementation "com.google.android.play:core:$playCoreVersion"

testImplementation "junit:junit:4.13.2"
testImplementation "androidx.test:core:1.4.0"
testImplementation "androidx.test:core:1.5.0"
testImplementation "org.robolectric:robolectric:4.5.1"

coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.2.0"
Expand Down
43 changes: 40 additions & 3 deletions TMessagesProj/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,41 @@ set_target_properties(sqlite PROPERTIES
target_compile_definitions(sqlite PUBLIC
NULL=0 SOCKLEN_T=socklen_t LOCALE_NOT_USED ANDROID_NDK DISABLE_IMPORTGL AVOID_TABLES ANDROID_TILE_BASED_DECODE HAVE_STRCHRNUL=0 ANDROID_ARMV6_IDCT)

#breakpad
add_library(breakpad STATIC
third_party/breakpad/src/client/linux/crash_generation/crash_generation_client.cc
third_party/breakpad/src/client/linux/handler/exception_handler.cc
third_party/breakpad/src/client/linux/handler/minidump_descriptor.cc
third_party/breakpad/src/client/linux/log/log.cc
third_party/breakpad/src/client/linux/dump_writer_common/thread_info.cc
third_party/breakpad/src/client/linux/dump_writer_common/seccomp_unwinder.cc
third_party/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
third_party/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
third_party/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
third_party/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
third_party/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
third_party/breakpad/src/client/minidump_file_writer.cc
third_party/breakpad/src/common/android/breakpad_getcontext.S
third_party/breakpad/src/common/convert_UTF.c
third_party/breakpad/src/common/md5.cc
third_party/breakpad/src/common/string_conversion.cc
third_party/breakpad/src/common/linux/elfutils.cc
third_party/breakpad/src/common/linux/file_id.cc
third_party/breakpad/src/common/linux/guid_creator.cc
third_party/breakpad/src/common/linux/linux_libc_support.cc
third_party/breakpad/src/common/linux/memory_mapped_file.cc
third_party/breakpad/src/common/linux/safe_readlink.cc)
set_target_properties(breakpad PROPERTIES ANDROID_ARM_MODE arm)
set_property(SOURCE third_party/breakpad/src/common/android/breakpad_getcontext.S PROPERTY LANGUAGE C)
target_include_directories(breakpad PUBLIC
third_party/breakpad/src/common/android/include
third_party/breakpad/src)


#voip
include(${CMAKE_HOME_DIRECTORY}/voip/CMakeLists.txt)

set(NATIVE_LIB "tmessages.42")
set(NATIVE_LIB "tmessages.43")

#tmessages
add_library(${NATIVE_LIB} SHARED
Expand Down Expand Up @@ -711,7 +742,12 @@ target_sources(${NATIVE_LIB} PRIVATE
third_party/libyuv/source/scale_win.cc
third_party/libyuv/source/scale.cc
third_party/libyuv/source/video_common.cc
third_party/libyuv/source/scale_uv.cc)
third_party/libyuv/source/scale_uv.cc
third_party/libyuv/source/rotate_lsx.cc
third_party/libyuv/source/row_lasx.cc
third_party/libyuv/source/row_lsx.cc
third_party/libyuv/source/scale_lsx.cc
third_party/libyuv/source/scale_rgb.cc)

target_include_directories(${NATIVE_LIB} PUBLIC
opus/include
Expand Down Expand Up @@ -761,7 +797,8 @@ target_link_libraries(${NATIVE_LIB}
EGL
android
OpenSLES
cpufeatures)
cpufeatures
breakpad)


include(AndroidNdkModules)
Expand Down
25 changes: 17 additions & 8 deletions TMessagesProj/jni/TgNetWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "tgnet/ConnectionsManager.h"
#include "tgnet/MTProtoScheme.h"
#include "tgnet/ConnectionSocket.h"
#include "tgnet/FileLog.h"

JavaVM *java;
jclass jclass_RequestDelegateInternal;
Expand Down Expand Up @@ -65,10 +66,10 @@ jobject getJavaByteBuffer(JNIEnv *env, jclass c, jlong address) {

static const char *NativeByteBufferClassPathName = "org/telegram/tgnet/NativeByteBuffer";
static JNINativeMethod NativeByteBufferMethods[] = {
{"native_getFreeBuffer", "(I)J", (void *) getFreeBuffer},
{"native_limit", "(J)I", (void *) limit},
{"native_position", "(J)I", (void *) position},
{"native_reuse", "(J)V", (void *) reuse},
{"native_getFreeBuffer", "(I)J", (void *) getFreeBuffer},
{"native_limit", "(J)I", (void *) limit},
{"native_position", "(J)I", (void *) position},
{"native_reuse", "(J)V", (void *) reuse},
{"native_getJavaByteBuffer", "(J)Ljava/nio/ByteBuffer;", (void *) getJavaByteBuffer}
};

Expand Down Expand Up @@ -99,12 +100,15 @@ void sendRequest(JNIEnv *env, jclass c, jint instanceNum, jlong object, jobject
TL_api_request *request = new TL_api_request();
request->request = (NativeByteBuffer *) (intptr_t) object;
if (onComplete != nullptr) {
DEBUG_REF("sendRequest onComplete");
onComplete = env->NewGlobalRef(onComplete);
}
if (onQuickAck != nullptr) {
DEBUG_REF("sendRequest onQuickAck");
onQuickAck = env->NewGlobalRef(onQuickAck);
}
if (onWriteToSocket != nullptr) {
DEBUG_REF("sendRequest onWriteToSocket");
onWriteToSocket = env->NewGlobalRef(onWriteToSocket);
}
ConnectionsManager::getInstance(instanceNum).sendRequest(request, ([onComplete, instanceNum](
Expand Down Expand Up @@ -262,6 +266,7 @@ checkProxy(JNIEnv *env, jclass c, jint instanceNum, jstring address, jint port,
const char *secretStr = env->GetStringUTFChars(secret, 0);

if (requestTimeFunc != nullptr) {
DEBUG_REF("sendRequest requestTimeFunc");
requestTimeFunc = env->NewGlobalRef(requestTimeFunc);
}

Expand Down Expand Up @@ -434,7 +439,7 @@ void init(JNIEnv *env, jclass c, jint instanceNum, jint version, jint layer, jin
jstring deviceModel, jstring systemVersion, jstring appVersion, jstring langCode,
jstring systemLangCode, jstring configPath, jstring logPath, jstring regId,
jstring cFingerprint, jstring installerId, jstring packageId, jint timezoneOffset, jlong userId,
jboolean enablePushConnection, jboolean hasNetwork, jint networkType) {
jboolean enablePushConnection, jboolean hasNetwork, jint networkType, jint performanceClass) {
const char *deviceModelStr = env->GetStringUTFChars(deviceModel, 0);
const char *systemVersionStr = env->GetStringUTFChars(systemVersion, 0);
const char *appVersionStr = env->GetStringUTFChars(appVersion, 0);
Expand All @@ -459,7 +464,7 @@ void init(JNIEnv *env, jclass c, jint instanceNum, jint version, jint layer, jin
std::string(cFingerprintStr),
std::string(installerIdStr), std::string(packageIdStr), timezoneOffset,
userId, true, enablePushConnection,
hasNetwork, networkType);
hasNetwork, networkType, performanceClass);

if (deviceModelStr != 0) {
env->ReleaseStringUTFChars(deviceModel, deviceModelStr);
Expand Down Expand Up @@ -524,7 +529,7 @@ static JNINativeMethod ConnectionsManagerMethods[] = {
{"native_setProxySettings", "(ILjava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", (void *) setProxySettings},
{"native_getConnectionState", "(I)I", (void *) getConnectionState},
{"native_setUserId", "(IJ)V", (void *) setUserId},
{"native_init", "(IIIILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IJZZI)V", (void *) init},
{"native_init", "(IIIILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IJZZII)V", (void *) init},
{"native_setLangCode", "(ILjava/lang/String;)V", (void *) setLangCode},
{"native_setRegId", "(ILjava/lang/String;)V", (void *) setRegId},
{"native_setSystemLangCode", "(ILjava/lang/String;)V", (void *) setSystemLangCode},
Expand Down Expand Up @@ -569,7 +574,7 @@ extern "C" int registerNativeTgNetFunctions(JavaVM *vm, JNIEnv *env) {
sizeof(ConnectionsManagerMethods[0]))) {
return JNI_FALSE;
}

DEBUG_REF("RequestDelegateInternal class");
jclass_RequestDelegateInternal = (jclass) env->NewGlobalRef(
env->FindClass("org/telegram/tgnet/RequestDelegateInternal"));
if (jclass_RequestDelegateInternal == 0) {
Expand All @@ -581,6 +586,7 @@ extern "C" int registerNativeTgNetFunctions(JavaVM *vm, JNIEnv *env) {
return JNI_FALSE;
}

DEBUG_REF("RequestTimeDelegate class");
jclass_RequestTimeDelegate = (jclass) env->NewGlobalRef(
env->FindClass("org/telegram/tgnet/RequestTimeDelegate"));
if (jclass_RequestTimeDelegate == 0) {
Expand All @@ -591,6 +597,7 @@ extern "C" int registerNativeTgNetFunctions(JavaVM *vm, JNIEnv *env) {
return JNI_FALSE;
}

DEBUG_REF("QuickAckDelegate class");
jclass_QuickAckDelegate = (jclass) env->NewGlobalRef(
env->FindClass("org/telegram/tgnet/QuickAckDelegate"));
if (jclass_RequestDelegateInternal == 0) {
Expand All @@ -601,6 +608,7 @@ extern "C" int registerNativeTgNetFunctions(JavaVM *vm, JNIEnv *env) {
return JNI_FALSE;
}

DEBUG_REF("WriteToSocketDelegate class");
jclass_WriteToSocketDelegate = (jclass) env->NewGlobalRef(
env->FindClass("org/telegram/tgnet/WriteToSocketDelegate"));
if (jclass_WriteToSocketDelegate == 0) {
Expand All @@ -610,6 +618,7 @@ extern "C" int registerNativeTgNetFunctions(JavaVM *vm, JNIEnv *env) {
if (jclass_WriteToSocketDelegate_run == 0) {
return JNI_FALSE;
}
DEBUG_REF("ConnectionsManager class");
jclass_ConnectionsManager = (jclass) env->NewGlobalRef(
env->FindClass("org/telegram/tgnet/ConnectionsManager"));
if (jclass_ConnectionsManager == 0) {
Expand Down
4 changes: 3 additions & 1 deletion TMessagesProj/jni/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,13 @@ int initRecorder(const char *path, opus_int32 sampleRate) {
rate = sampleRate;

if (!path) {
LOGE("path is null");
return 0;
}

_fileOs = fopen(path, "wb");
_fileOs = fopen(path, "w");
if (!_fileOs) {
LOGE("error cannot open file: %s", path);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion TMessagesProj/jni/ffmpeg
Submodule ffmpeg updated 1993 files
11 changes: 10 additions & 1 deletion TMessagesProj/jni/gifvideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ typedef struct VideoInfo {
} else {
attached = false;
}
DEBUG_DELREF("gifvideocpp stream");
jniEnv->DeleteGlobalRef(stream);
if (attached) {
javaVm->DetachCurrentThread();
Expand Down Expand Up @@ -790,8 +791,14 @@ int readCallback(void *opaque, uint8_t *buf, int buf_size) {
if (attached) {
javaVm->DetachCurrentThread();
}
if (buf_size == 0) {
return AVERROR_EOF;
}
int ret = (int) read(info->fd, buf, (size_t) buf_size);
return ret ? ret : AVERROR_EOF;
if (ret <= 0) {
return AVERROR_EOF;
}
return ret;
}
}
}
Expand Down Expand Up @@ -949,6 +956,7 @@ extern "C" JNIEXPORT jlong JNICALL Java_org_telegram_ui_Components_AnimatedFileD
int ret;
if (streamFileSize != 0) {
info->file_size = streamFileSize;
DEBUG_REF("gifvideo.cpp new stream");
info->stream = env->NewGlobalRef(stream);
info->account = account;
info->fd = open(info->src, O_RDONLY, S_IRUSR);
Expand Down Expand Up @@ -1375,6 +1383,7 @@ extern "C" JNIEXPORT jint JNICALL Java_org_telegram_ui_Components_AnimatedFileDr

extern "C" jint videoOnJNILoad(JavaVM *vm, JNIEnv *env) {
//av_log_set_callback(custom_log);
DEBUG_REF("gifvideo.cpp AnimatedFileDrawableStream ref");
jclass_AnimatedFileDrawableStream = (jclass) env->NewGlobalRef(env->FindClass("org/telegram/messenger/AnimatedFileDrawableStream"));
if (jclass_AnimatedFileDrawableStream == 0) {
return JNI_FALSE;
Expand Down
3 changes: 3 additions & 0 deletions TMessagesProj/jni/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ jfieldID jclass_Options_outHeight;
jfieldID jclass_Options_outWidth;

jint imageOnJNILoad(JavaVM *vm, JNIEnv *env) {
DEBUG_REF("image.cpp nullpointerexception class");
jclass_NullPointerException = (jclass) env->NewGlobalRef(env->FindClass("java/lang/NullPointerException"));
if (jclass_NullPointerException == 0) {
return JNI_FALSE;
}
DEBUG_REF("image.cpp runtimeexception class");
jclass_RuntimeException = (jclass) env->NewGlobalRef(env->FindClass("java/lang/RuntimeException"));
if (jclass_RuntimeException == 0) {
return JNI_FALSE;
}
DEBUG_REF("image.cpp bitmapfactoryoptions class");
jclass_Options = (jclass) env->NewGlobalRef(env->FindClass("android/graphics/BitmapFactory$Options"));
if (jclass_Options == 0) {
return JNI_FALSE;
Expand Down
Loading

0 comments on commit 9893918

Please sign in to comment.