Skip to content

Commit df7b562

Browse files
Add NTgCalls build configuration and Bluetooth permissions
- Add BLUETOOTH_CONNECT and BLUETOOTH_SCAN permissions for Android 12+ - Add USE_NTGCALLS BuildConfig flag (controlled by app.ntgcalls in local.properties) - Add useNTgCalls to ApplicationConfig and ConfigurationPlugin - Add conditional NTgCalls dependency (io.github.pytgcalls:ntgcalls:2.0.6) Note: The NTgCalls interface code from PR TGX-Android#916 requires API compatibility updates - the PR was written for a different version of the NTgCalls library with packages (media, p2p, devices, exceptions) that don't exist in the public Maven Central release. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3e82450 commit df7b562

4 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎app/build.gradle.kts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ android {
7777
buildConfigString("TDLIB_REMOTE_URL", "https://github.com/tdlib/td")
7878

7979
buildConfigField("boolean", "EXPERIMENTAL", config.isExperimentalBuild.toString())
80+
buildConfigField("boolean", "USE_NTGCALLS", config.useNTgCalls.toString())
8081

8182
buildConfigInt("TARGET_SDK_INT", config.targetSdkVersion)
8283

@@ -486,6 +487,10 @@ dependencies {
486487
implementation(project(":vkryl:leveldb"))
487488
implementation(project(":vkryl:android"))
488489
implementation(project(":vkryl:td"))
490+
// NTgCalls: https://github.com/pytgcalls/ntgcalls
491+
if (config.useNTgCalls) {
492+
implementation("io.github.pytgcalls:ntgcalls:2.0.6")
493+
}
489494
// AndroidX: https://developer.android.com/jetpack/androidx/versions
490495
flavorImplementation(
491496
libs.androidx.activity.legacy,

‎app/src/main/AndroidManifest.xml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@
7474
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
7575
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
7676
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
77-
<uses-permission android:name="android.permission.BLUETOOTH" />
77+
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
78+
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
79+
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
7880
<!--<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />-->
7981
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"
8082
tools:ignore="RequestInstallPackagesPolicy" />

‎buildSrc/src/main/kotlin/Config.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ data class ApplicationConfig(
6262

6363
val isExperimentalBuild: Boolean,
6464
val isHuaweiBuild: Boolean,
65+
val useNTgCalls: Boolean,
6566
val forceOptimize: Boolean,
6667
val doNotObfuscate: Boolean,
6768

‎buildSrc/src/main/kotlin/tgx/gradle/plugin/ConfigurationPlugin.kt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ open class ConfigurationPlugin : Plugin<Project> {
7373
error("Unknown tgx.extension: $appExtension")
7474
}
7575
val isHuaweiBuild = appExtension == "hms"
76+
val useNTgCalls = properties.getProperty("app.ntgcalls", "false") == "true"
7677

7778
val versions = loadProperties("version.properties")
7879

@@ -126,6 +127,7 @@ open class ConfigurationPlugin : Plugin<Project> {
126127
majorVersion,
127128
isExperimentalBuild,
128129
isHuaweiBuild,
130+
useNTgCalls,
129131
forceOptimize,
130132
doNotObfuscate,
131133
compileSdkVersion,

0 commit comments

Comments
 (0)