Skip to content

Commit dd9c43c

Browse files
committed
refactor: change default proxy configuration to System
- Update `ProxyRepositoryImpl` to return `ProxyConfig.System` as the default fallback option. - Change the default `proxyConfig` parameter in `HttpClientFactory` from `None` to `System`. - Initialize `ProxyManager` with `ProxyConfig.System` as the starting state. - Update the dependency injection logic in `SharedModule` to use `ProxyConfig.System` when the configuration fetch fails or times out.
1 parent 1cf17d8 commit dd9c43c

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

core/data/src/commonMain/kotlin/zed/rainxch/core/data/di/SharedModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ val networkModule =
132132
withTimeout(1_500L) {
133133
get<ProxyRepository>().getProxyConfig().first()
134134
}
135-
}.getOrDefault(ProxyConfig.None)
135+
}.getOrDefault(ProxyConfig.System)
136136
}
137137

138138
when (config) {

core/data/src/commonMain/kotlin/zed/rainxch/core/data/network/HttpClientFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fun createGitHubHttpClient(
2929
rateLimitRepository: RateLimitRepository,
3030
authenticationState: AuthenticationState? = null,
3131
scope: CoroutineScope? = null,
32-
proxyConfig: ProxyConfig = ProxyConfig.None,
32+
proxyConfig: ProxyConfig = ProxyConfig.System,
3333
): HttpClient {
3434
val json =
3535
Json {

core/data/src/commonMain/kotlin/zed/rainxch/core/data/network/ProxyManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import kotlinx.coroutines.flow.asStateFlow
66
import zed.rainxch.core.domain.model.ProxyConfig
77

88
object ProxyManager {
9-
private val _proxyConfig = MutableStateFlow<ProxyConfig>(ProxyConfig.None)
9+
private val _proxyConfig = MutableStateFlow<ProxyConfig>(ProxyConfig.System)
1010
val currentProxyConfig: StateFlow<ProxyConfig> = _proxyConfig.asStateFlow()
1111

1212
fun setNoProxy() {

core/data/src/commonMain/kotlin/zed/rainxch/core/data/repository/ProxyRepositoryImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ProxyRepositoryImpl(
5858
}
5959

6060
else -> {
61-
ProxyConfig.None
61+
ProxyConfig.System
6262
}
6363
}
6464
}

0 commit comments

Comments
 (0)