| 7 |
| content { |
| 8 | includeModule 'com.github.UnifiedPush', 'android-connector' |
| 9 | } |
| 10 | } |
| 11 | } |
| 12 |
| 13 | def verName = "10.10.1" |
| 14 | def verCode = 1167 |
| 15 |
| 16 |
| 17 | def officialVer = "10.10.1" |
| 18 | def officialCode = 4583 |
| 19 |
| 20 | def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json") |
| 21 |
| 22 | def beta = verName.contains("preview") |
| 23 |
| 24 | if (serviceAccountCredentialsFile.isFile()) { |
| 25 | setupPlay(beta) |
| 26 | play.serviceAccountCredentials = serviceAccountCredentialsFile |
| 27 | } else if (System.getenv().containsKey("ANDROID_PUBLISHER_CREDENTIALS")) { |
| 28 | setupPlay(beta) |
| 29 | } |
| 30 |
| 31 | void setupPlay(boolean beta) { |
| 32 | apply plugin: "com.github.triplet.play" |
| 33 | play { |
| 34 | track = beta ? "beta" : "production" |
| 35 | defaultToAppBundles = true |
| 36 | } |
| 37 | } |
| 38 |
| 39 | configurations { |
| 40 | compile.exclude module: "support-v4" |
| 41 | } |
| 42 |
| 43 | def keystorePwd = null |
| 44 | def alias = null |
| 45 | def pwd = null |
| 46 | def disableCMakeRelWithDebInfo = System.getenv("COMPILE_NATIVE") == null |
| 47 |
| 48 | Properties properties |
| 49 | def base64 = System.getenv("LOCAL_PROPERTIES") |
| 50 | if (base64 != null && !base64.isBlank()) { |
| 51 | properties = new Properties() |
| 52 | properties.load(new ByteArrayInputStream(Base64.decoder.decode(base64))) |
| 53 | } else if (project.rootProject.file("local.properties").exists()) { |
| 54 | properties = new Properties() |
| 55 | properties.load(project.rootProject.file("local.properties").newDataInputStream()) |
| 56 | } |
| 57 |
| 58 | if (properties != null) { |
| 59 | keystorePwd = properties.getProperty("KEYSTORE_PASS") |
| 60 | alias = properties.getProperty("ALIAS_NAME") |
| 61 | pwd = properties.getProperty("ALIAS_PASS") |
| 62 | } |
| 63 |
| 64 | keystorePwd = keystorePwd ?: System.getenv("KEYSTORE_PASS") |
| 65 | alias = alias ?: System.getenv("ALIAS_NAME") |
| 66 | pwd = pwd ?: System.getenv("ALIAS_PASS") |
| 67 |
| 68 | def targetTask = "" |
| 69 | if (!gradle.startParameter.taskNames.isEmpty()) { |
| 70 | if (gradle.startParameter.taskNames.size == 1) { |
| 71 | targetTask = gradle.startParameter.taskNames[0].toLowerCase() |
| 72 | } |
| 73 | } |
| 74 |
| 75 | def nativeTarget = System.getenv("NATIVE_TARGET") |
| 76 | if (nativeTarget == null) nativeTarget = "" |
| 77 |
| 78 | android { |
| 79 | compileSdkVersion 33 |
| 80 | ndkVersion rootProject.ext.ndkVersion |
| 81 |
| 82 | defaultConfig.applicationId = "xyz.nextalone.nagram" |
| 83 |
| 84 | splits { |
| 85 |
| 86 | abi { |
| 87 | if (targetTask.contains("fdroid")) { |
| 88 | enable false |
| 89 | universalApk true |
| 90 | } else { |
| 91 | enable true |
| 92 | reset() |
| 93 | universalApk false |
| 94 | if (!nativeTarget.isBlank()) { |
| 95 | include nativeTarget |
| 96 | } else { |
| 97 | include 'armeabi-v7a', 'arm64-v8a' |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 |
| 102 | } |
| 103 |
| 104 | defaultConfig { |
| 105 | minSdkVersion 21 |
| 106 | //noinspection ExpiredTargetSdkVersion,OldTargetApi |
| 107 | targetSdkVersion 33 |
| 108 |
| 109 | versionName verName |
| 110 | versionCode verCode |
| 111 |
| 112 | def appId = "11535358" |
| 113 | def appHash = "33d372962fadb01df47e6ceed4e33cd6" |
| 114 |
| 115 | //obtain your own keys at https://core.telegram.org/api/obtaining_api_id |
| 116 |
| 117 | if (properties != null) { |
| 118 | appId = properties.getProperty("TELEGRAM_APP_ID") ?: System.getenv("TELEGRAM_APP_ID") ?: appId |
| 119 | appHash = properties.getProperty("TELEGRAM_APP_HASH") ?: System.getenv("TELEGRAM_APP_HASH") ?: appHash |
| 120 | } |
| 121 |
| 122 | buildConfigField "String", "BUILD_VERSION_STRING", "\"" + verName + "\"" |
| 123 | buildConfigField "String", "OFFICIAL_VERSION", "\"" + officialVer + "\"" |
| 124 | buildConfigField "int", "OFFICIAL_VERSION_CODE", officialCode + "" |
| 125 | buildConfigField "int", "APP_ID", appId |
| 126 | buildConfigField "String", "APP_HASH", "\"" + appHash + "\"" |
| 127 |
| 128 | externalNativeBuild { |
| 129 | cmake { |
| 130 | arguments "-DANDROID_STL=c++_static", "-DANDROID_PLATFORM=android-21" |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 |
| 135 | bundle { |
| 136 | language { |
| 137 | enableSplit = false |
| 138 | } |
| 139 | } |
| 140 |
| 141 | externalNativeBuild { |
| 142 | cmake { |
| 143 | path "jni/CMakeLists.txt" |
| 144 | } |
| 145 | } |
| 146 |
| 147 |
| 148 | compileOptions { |
| 149 | sourceCompatibility JavaVersion.VERSION_11 |
| 150 | targetCompatibility JavaVersion.VERSION_11 |
| 151 |
| 152 | coreLibraryDesugaringEnabled true |
| 153 | } |
| 154 |
| 155 | kotlinOptions { |
| 156 | jvmTarget = JavaVersion.VERSION_11.toString() |
| 157 | } |
| 158 |
| 159 | testOptions { |
| 160 | unitTests.includeAndroidResources = true |
| 161 | } |
| 162 |
| 163 | signingConfigs { |
| 164 | release { |
| 165 | storeFile project.file("release.keystore") |
| 166 | storePassword keystorePwd |
| 167 | keyAlias alias |
| 168 | keyPassword pwd |
| 169 | } |
| 170 | } |
| 171 |
| 172 | buildTypes { |
| 173 | debug { |
| 174 | isDefault true |
| 175 | debuggable true |
| 176 | jniDebuggable true |
| 177 | multiDexEnabled true |
| 178 | zipAlignEnabled true |
| 179 | signingConfig signingConfigs.release |
| 180 | } |
| 181 |
| 182 | release { |
| 183 | debuggable false |
| 184 | jniDebuggable false |
| 185 | minifyEnabled true |
| 186 | shrinkResources true |
| 187 | multiDexEnabled true |
| 188 | zipAlignEnabled true |
| 189 | proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" |
| 190 | matchingFallbacks = ["release", "debug"] |
| 191 | signingConfig signingConfigs.release |
| 192 | } |
| 193 | } |
| 194 |
| 195 | sourceSets { |
| 196 |
| 197 | main { |
| 198 | assets.srcDirs = ["src/main/assets"] |
| 199 | } |
| 200 |
| 201 | debug { |
| 202 | java { |
| 203 | srcDirs "src/main/java" |
| 204 | } |
| 205 | jniLibs { |
| 206 | srcDir "src/main/libs" |
| 207 | } |
| 208 | } |
| 209 |
| 210 | release { |
| 211 | java { |
| 212 | srcDirs "src/main/java" |
| 213 | } |
| 214 | jniLibs { |
| 215 | srcDir "src/main/libs" |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 |
| 220 | flavorDimensions "version" |
| 221 |
| 222 | tasks.configureEach { task -> |
| 223 | if (((task.name.endsWith("Ndk") || task.name.startsWith("generateJsonModel") || task.name.startsWith("externalNativeBuild"))) && !task.name.contains("Debug")) { |
| 224 | task.enabled = false |
| 225 | } |
| 226 | if (task.name.contains("uploadCrashlyticsMappingFile")) { |
| 227 | enabled = false |
| 228 | } |
| 229 | if (disableCMakeRelWithDebInfo && task.name.contains("CMakeRelWithDebInfo")) { |
| 230 | enabled = false |
| 231 | } |
| 232 | } |
| 233 |
| 234 | applicationVariants.configureEach { variant -> |
| 235 | variant.outputs.configureEach { output -> |
| 236 | String gramName = "Nagram" |
| 237 | String first = String.format("%s-v%s(%s)", gramName, versionName, versionCode) |
| 238 | String name = outputFileName.replace("TMessagesProj", first) |
| 239 | name = name.replace("-release", "") |
| 240 | outputFileName = name |
| 241 | } |
| 242 | } |
| 243 |
| 244 | } |
| 245 |
| 246 | def fcmVersion = "23.4.1" |
| 247 | def crashlyticsVersion = "18.6.2" |
| 248 | def playCoreVersion = "1.10.3" |
| 249 |
| 250 | dependencies { |
| 251 |
| 252 | implementation "androidx.browser:browser:1.5.0" |
| 253 | implementation 'androidx.fragment:fragment:1.2.0' |
| 254 | implementation "androidx.core:core-ktx:1.9.0" |
| 255 | implementation "androidx.palette:palette-ktx:1.0.0" |
| 256 | implementation "androidx.viewpager:viewpager:1.0.0" |
| 257 | implementation "androidx.exifinterface:exifinterface:1.3.7" |
| 258 | implementation "androidx.interpolator:interpolator:1.0.0" |
| 259 | implementation 'androidx.biometric:biometric:1.1.0' |
| 260 | implementation "androidx.dynamicanimation:dynamicanimation:1.0.0" |
| 261 | implementation "androidx.multidex:multidex:2.0.1" |
| 262 | implementation "androidx.sharetarget:sharetarget:1.2.0" |
| 263 |
| 264 | // just follow official |
| 265 | compileOnly 'org.checkerframework:checker-qual:2.5.2' |
| 266 | compileOnly 'org.checkerframework:checker-compat-qual:2.5.0' |
| 267 |
| 268 | // don"t change this :) |
| 269 | //noinspection GradleDependency |
| 270 | implementation "com.googlecode.mp4parser:isoparser:1.0.6" |
| 271 |
| 272 | implementation "com.google.code.gson:gson:2.10" |
| 273 | implementation "org.osmdroid:osmdroid-android:6.1.10" |
| 274 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.23" |
| 275 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0" |
| 276 |
| 277 | implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.10" |
| 278 | implementation 'com.neovisionaries:nv-websocket-client:2.14' |
| 279 | implementation 'dnsjava:dnsjava:3.4.1' |
| 280 | implementation "org.dizitart:nitrite:3.4.3" |
| 281 |
| 282 | implementation "cn.hutool:hutool-core:5.7.13" |
| 283 | implementation "cn.hutool:hutool-crypto:5.7.13" |
| 284 | implementation 'cn.hutool:hutool-http:5.7.5' |
| 285 | implementation "com.jakewharton:process-phoenix:2.1.2" |
| 286 | implementation 'com.google.guava:guava:31.1-android' |
| 287 |
| 288 | implementation 'com.google.android.gms:play-services-mlkit-subject-segmentation:16.0.0-beta1' |
| 289 |
| 290 | implementation project(":openpgp-api") |
| 291 |
| 292 | compileOnly fileTree("libs") |
| 293 |
| 294 | compileOnly "com.google.firebase:firebase-messaging:$fcmVersion" |
| 295 | compileOnly "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" |
| 296 | compileOnly "com.google.android.play:core:$playCoreVersion" |
| 297 |
| 298 | implementation 'com.google.android.gms:play-services-vision:20.1.3' |
| 299 | implementation 'com.google.android.gms:play-services-maps:18.2.0' |
| 300 | implementation 'com.google.android.gms:play-services-location:21.2.0' |
| 301 |
| 302 | implementation "com.google.firebase:firebase-messaging:$fcmVersion" |
| 303 | implementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" |
| 304 | implementation "com.google.android.play:core:$playCoreVersion" |
| 305 |
| 306 | implementation 'com.android.billingclient:billing:5.1.0' |
| 307 |
| 308 | testImplementation "junit:junit:4.13.2" |
| 309 | testImplementation "androidx.test:core:1.5.0" |
| 310 | testImplementation "org.robolectric:robolectric:4.5.1" |
| 311 |
| 312 | coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.2.0" |
| 313 |
| 314 | } |
| 315 | dependencies { |
| 316 | // add for undo and redo |
| 317 | implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3' |
| 318 | // add splash screen |
| 319 | implementation("androidx.core:core-splashscreen:1.0.1") |
| 320 | // add for music tag flac... |
| 321 | implementation 'org:jaudiotagger:2.0.3' |
| 322 | // add for auto translate |
| 323 | implementation 'com.google.mlkit:language-id:17.0.5' |
| 324 | // add for emoji |
| 325 | implementation 'com.jaredrummler:truetypeparser-light:1.0.0' |
| 326 | // add for up |
| 327 | implementation 'com.github.UnifiedPush:android-connector:2.3.1' |
| 328 | } |
| 329 |
| 330 | apply plugin: "com.google.gms.google-services" |
| 331 | apply plugin: "com.google.firebase.crashlytics" |
| 332 |
| 333 | android { |
| 334 |
| 335 |
| 336 | packagingOptions { |
| 337 | jniLibs { |
| 338 | excludes += ['/fabric/**', '/META-INF/native-image/**'] |
| 339 | useLegacyPackaging true |
| 340 | } |
| 341 | resources { |
| 342 | excludes += ['/fabric/**', '/META-INF/*.version', '/META-INF/*.kotlin_module', '/META-INF/native-image/**', '/builddef.lst', '/*.txt', '/DebugProbesKt.bin', '/okhttp3/internal/publicsuffix/NOTICE'] |
| 343 | } |
| 344 |
| 345 | def lib = "libtmessages.*.so" |
| 346 | pickFirst "lib/armeabi-v7a/$lib" |
| 347 | pickFirst "lib/arm64-v8a/$lib" |
| 348 | } |
| 349 | namespace "org.telegram.messenger" |
| 350 | lint { |
| 351 | disable 'MissingTranslation', 'ExtraTranslation', 'BlockedPrivateApi' |
| 352 | } |
| 353 | buildFeatures { |
| 354 | buildConfig true |
| 355 | } |
| 356 |
| 357 | tasks.configureEach { task -> |
| 358 | if (task.name.startsWith("uploadCrashlyticsMappingFile")) { |
| 359 | task.enabled = false |
| 360 | } else if (task.name.contains("Crashlytics") && task.name.contains("NoGcm")) { |
| 361 | task.enabled = false |
| 362 | } else if (task.name.endsWith("GoogleServices") && task.name.contains("NoGcm")) { |
| 363 | task.enabled = false |
| 364 | } |
| 365 | } |
| 366 |
| 367 | } |
| 368 |