diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8d67632041..ffa90fdaec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,9 +55,9 @@ jobs: - name: Install NDK if: steps.cache.outputs.cache-hit != 'true' run: | - echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null + echo "y" | sdkmanager --install "ndk;23.2.8568313" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null echo "sdk.dir=${ANDROID_HOME}" > local.properties - echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties + echo "ndk.dir=${ANDROID_HOME}/ndk/23.2.8568313" >> local.properties - name: Native Build if: steps.cache.outputs.cache-hit != 'true' run: | @@ -94,9 +94,9 @@ jobs: - name: Install NDK if: steps.cache.outputs.cache-hit != 'true' run: | - echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null + echo "y" | sdkmanager --install "ndk;23.2.8568313" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null echo "sdk.dir=${ANDROID_HOME}" > local.properties - echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties + echo "ndk.dir=${ANDROID_HOME}/ndk/23.2.8568313" >> local.properties - name: Native Build if: steps.cache.outputs.cache-hit != 'true' run: | @@ -160,9 +160,9 @@ jobs: - name: Install NDK if: steps.cache.outputs.cache-hit != 'true' run: | - echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null + echo "y" | sdkmanager --install "ndk;23.2.8568313" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null echo "sdk.dir=${ANDROID_HOME}" > local.properties - echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties + echo "ndk.dir=${ANDROID_HOME}/ndk/23.2.8568313" >> local.properties - name: Fix BoringSSL if: steps.cache.outputs.cache-hit != 'true' run: | @@ -178,11 +178,6 @@ jobs: runs-on: ubuntu-latest needs: - native - strategy: - matrix: - flavor: - # - FullRelease - - MiniRelease steps: - name: Checkout uses: actions/checkout@v2 @@ -195,9 +190,9 @@ jobs: uses: android-actions/setup-android@v3 - name: Install NDK run: | - echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null + echo "y" | sdkmanager --install "ndk;23.2.8568313" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null echo "sdk.dir=${ANDROID_HOME}" > local.properties - echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties + echo "ndk.dir=${ANDROID_HOME}/ndk/23.2.8568313" >> local.properties - name: Fetch Status run: | sed -i 's/\/\///g' settings.gradle @@ -227,14 +222,14 @@ jobs: - name: Release Build run: | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" - ./gradlew TMessagesProj:assemble${{ matrix.flavor }} + ./gradlew TMessagesProj:assembleRelease 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: Release path: ${{ env.APK }} upload: name: Upload release @@ -242,73 +237,26 @@ 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 + git log -1 --pretty=format:"%s" > artifacts/caption.txt + python bin/scripts/upload.py ${{ secrets.HELPER_BOT_TOKEN }} ${{ secrets.HELPER_BOT_TARGET }} release diff --git a/.gitignore b/.gitignore index 4afc3cd0ef..4015be1241 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ build/ local.properties obj/ -service_account_credentials.json \ No newline at end of file +service_account_credentials.json +__pycache__/ diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 66e5b4a7ab..07def79545 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -1,5 +1,3 @@ -import cn.hutool.core.util.RuntimeUtil - apply plugin: "com.android.application" apply plugin: "kotlin-android" @@ -69,7 +67,7 @@ def nativeTarget = System.getenv("NATIVE_TARGET") if (nativeTarget == null) nativeTarget = "" android { - compileSdkVersion 33 + compileSdk 33 buildToolsVersion "33.0.0" ndkVersion rootProject.ext.ndkVersion @@ -83,12 +81,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' } } } @@ -174,20 +172,6 @@ android { signingConfig signingConfigs.release } - releaseNoGcm { - debuggable false - jniDebuggable false - minifyEnabled true - shrinkResources true - multiDexEnabled true - zipAlignEnabled true - proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" - matchingFallbacks = ["release", "debug"] - signingConfig signingConfigs.release - - buildConfigField "int", "IS_NO_GCM", "1" - } - release { debuggable false jniDebuggable false @@ -199,46 +183,18 @@ android { matchingFallbacks = ["release", "debug"] signingConfig signingConfigs.release } - - foss { - debuggable false - jniDebuggable false - minifyEnabled true - shrinkResources true - multiDexEnabled true - zipAlignEnabled true - proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" - matchingFallbacks = ["release", "debug"] - } - - fdroidRelease { - initWith foss - matchingFallbacks = ["release", "debug"] - } } sourceSets { main { - jni.srcDirs = [] assets.srcDirs = ["src/main/assets", "src/emojis/twitter"] } debug { java { - srcDirs "src/main/java", "src/gservcies/java" - } - jni.srcDirs = [] - jniLibs { - srcDir "src/main/libs" - } - manifest { - srcFile "src/gservcies/AndroidManifest.xml" + srcDirs "src/main/java" } - } - - releaseNoGcm { - jni.srcDirs = [] jniLibs { srcDir "src/main/libs" } @@ -246,41 +202,17 @@ android { release { java { - srcDirs "src/main/java", "src/gservcies/java" + srcDirs "src/main/java" } - jni.srcDirs = [] jniLibs { srcDir "src/main/libs" } - manifest { - srcFile "src/gservcies/AndroidManifest.xml" - } - } - - foss { - jni { - srcDirs = ["./jni/"] - } } - - fdroidRelease { - jni { - srcDirs = ["./jni/"] - } - jniLibs.srcDirs = [] - } - } flavorDimensions "version" - productFlavors { - mini { - isDefault true - } - } - - 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,31 +224,30 @@ 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) name = name.replace("-release", "") - name = name.replace("-mini", "") outputFileName = name } } } -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.fragment:fragment:1.6.2' + implementation 'androidx.core:core:1.12.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 +261,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 +279,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 +288,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 +309,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 +342,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 +355,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/TMessagesProj/src/gservcies/AndroidManifest.xml b/TMessagesProj/src/gservcies/AndroidManifest.xml deleted file mode 100644 index e0ea9d2fe5..0000000000 --- a/TMessagesProj/src/gservcies/AndroidManifest.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/AndroidManifest.xml b/TMessagesProj/src/main/AndroidManifest.xml index 8d73d9090d..6419915857 100644 --- a/TMessagesProj/src/main/AndroidManifest.xml +++ b/TMessagesProj/src/main/AndroidManifest.xml @@ -710,6 +710,24 @@ + + + + + + + + + + + + + diff --git a/TMessagesProj/src/gservcies/java/nekox/messenger/NekoLocationSource.java b/TMessagesProj/src/main/java/nekox/messenger/NekoLocationSource.java similarity index 97% rename from TMessagesProj/src/gservcies/java/nekox/messenger/NekoLocationSource.java rename to TMessagesProj/src/main/java/nekox/messenger/NekoLocationSource.java index 64305f2a71..cd80ec24b8 100644 --- a/TMessagesProj/src/gservcies/java/nekox/messenger/NekoLocationSource.java +++ b/TMessagesProj/src/main/java/nekox/messenger/NekoLocationSource.java @@ -96,7 +96,7 @@ static class Cache extends LinkedHashMap { private static final long serialVersionUID = 1L; @Override - protected boolean removeEldestEntry(final java.util.Map.Entry eldest) { + protected boolean removeEldestEntry(final Entry eldest) { return (size() > KMaxEntries); } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java index 1d8012950a..aa9afe3cd3 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java @@ -37,9 +37,8 @@ public class BuildVars { public static String TGX_APP_HASH = "3e0cb5efcd52300aec5994fdfc5bdc16"; public static boolean isUnknown = !BuildConfig.BUILD_TYPE.startsWith("release"); - public static boolean isPlay = BuildConfig.FLAVOR.endsWith("Play"); + public static boolean isPlay = false; public static boolean isFdroid = BuildConfig.BUILD_TYPE.toLowerCase().contains("fdroid"); - public static boolean isMini = !BuildConfig.FLAVOR.startsWith("full"); public static boolean isGServicesCompiled = BuildConfig.BUILD_TYPE.equals("debug") || BuildConfig.BUILD_TYPE.equals("release"); public static boolean isNoGCM = BuildConfig.IS_NO_GCM == 1; diff --git a/TMessagesProj/src/gservcies/java/org/telegram/messenger/GcmPushListenerService.java b/TMessagesProj/src/main/java/org/telegram/messenger/GcmPushListenerService.java similarity index 100% rename from TMessagesProj/src/gservcies/java/org/telegram/messenger/GcmPushListenerService.java rename to TMessagesProj/src/main/java/org/telegram/messenger/GcmPushListenerService.java diff --git a/TMessagesProj/src/gservcies/java/org/telegram/messenger/GoogleLocationProvider.java b/TMessagesProj/src/main/java/org/telegram/messenger/GoogleLocationProvider.java similarity index 100% rename from TMessagesProj/src/gservcies/java/org/telegram/messenger/GoogleLocationProvider.java rename to TMessagesProj/src/main/java/org/telegram/messenger/GoogleLocationProvider.java diff --git a/TMessagesProj/src/gservcies/java/org/telegram/messenger/GoogleMapsProvider.java b/TMessagesProj/src/main/java/org/telegram/messenger/GoogleMapsProvider.java similarity index 100% rename from TMessagesProj/src/gservcies/java/org/telegram/messenger/GoogleMapsProvider.java rename to TMessagesProj/src/main/java/org/telegram/messenger/GoogleMapsProvider.java diff --git a/TMessagesProj/src/gservcies/java/org/telegram/messenger/GooglePushListenerServiceProvider.java b/TMessagesProj/src/main/java/org/telegram/messenger/GooglePushListenerServiceProvider.java similarity index 100% rename from TMessagesProj/src/gservcies/java/org/telegram/messenger/GooglePushListenerServiceProvider.java rename to TMessagesProj/src/main/java/org/telegram/messenger/GooglePushListenerServiceProvider.java diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/InternalUpdater.java b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/InternalUpdater.java index 191fdf6f5a..c7cb2dd720 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/InternalUpdater.java +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/InternalUpdater.java @@ -140,7 +140,7 @@ public static void checkUpdate(checkUpdateCallback callback) { try { TLRPC.messages_Messages res = (TLRPC.messages_Messages) response; FileLog.d("Retrieve update messages, size:" + res.messages.size()); - final String target = metadata.versionName + "(" + metadata.versionCode + ")" + "-" + BuildConfig.FLAVOR + "-" + Build.SUPPORTED_ABIS[0].toLowerCase(Locale.ROOT) + ".apk"; + final String target = metadata.versionName + "(" + metadata.versionCode + ")" + "-" + Build.SUPPORTED_ABIS[0].toLowerCase(Locale.ROOT) + ".apk"; for (int i = 0; i < res.messages.size(); i++) { if (res.messages.get(i).media == null) continue; diff --git a/bin/init/env.sh b/bin/init/env.sh index 76c9f91cba..7cd0f5389a 100755 --- a/bin/init/env.sh +++ b/bin/init/env.sh @@ -9,7 +9,7 @@ if [ -z "$ANDROID_HOME" ]; then fi -_NDK="$ANDROID_HOME/ndk/21.4.7075529" +_NDK="$ANDROID_HOME/ndk/23.2.8568313" [ -f "$_NDK/source.properties" ] || _NDK="$ANDROID_NDK_HOME" [ -f "$_NDK/source.properties" ] || _NDK="$NDK" [ -f "$_NDK/source.properties" ] || _NDK="$ANDROID_HOME/ndk-bundle" 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..fabafff84f --- /dev/null +++ b/bin/scripts/upload.py @@ -0,0 +1,90 @@ +import contextlib +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" if len(argv) > 2 else None + + +def find_apk(abi: str) -> Path: + dirs = list(artifacts_path.glob("*")) + for dir in dirs: + if dir.is_dir(): + apks = list(dir.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 "" + with open(artifacts_path / "caption.txt", "r", encoding="utf-8") as f: + return pre + f.read() + + +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..70fce28925 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" @@ -19,7 +19,7 @@ buildscript { static String detectNdkVersion() { - def version = "21.4.7075529" + def version = "23.2.8568313" def androidHome = System.getenv("ANDROID_HOME") 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