Skip to content

Commit

Permalink
AndroidChannelBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
rikaaa0928 committed Oct 14, 2024
1 parent 6177d24 commit dd0e383
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
}

dependencies {
// implementation("io.grpc:grpc-core:1.68.0")
implementation(libs.grpc.android)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/moe/rikaaa0928/uot/UogClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import android.util.Log
import com.google.protobuf.ByteString
import dad.xiaomi.uog.Udp
import dad.xiaomi.uog.UdpServiceGrpcKt
//import io.grpc.internal.DnsNameResolverProvider
import io.grpc.okhttp.OkHttpChannelBuilder
import io.grpc.android.AndroidChannelBuilder
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.channels.Channel
Expand Down Expand Up @@ -40,7 +39,7 @@ class UogClient(val lPort: Int, val endpoint: String, val password: String) {
try {
val id = random.nextInt(1000);
val url = URL(endpoint)
val builder = OkHttpChannelBuilder.forAddress(url.host, url.port)
val builder = AndroidChannelBuilder.forAddress(url.host, url.port)
if (!url.protocol.equals("https")) {
builder.usePlaintext()
}
Expand Down
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
agp = "8.7.0"
grpcKotlinStub = "1.4.1"
grpcOkhttp = "1.62.2"
grpcOkhttp = "1.57.2"
kotlin = "1.9.24"
coreKtx = "1.13.1"
junit = "4.13.2"
Expand All @@ -15,6 +15,7 @@ protobufGradlePlugin = "0.9.4"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
grpc-android = { module = "io.grpc:grpc-android", version.ref = "grpcOkhttp" }
protoc = { group = "com.google.protobuf", name = "protoc", version = "3.25.3" }
protoc-gen-grpc-java = { group = "io.grpc", name = "protoc-gen-grpc-java", version = "1.62.2" }
protoc-gen-grpc-kotlin = { group = "io.grpc", name = "protoc-gen-grpc-kotlin", version = "1.4.1" }
Expand Down

0 comments on commit dd0e383

Please sign in to comment.