Skip to content

Commit 1f3ecc7

Browse files
committed
feat: prepare for the rust lib
Work in progress Signed-off-by: qwq233 <qwq233@qwq2333.top>
1 parent f95d341 commit 1f3ecc7

File tree

13 files changed

+19
-6
lines changed

13 files changed

+19
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
build/
44
obj/
55
TMessagesProj/.cxx
6+
TMessagesProj/.cargo
67
*.iml
78
local.properties
89
service_account_credentials.json

.gitmodules

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
[submodule "libs/linux-syscall-support"]
22
path = libs/linux-syscall-support
33
url = https://chromium.googlesource.com/linux-syscall-support
4+
[submodule "libs/rust"]
5+
path = libs/rust

TMessagesProj/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ plugins {
1515
alias(libs.plugins.triplet.play)
1616
alias(libs.plugins.serialization)
1717
alias(libs.plugins.ksp)
18+
alias(libs.plugins.rust)
1819
}
1920

2021
configurations {
@@ -42,6 +43,15 @@ fun setupPlay(stable: Boolean) {
4243
}
4344
}
4445

46+
cargo {
47+
module = "../libs/rust"
48+
libname = "rust"
49+
targets = listOf("arm64", "x86_64", "arm", "x86")
50+
51+
prebuiltToolchains = true
52+
profile = "release"
53+
}
54+
4555
dependencies {
4656
implementation(platform(libs.firebase.bom))
4757
implementation(libs.firebase.crashlytics.ndk)

TMessagesProj/jni/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ ${CMAKE_HOME_DIRECTORY}/ffmpeg/${ANDROID_ABI}/libavresample.a,
2222
${CMAKE_HOME_DIRECTORY}/ffmpeg/${ANDROID_ABI}/libavutil.a,
2323
${CMAKE_HOME_DIRECTORY}/ffmpeg/${ANDROID_ABI}/libswresample.a,
2424
${CMAKE_HOME_DIRECTORY}/ffmpeg/${ANDROID_ABI}/libvpx.a,
25+
#${CMAKE_HOME_DIRECTORY}/integrity/${ANDROID_ABI}/librust.a,
2526
${CMAKE_HOME_DIRECTORY}/boringssl/lib/libssl_${ANDROID_ABI}.a,
2627
${CMAKE_HOME_DIRECTORY}/boringssl/lib/libcrypto_${ANDROID_ABI}.a")
2728

6.48 MB
Binary file not shown.
Binary file not shown.

TMessagesProj/jni/integrity/v2sign.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010

1111
#endif //NULLGRAM_V2SIGN_H
1212
bool checkSignature(JNIEnv *env);
13+
//bool get_apk_path(JNIEnv *env);
2.59 MB
Binary file not shown.
5.94 MB
Binary file not shown.

TMessagesProj/src/main/java/top/qwq2333/nullgram/utils/StringUtils.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,6 @@ object StringUtils {
130130
skip += 1
131131
}
132132

133-
// ensure offset and length is valid
134-
entities.forEach {
135-
it.offset = it.offset.coerceAtLeast(0).coerceAtMost(panguText.length)
136-
it.length = it.length.coerceAtLeast(0).coerceAtMost(panguText.length - it.offset)
137-
}
138-
139133
return Pair(panguText, entities)
140134
}
141135
}

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ plugins {
99
alias(libs.plugins.kotlin.jvm) apply false
1010
alias(libs.plugins.serialization) apply false
1111
alias(libs.plugins.ksp) apply false
12+
alias(libs.plugins.rust) apply false
1213
}
1314

1415
tasks.register<Delete>("clean").configure {

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ playServicesVision = "20.1.3"
3535
processPhoenix = "2.1.2"
3636
sharetarget = "1.2.0"
3737
paletteKtx = "1.0.0"
38+
rust = "0.9.3"
3839

3940
[libraries]
4041
appcenter-analytics = { module = "com.microsoft.appcenter:appcenter-analytics", version.ref = "appCenter" }
@@ -90,3 +91,4 @@ firebase-crashlytics = { id = "com.google.firebase.crashlytics", version = "2.9.
9091
google-services = { id = "com.google.gms.google-services", version = "4.4.0" }
9192
triplet-play = { id = "com.github.triplet.play", version = "3.8.6" }
9293
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
94+
rust = { id = "org.mozilla.rust-android-gradle.rust-android", version.ref = "rust" }

libs/rust

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit d3947b650678d920f199522db6531e8dee66fb9e

0 commit comments

Comments
 (0)