Skip to content

Commit 1324233

Browse files
committed
chore: Update AGP
1 parent 7965ae4 commit 1324233

File tree

9 files changed

+143
-108
lines changed

9 files changed

+143
-108
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,6 @@ jobs:
178178
runs-on: ubuntu-latest
179179
needs:
180180
- native
181-
strategy:
182-
matrix:
183-
flavor:
184-
# - FullRelease
185-
- MiniRelease
186181
steps:
187182
- name: Checkout
188183
uses: actions/checkout@v2
@@ -227,88 +222,45 @@ jobs:
227222
- name: Release Build
228223
run: |
229224
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
230-
./gradlew TMessagesProj:assemble${{ matrix.flavor }}
225+
./gradlew TMessagesProj:assembleMiniRelease
231226
232227
APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk')
233228
APK=$(dirname $APK)
234229
echo "APK=$APK" >> $GITHUB_ENV
235230
- uses: actions/upload-artifact@v2
236231
with:
237-
name: ${{ matrix.flavor }}
232+
name: MiniRelease
238233
path: ${{ env.APK }}
239234
upload:
240235
name: Upload release
241236
if: github.event.inputs.upload != 'y'
242237
runs-on: ubuntu-latest
243238
needs:
244239
- build
245-
- telegram-bot-api
246240
steps:
247241
- name: Donwload Artifacts
248242
uses: actions/download-artifact@v2
249243
with:
250244
path: artifacts
251-
- name: Download Telegram Bot API Binary
252-
uses: actions/download-artifact@master
245+
- name: Set up Python
246+
uses: actions/setup-python@v5
253247
with:
254-
name: telegram-bot-api-binary
255-
path: .
248+
python-version: 3.12
249+
- name: Install Dependencies
250+
run: |
251+
python -m pip install -r bin/scripts/requirements.txt
256252
- name: Send to Telegram
257253
run: |
258-
chmod +x telegram-bot-api-binary
259-
function start() {
260-
./telegram-bot-api-binary --api-id=11535358 --api-hash=33d372962fadb01df47e6ceed4e33cd6 --local 2>&1 > /dev/null &
261-
}
262-
start
263-
curl http://127.0.0.1:8081/ || start
264-
curl http://127.0.0.1:8081/ || start
265-
curl http://127.0.0.1:8081/ || start
266254
# send release via telegram bot api
267255
export mini64=$(find artifacts -name "*arm64-v8a.apk")
268256
export mini32=$(find artifacts -name "*armeabi-v7a.apk")
269-
# export full64=$(find artifacts -name "*full-arm64-v8a.apk")
270-
# export full32=$(find artifacts -name "*full-armeabi-v7a.apk")
271-
# export mini64nogcm=$(find artifacts -name "*arm64-v8aNoGcm.apk")
272-
# export mini32nogcm=$(find artifacts -name "*armeabi-v7aNoGcm.apk")
273-
# export full64nogcm=$(find artifacts -name "*full-arm64-v8aNoGcm.apk")
274-
# export full32nogcm=$(find artifacts -name "*full-armeabi-v7aNoGcm.apk")
275257
276258
echo $mini64
277-
curl --http0.9 http://127.0.0.1:8081/bot${{ secrets.HELPER_BOT_TOKEN }}/sendMediaGroup --form-string chat_id=${{ secrets.HELPER_BOT_TARGET }} --form apk1=@"${mini64}" --form apk2=@"${mini32}" --form-string media="[{\"type\": \"document\",\"media\": \"attach://apk1\",\"caption\": \"\",\"parse_mode\": \"Markdown\"},{\"type\": \"document\",\"media\": \"attach://apk2\",\"caption\": \"${{ github.event.head_commit.message }}\",\"parse_mode\": \"Markdown\"}]" --verbose >/dev/null
278-
279-
pkill telegram-bot
280-
telegram-bot-api:
281-
name: Telegram Bot API
282-
runs-on: ubuntu-latest
283-
steps:
284-
- name: Checkout
285-
uses: actions/checkout@v2
286-
- name: Clone Telegram Bot API
287-
run: |
288-
git clone --recursive https://github.com/tdlib/telegram-bot-api.git
289-
git status telegram-bot-api >> telegram-bot-api-status
290-
- name: Cache Bot API Binary
291-
id: cache-bot-api
292-
uses: actions/cache@v2
293-
with:
294-
path: telegram-bot-api-binary
295-
key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }}
296-
- name: Compile Telegram Bot API
297-
if: steps.cache-bot-api.outputs.cache-hit != 'true'
298-
run: |
299-
sudo apt-get update
300-
sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++
301-
cd telegram-bot-api
302-
rm -rf build
303-
mkdir build
304-
cd build
305-
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. ..
306-
cmake --build . --target install -j$(nproc)
307-
cd ../..
308-
ls -l telegram-bot-api/bin/telegram-bot-api*
309-
cp telegram-bot-api/bin/telegram-bot-api telegram-bot-api-binary
310-
- name: Upload Binary
311-
uses: actions/upload-artifact@master
312-
with:
313-
name: telegram-bot-api-binary
314-
path: telegram-bot-api-binary
259+
echo $mini32
260+
261+
cat <<EOF >artifacts/caption.txt
262+
${{ github.event.head_commit.message }}
263+
EOF
264+
265+
python -m pip install -r bin/scripts/requirements.txt
266+
python bin/scripts/upload.py ${{ secrets.HELPER_BOT_TOKEN }} ${{ secrets.HELPER_BOT_TARGET }}

