diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8d67632041..9e1a60410a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -178,11 +178,6 @@ jobs: runs-on: ubuntu-latest needs: - native - strategy: - matrix: - flavor: - # - FullRelease - - MiniRelease steps: - name: Checkout uses: actions/checkout@v2 @@ -227,14 +222,14 @@ jobs: - name: Release Build run: | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" - ./gradlew TMessagesProj:assemble${{ matrix.flavor }} + ./gradlew TMessagesProj:assembleMiniRelease APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') APK=$(dirname $APK) echo "APK=$APK" >> $GITHUB_ENV - uses: actions/upload-artifact@v2 with: - name: ${{ matrix.flavor }} + name: MiniRelease path: ${{ env.APK }} upload: name: Upload release @@ -242,73 +237,25 @@ jobs: runs-on: ubuntu-latest needs: - build - - telegram-bot-api steps: + - name: Checkout + uses: actions/checkout@v4 - name: Donwload Artifacts uses: actions/download-artifact@v2 with: path: artifacts - - name: Download Telegram Bot API Binary - uses: actions/download-artifact@master + - name: Set up Python + uses: actions/setup-python@v5 with: - name: telegram-bot-api-binary - path: . + python-version: 3.12 - name: Send to Telegram run: | - chmod +x telegram-bot-api-binary - function start() { - ./telegram-bot-api-binary --api-id=11535358 --api-hash=33d372962fadb01df47e6ceed4e33cd6 --local 2>&1 > /dev/null & - } - start - curl http://127.0.0.1:8081/ || start - curl http://127.0.0.1:8081/ || start - curl http://127.0.0.1:8081/ || start # send release via telegram bot api export mini64=$(find artifacts -name "*arm64-v8a.apk") export mini32=$(find artifacts -name "*armeabi-v7a.apk") - # export full64=$(find artifacts -name "*full-arm64-v8a.apk") - # export full32=$(find artifacts -name "*full-armeabi-v7a.apk") - # export mini64nogcm=$(find artifacts -name "*arm64-v8aNoGcm.apk") - # export mini32nogcm=$(find artifacts -name "*armeabi-v7aNoGcm.apk") - # export full64nogcm=$(find artifacts -name "*full-arm64-v8aNoGcm.apk") - # export full32nogcm=$(find artifacts -name "*full-armeabi-v7aNoGcm.apk") echo $mini64 - 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 + echo $mini32 - pkill telegram-bot - telegram-bot-api: - name: Telegram Bot API - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Clone Telegram Bot API - run: | - git clone --recursive https://github.com/tdlib/telegram-bot-api.git - git status telegram-bot-api >> telegram-bot-api-status - - name: Cache Bot API Binary - id: cache-bot-api - uses: actions/cache@v2 - with: - path: telegram-bot-api-binary - key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }} - - name: Compile Telegram Bot API - if: steps.cache-bot-api.outputs.cache-hit != 'true' - run: | - sudo apt-get update - sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++ - cd telegram-bot-api - rm -rf build - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. - cmake --build . --target install -j$(nproc) - cd ../.. - ls -l telegram-bot-api/bin/telegram-bot-api* - cp telegram-bot-api/bin/telegram-bot-api telegram-bot-api-binary - - name: Upload Binary - uses: actions/upload-artifact@master - with: - name: telegram-bot-api-binary - path: telegram-bot-api-binary + python -m pip install -r bin/scripts/requirements.txt + python bin/scripts/upload.py ${{ secrets.HELPER_BOT_TOKEN }} ${{ secrets.HELPER_BOT_TARGET }} release diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 66e5b4a7ab..45e9bf63e8 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -83,12 +83,12 @@ android { universalApk true } else { enable true + reset() + universalApk false if (!nativeTarget.isBlank()) { - reset() include nativeTarget - universalApk false } else { - universalApk true + include 'armeabi-v7a', 'arm64-v8a' } } } @@ -220,7 +220,6 @@ android { sourceSets { main { - jni.srcDirs = [] assets.srcDirs = ["src/main/assets", "src/emojis/twitter"] } @@ -228,7 +227,6 @@ android { java { srcDirs "src/main/java", "src/gservcies/java" } - jni.srcDirs = [] jniLibs { srcDir "src/main/libs" } @@ -238,7 +236,6 @@ android { } releaseNoGcm { - jni.srcDirs = [] jniLibs { srcDir "src/main/libs" } @@ -248,7 +245,6 @@ android { java { srcDirs "src/main/java", "src/gservcies/java" } - jni.srcDirs = [] jniLibs { srcDir "src/main/libs" } @@ -257,16 +253,8 @@ android { } } - foss { - jni { - srcDirs = ["./jni/"] - } - } fdroidRelease { - jni { - srcDirs = ["./jni/"] - } jniLibs.srcDirs = [] } @@ -280,7 +268,7 @@ android { } } - tasks.all { task -> + tasks.configureEach { task -> 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"))) { task.enabled = false } @@ -292,8 +280,8 @@ android { } } - applicationVariants.all { variant -> - variant.outputs.all { output -> + applicationVariants.configureEach { variant -> + variant.outputs.configureEach { output -> String gramName = "PagerGram" String first = String.format("%s-v%s(%s)", gramName, versionName, versionCode) String name = outputFileName.replace("TMessagesProj", first) @@ -305,18 +293,18 @@ android { } -def fcmVersion = "23.0.7" -def crashlyticsVersion = "18.2.12" +def fcmVersion = "23.4.1" +def crashlyticsVersion = "18.6.2" def playCoreVersion = "1.10.3" dependencies { implementation "androidx.browser:browser:1.5.0" implementation 'androidx.fragment:fragment:1.2.0' - implementation "androidx.core:core-ktx:1.9.0" + implementation "androidx.core:core-ktx:1.10.0" implementation "androidx.palette:palette-ktx:1.0.0" implementation "androidx.viewpager:viewpager:1.0.0" - implementation "androidx.exifinterface:exifinterface:1.3.6" + implementation "androidx.exifinterface:exifinterface:1.3.7" implementation "androidx.interpolator:interpolator:1.0.0" implementation "androidx.dynamicanimation:dynamicanimation:1.0.0" implementation "androidx.multidex:multidex:2.0.1" @@ -330,10 +318,10 @@ dependencies { //noinspection GradleDependency implementation "com.googlecode.mp4parser:isoparser:1.0.6" - implementation "com.google.code.gson:gson:2.8.9" + implementation "com.google.code.gson:gson:2.10" implementation "org.osmdroid:osmdroid-android:6.1.10" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1" + implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.23' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0' implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.10" implementation 'com.neovisionaries:nv-websocket-client:2.14' @@ -348,9 +336,6 @@ dependencies { implementation 'com.google.android.gms:play-services-mlkit-subject-segmentation:16.0.0-beta1' - compileOnly 'org.yaml:snakeyaml:1.29' - implementation 'org.yaml:snakeyaml:1.29' - implementation project(":openpgp-api") compileOnly fileTree("libs") @@ -360,10 +345,8 @@ dependencies { compileOnly "com.google.android.play:core:$playCoreVersion" implementation 'com.google.android.gms:play-services-vision:20.1.3' - debugImplementation 'com.google.android.gms:play-services-maps:18.1.0' - debugImplementation 'com.google.android.gms:play-services-location:20.0.0' - releaseImplementation 'com.google.android.gms:play-services-maps:18.1.0' - releaseImplementation 'com.google.android.gms:play-services-location:20.0.0' + implementation 'com.google.android.gms:play-services-maps:18.2.0' + implementation 'com.google.android.gms:play-services-location:21.2.0' debugImplementation "com.google.firebase:firebase-messaging:$fcmVersion" debugImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" @@ -383,11 +366,11 @@ dependencies { // add for undo and redo implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3' // add splash screen - implementation("androidx.core:core-splashscreen:1.0.0-beta02") + implementation("androidx.core:core-splashscreen:1.0.1") // add for music tag flac... implementation 'org:jaudiotagger:2.0.3' // add for auto translate - implementation 'com.google.mlkit:language-id:17.0.4' + implementation 'com.google.mlkit:language-id:17.0.5' // add for emoji implementation 'com.jaredrummler:truetypeparser-light:1.0.0' } @@ -416,8 +399,11 @@ android { lint { disable 'MissingTranslation', 'ExtraTranslation', 'BlockedPrivateApi' } + buildFeatures { + buildConfig true + } - tasks.all { task -> + tasks.configureEach { task -> if (task.name.startsWith("uploadCrashlyticsMappingFile")) { task.enabled = false } else if (task.name.contains("Crashlytics") && task.name.contains("NoGcm")) { @@ -426,5 +412,4 @@ android { task.enabled = false } } - } diff --git a/TMessagesProj/proguard-rules.pro b/TMessagesProj/proguard-rules.pro index ac99c70df1..794697f3d1 100644 --- a/TMessagesProj/proguard-rules.pro +++ b/TMessagesProj/proguard-rules.pro @@ -152,3 +152,11 @@ -dontwarn org.osmdroid.** -keepattributes SourceFile,LineNumberTable + +-dontwarn java.beans.** +-dontwarn java.lang.management.** +-dontwarn javax.swing.** +-dontwarn lombok.** +-dontwarn org.slf4j.** +-dontwarn org.w3c.dom.bootstrap.** +-dontwarn sun.net.spi.nameservice.** diff --git a/bin/scripts/requirements.txt b/bin/scripts/requirements.txt new file mode 100644 index 0000000000..24a0ea49e4 --- /dev/null +++ b/bin/scripts/requirements.txt @@ -0,0 +1,2 @@ +git+https://github.com/KurimuzonAkuma/pyrogram +PyroTgCrypto==1.2.6a0 diff --git a/bin/scripts/upload.py b/bin/scripts/upload.py new file mode 100644 index 0000000000..29ef0982e2 --- /dev/null +++ b/bin/scripts/upload.py @@ -0,0 +1,87 @@ +import contextlib +import subprocess +from pathlib import Path +from sys import argv + +from pyrogram import Client +from pyrogram.types import InputMediaDocument + +api_id = 11535358 +api_hash = "33d372962fadb01df47e6ceed4e33cd6" +artifacts_path = Path("artifacts") +test_version = argv[3] == "test" + + +def find_apk(abi: str) -> Path: + apks = list(artifacts_path.glob("*.apk")) + for apk in apks: + if abi in apk.name: + return apk + + +def get_thumb() -> str: + return "TMessagesProj/src/main/" + "ic_launcher_nagram_round_blue-playstore.png" + + +def get_caption() -> str: + pre = "Test version, " if test_version else "" + return pre + subprocess.check_output('git log -1 --pretty=format:"%s"').decode('utf-8') + + +def get_document() -> list[InputMediaDocument]: + return [ + InputMediaDocument( + media=str(find_apk("arm64-v8a")), + thumb=get_thumb(), + ), + InputMediaDocument( + media=str(find_apk("armeabi-v7a")), + thumb=get_thumb(), + caption=get_caption(), + ), + ] + + +def retry(func): + async def wrapper(*args, **kwargs): + for _ in range(3): + try: + return await func(*args, **kwargs) + except Exception as e: + print(e) + + return wrapper + + +@retry +async def send_to_channel(client: "Client", cid: str): + with contextlib.suppress(ValueError): + cid = int(cid) + await client.send_media_group( + cid, + media=get_document(), + ) + + +def get_client(bot_token: str): + return Client( + "helper_bot", + api_id=api_id, + api_hash=api_hash, + bot_token=bot_token, + ) + + +async def main(): + bot_token = argv[1] + chat_id = argv[2] + client = get_client(bot_token) + await client.start() + await send_to_channel(client, chat_id) + await client.log_out() + + +if __name__ == "__main__": + from asyncio import run + + run(main()) diff --git a/build.gradle b/build.gradle index fcf4f05e42..980ce080c8 100644 --- a/build.gradle +++ b/build.gradle @@ -6,10 +6,10 @@ buildscript { maven { url "https://plugins.gradle.org/m2/" } } dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21' - classpath 'com.google.gms:google-services:4.3.14' - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2' + classpath 'com.android.tools.build:gradle:8.2.1' + classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23' + classpath 'com.google.gms:google-services:4.4.1' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9' classpath 'gradle.plugin.org.mozilla.rust-android-gradle:plugin:0.9.0' //noinspection GradleDependency classpath "com.github.triplet.gradle:play-publisher:3.6.0" diff --git a/gradle.properties b/gradle.properties index f3157e54bf..37277bc7f5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,3 +21,5 @@ org.gradle.parallel=true org.gradle.configureondemand=false android.useAndroidX=true android.enableJetifier=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 47825044a4..c583a70247 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed Aug 17 16:55:16 CST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/openpgp-api/build.gradle b/openpgp-api/build.gradle index f389935ee3..54d4444f60 100644 --- a/openpgp-api/build.gradle +++ b/openpgp-api/build.gradle @@ -1,17 +1,20 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 31 + compileSdk 33 defaultConfig { // API-Version . minor minSdkVersion 19 - targetSdkVersion 31 + targetSdkVersion 33 } - buildToolsVersion '31.0.0' + buildToolsVersion '33.0.1' lint { abortOnError false } namespace 'org.openintents.openpgp' + buildFeatures { + aidl true + } } \ No newline at end of file