File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed
app/src/main/java/io/agora/flat Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ class AppEnv @Inject constructor(@ApplicationContext context: Context) {
5959 loginConfig = LoginConfig (google = false ),
6060
6161 showIcp = true ,
62+ showStreamAgreement = true ,
6263 )
6364
6465 envMap[ENV_CN_PROD ] = EnvItem (
@@ -82,6 +83,7 @@ class AppEnv @Inject constructor(@ApplicationContext context: Context) {
8283 loginConfig = LoginConfig (google = false ),
8384
8485 showIcp = true ,
86+ showStreamAgreement = true ,
8587 )
8688
8789 envMap[ENV_SG_PROD ] = EnvItem (
@@ -184,6 +186,8 @@ class AppEnv @Inject constructor(@ApplicationContext context: Context) {
184186
185187 val showIcp get() = currentEnvItem.showIcp
186188
189+ val showStreamAgreement get() = currentEnvItem.showStreamAgreement
190+
187191 val agreementsUrl get() = " https://flat-storage.oss-cn-hangzhou.aliyuncs.com/versions/latest/stable/android/agreements.json"
188192
189193 data class EnvItem (
@@ -203,6 +207,7 @@ class AppEnv @Inject constructor(@ApplicationContext context: Context) {
203207 val loginConfig : LoginConfig = LoginConfig (),
204208
205209 val showIcp : Boolean = false ,
210+ val showStreamAgreement : Boolean = false ,
206211 )
207212}
208213
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import io.agora.flat.data.repository.MiscRepository
1313import io.agora.flat.data.repository.UserRepository
1414import kotlinx.coroutines.flow.MutableStateFlow
1515import kotlinx.coroutines.flow.StateFlow
16+ import kotlinx.coroutines.flow.update
1617import kotlinx.coroutines.launch
1718import javax.inject.Inject
1819
@@ -34,12 +35,22 @@ class SettingsViewModel @Inject constructor(
3435
3536 init {
3637 viewModelScope.launch {
37- _state .value = _state .value.copy(versionCheckResult = versionChecker.forceCheck())
38+ val checkResult = versionChecker.forceCheck()
39+ _state .update {
40+ it.copy(versionCheckResult = checkResult)
41+ }
3842 }
3943
40- viewModelScope.launch {
41- val value = miscRepository.getStreamAgreement()
42- _state .value = _state .value.copy(isAgreeStream = value)
44+ if (env.showStreamAgreement) {
45+ _state .update {
46+ it.copy(isAgreeStream = false )
47+ }
48+ viewModelScope.launch {
49+ val value = miscRepository.getStreamAgreement() ? : false
50+ _state .update {
51+ it.copy(isAgreeStream = value)
52+ }
53+ }
4354 }
4455 }
4556
You can’t perform that action at this time.
0 commit comments