TMessagesProj/build.gradle

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ android {
8383
universalApk true
8484
} else {
8585
enable true
86+
reset()
87+
universalApk false
8688
if (!nativeTarget.isBlank()) {
87-
reset()
8889
include nativeTarget
89-
universalApk false
9090
} else {
91-
universalApk true
91+
include 'armeabi-v7a', 'arm64-v8a'
9292
}
9393
}
9494
}
@@ -220,15 +220,13 @@ android {
220220
sourceSets {
221221

222222
main {
223-
jni.srcDirs = []
224223
assets.srcDirs = ["src/main/assets", "src/emojis/twitter"]
225224
}
226225

227226
debug {
228227
java {
229228
srcDirs "src/main/java", "src/gservcies/java"
230229
}
231-
jni.srcDirs = []
232230
jniLibs {
233231
srcDir "src/main/libs"
234232
}
@@ -238,7 +236,6 @@ android {
238236
}
239237

240238
releaseNoGcm {
241-
jni.srcDirs = []
242239
jniLibs {
243240
srcDir "src/main/libs"
244241
}
@@ -248,7 +245,6 @@ android {
248245
java {
249246
srcDirs "src/main/java", "src/gservcies/java"
250247
}
251-
jni.srcDirs = []
252248
jniLibs {
253249
srcDir "src/main/libs"
254250
}
@@ -257,16 +253,8 @@ android {
257253
}
258254
}
259255

260-
foss {
261-
jni {
262-
srcDirs = ["./jni/"]
263-
}
264-
}
265256

266257
fdroidRelease {
267-
jni {
268-
srcDirs = ["./jni/"]
269-
}
270258
jniLibs.srcDirs = []
271259
}
272260

@@ -280,7 +268,7 @@ android {
280268
}
281269
}
282270

283-
tasks.all { task ->
271+
tasks.configureEach { task ->
284272
if (((task.name.endsWith("Ndk") || task.name.startsWith("generateJsonModel") || task.name.startsWith("externalNativeBuild"))) && !(task.name.contains("Debug") || task.name.contains("Foss") || task.name.contains("Fdroid"))) {
285273
task.enabled = false
286274
}
@@ -292,8 +280,8 @@ android {
292280
}
293281
}
294282

295-
applicationVariants.all { variant ->
296-
variant.outputs.all { output ->
283+
applicationVariants.configureEach { variant ->
284+
variant.outputs.configureEach { output ->
297285
String gramName = "PagerGram"
298286
String first = String.format("%s-v%s(%s)", gramName, versionName, versionCode)
299287
String name = outputFileName.replace("TMessagesProj", first)
@@ -305,18 +293,18 @@ android {
305293

306294
}
307295

308-
def fcmVersion = "23.0.7"
309-
def crashlyticsVersion = "18.2.12"
296+
def fcmVersion = "23.4.1"
297+
def crashlyticsVersion = "18.6.2"
310298
def playCoreVersion = "1.10.3"
311299

312300
dependencies {
313301

314302
implementation "androidx.browser:browser:1.5.0"
315303
implementation 'androidx.fragment:fragment:1.2.0'
316-
implementation "androidx.core:core-ktx:1.9.0"
304+
implementation "androidx.core:core-ktx:1.10.0"
317305
implementation "androidx.palette:palette-ktx:1.0.0"
318306
implementation "androidx.viewpager:viewpager:1.0.0"
319-
implementation "androidx.exifinterface:exifinterface:1.3.6"
307+
implementation "androidx.exifinterface:exifinterface:1.3.7"
320308
implementation "androidx.interpolator:interpolator:1.0.0"
321309
implementation "androidx.dynamicanimation:dynamicanimation:1.0.0"
322310
implementation "androidx.multidex:multidex:2.0.1"
@@ -330,10 +318,10 @@ dependencies {
330318
//noinspection GradleDependency
331319
implementation "com.googlecode.mp4parser:isoparser:1.0.6"
332320

333-
implementation "com.google.code.gson:gson:2.8.9"
321+
implementation "com.google.code.gson:gson:2.10"
334322
implementation "org.osmdroid:osmdroid-android:6.1.10"
335-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10"
336-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1"
323+
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.23'
324+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0'
337325

338326
implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.10"
339327
implementation 'com.neovisionaries:nv-websocket-client:2.14'
@@ -348,9 +336,6 @@ dependencies {
348336

349337
implementation 'com.google.android.gms:play-services-mlkit-subject-segmentation:16.0.0-beta1'
350338

351-
compileOnly 'org.yaml:snakeyaml:1.29'
352-
implementation 'org.yaml:snakeyaml:1.29'
353-
354339
implementation project(":openpgp-api")
355340

356341
compileOnly fileTree("libs")
@@ -360,10 +345,8 @@ dependencies {
360345
compileOnly "com.google.android.play:core:$playCoreVersion"
361346

362347
implementation 'com.google.android.gms:play-services-vision:20.1.3'
363-
debugImplementation 'com.google.android.gms:play-services-maps:18.1.0'
364-
debugImplementation 'com.google.android.gms:play-services-location:20.0.0'
365-
releaseImplementation 'com.google.android.gms:play-services-maps:18.1.0'
366-
releaseImplementation 'com.google.android.gms:play-services-location:20.0.0'
348+
implementation 'com.google.android.gms:play-services-maps:18.2.0'
349+
implementation 'com.google.android.gms:play-services-location:21.2.0'
367350

368351
debugImplementation "com.google.firebase:firebase-messaging:$fcmVersion"
369352
debugImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion"
@@ -383,11 +366,11 @@ dependencies {
383366
// add for undo and redo
384367
implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3'
385368
// add splash screen
386-
implementation("androidx.core:core-splashscreen:1.0.0-beta02")
369+
implementation("androidx.core:core-splashscreen:1.0.1")
387370
// add for music tag flac...
388371
implementation 'org:jaudiotagger:2.0.3'
389372
// add for auto translate
390-
implementation 'com.google.mlkit:language-id:17.0.4'
373+
implementation 'com.google.mlkit:language-id:17.0.5'
391374
// add for emoji
392375
implementation 'com.jaredrummler:truetypeparser-light:1.0.0'
393376
}
@@ -416,8 +399,11 @@ android {
416399
lint {
417400
disable 'MissingTranslation', 'ExtraTranslation', 'BlockedPrivateApi'
418401
}
402+
buildFeatures {
403+
buildConfig true
404+
}
419405

420-
tasks.all { task ->
406+
tasks.configureEach { task ->
421407
if (task.name.startsWith("uploadCrashlyticsMappingFile")) {
422408
task.enabled = false
423409
} else if (task.name.contains("Crashlytics") && task.name.contains("NoGcm")) {
@@ -426,5 +412,4 @@ android {
426412
task.enabled = false
427413
}
428414
}
429-
430415
}

TMessagesProj/proguard-rules.pro

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,11 @@
152152
-dontwarn org.osmdroid.**
153153

154154
-keepattributes SourceFile,LineNumberTable
155+
156+
-dontwarn java.beans.**
157+
-dontwarn java.lang.management.**
158+
-dontwarn javax.swing.**
159+
-dontwarn lombok.**
160+
-dontwarn org.slf4j.**
161+
-dontwarn org.w3c.dom.bootstrap.**
162+
-dontwarn sun.net.spi.nameservice.**

bin/scripts/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
git+https://github.com/KurimuzonAkuma/pyrogram
2+
PyroTgCrypto==1.2.6a0

bin/scripts/upload.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import contextlib
2+
from pathlib import Path
3+
from sys import argv
4+
5+
from pyrogram import Client
6+
from pyrogram.types import InputMediaDocument
7+
8+
api_id = 11535358
9+
api_hash = "33d372962fadb01df47e6ceed4e33cd6"
10+
artifacts_path = Path("artifacts")
11+
12+
13+
def find_apk(abi: str) -> Path:
14+
apks = list(artifacts_path.glob("*.apk"))
15+
for apk in apks:
16+
if abi in apk.name:
17+
return apk
18+
19+
20+
def get_thumb() -> str:
21+
return "TMessagesProj/src/main/" + "ic_launcher_nagram_round_blue-playstore.png"
22+
23+
24+
def get_caption() -> str:
25+
with open(artifacts_path / "caption.txt") as f:
26+
return f.read()
27+
28+
29+
def get_document() -> list[InputMediaDocument]:
30+
return [
31+
InputMediaDocument(
32+
media=str(find_apk("arm64-v8a")),
33+
thumb=get_thumb(),
34+
),
35+
InputMediaDocument(
36+
media=str(find_apk("armeabi-v7a")),
37+
thumb=get_thumb(),
38+
caption=get_caption(),
39+
),
40+
]
41+
42+
43+
def retry(func):
44+
async def wrapper(*args, **kwargs):
45+
for _ in range(3):
46+
try:
47+
return await func(*args, **kwargs)
48+
except Exception as e:
49+
print(e)
50+
51+
return wrapper
52+
53+
54+
@retry
55+
async def send_to_channel(client: "Client", cid: str):
56+
with contextlib.suppress(ValueError):
57+
cid = int(cid)
58+
await client.send_media_group(
59+
cid,
60+
media=get_document(),
61+
)
62+
63+
64+
def get_client(bot_token: str):
65+
return Client(
66+
"helper_bot",
67+
api_id=api_id,
68+
api_hash=api_hash,
69+
bot_token=bot_token,
70+
)
71+
72+
73+
async def main():
74+
bot_token = argv[1]
75+
chat_id = argv[2]
76+
async with get_client(bot_token) as client:
77+
await send_to_channel(client, chat_id)
78+
79+
80+
if __name__ == "__main__":
81+
from asyncio import run
82+
83+
run(main())

0 commit comments

Comments
 (0)