This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface UserService { | |
@GET("http://10.0.2.2/users") | |
fun getUsers(): Single<List<User>> | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface UserService { | |
@GET("/users") | |
fun getUsers(): Single<List<User>> | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseUrlInterceptor(baseUrl: String) : Interceptor { | |
private val baseUrl: HttpUrl = baseUrl.toHttpUrl() | |
override fun intercept(chain: Interceptor.Chain): Response { | |
val request = chain.request() | |
val url = request.url | |
// Skip URL reconstruction if we're hitting a local endpoint | |
if (url.host == "10.0.2.2") return chain.proceed(request) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseUrlInterceptor(baseUrl: String) : Interceptor { | |
private val baseUrl: HttpUrl = baseUrl.toHttpUrl() | |
override fun intercept(chain: Interceptor.Chain): Response { | |
val request = chain.request() | |
val url = request.url | |
// Reconstruct the URL with the new base URL | |
return chain.proceed( | |
request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Existing code | |
Retrofit | |
.Builder() | |
.baseUrl("https://example.com") | |
... | |
// New test code | |
Retrofit | |
.Builder() | |
.baseUrl("http://10.0.2.2") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.livefront.example"> | |
<application android:networkSecurityConfig="@xml/network_security_config"> | |
... | |
</application> | |
</manifest> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<network-security-config> | |
<domain-config cleartextTrafficPermitted="true"> | |
<domain includeSubdomains="true">10.0.2.2</domain> | |
</domain-config> | |
</network-security-config> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
supportedResConfigs=en,notnight,port |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
android { | |
// ... | |
defaultConfig { | |
resConfigs "en" | |
// ... | |
} | |
// ... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
apply from: "$rootDir/gradle/buildTasks.gradle" | |
android { | |
// ... | |
defaultConfig { | |
if (project.supportedResConfigs != null) { | |
resConfigs project.supportedResConfigs | |
} | |
// ... | |
} |
NewerOlder