// Source - https://stackoverflow.com/q/67360263
// Posted by hamid
// Retrieved 2025-12-01, License - CC BY-SA 4.0
object ServiceBuilder {
private val client = OkHttpClient.Builder()
.connectionSpecs(listOf(ConnectionSpec.MODERN_TLS) )
.build()
private val retrofit = Retrofit.Builder()
.baseUrl(Config().BASE_URL)# "https://10.0.2.2:5000"
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build()
fun<T> buildService(service: Class<T>): T{
Security.insertProviderAt(Conscrypt.newProvider(), 1);
return retrofit.create(service)
}
}