Skip to content

Commit

Permalink
[refactor] 7주차 코드리뷰 반영 -> loading 관리 (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
arinming committed Jul 1, 2024
1 parent aae57df commit 1638b2c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ class HomeViewModel @Inject constructor(
val followerState = _followerState.asStateFlow()

private var _eventNetworkError = MutableLiveData(false)
val eventNetworkError: LiveData<Boolean>
get() = _eventNetworkError

private var _isNetworkErrorShown = MutableLiveData(false)

val friendList = mutableListOf<Profile>()
private val friendList = mutableListOf<Profile>()

init {
fetchFollowerList()
Expand Down
13 changes: 1 addition & 12 deletions app/src/main/java/com/sopt/now/compose/ui/signUp/SignUpScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import androidx.compose.ui.unit.sp
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.NavHostController
import com.sopt.now.compose.R
import com.sopt.now.compose.data.model.RequestSignUpDto
import com.sopt.now.compose.ui.base.SoptInputTextField
import com.sopt.now.compose.ui.base.SoptOutlinedButton
import com.sopt.now.compose.ui.base.SoptPasswordTextField
Expand Down Expand Up @@ -60,7 +59,7 @@ fun SignUpScreen(
}

is SignUpSideEffect.Loading -> {
Toast.makeText(context, event.message, Toast.LENGTH_SHORT).show()

}

is SignUpSideEffect.Error -> {
Expand All @@ -87,16 +86,6 @@ fun SignUpScreen(
}
}

val isSignUpButtonEnabled by remember(id, password, nickname, phoneNumber) {
mutableStateOf(
id.length in MIN_LENGTH_LOGIN..MAX_LENGTH_LOGIN
&& password.length in MIN_LENGTH_PASSWORD..MAX_LENGTH_PASSWORD
&& nickname.isNotEmpty() && !nickname.contains(
" "
) && phoneNumber.matches(Regex("^010-\\d{4}-\\d{4}\$"))
)
}

Text(
text = stringResource(id = R.string.sign_up_title),
fontWeight = FontWeight.Bold,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package com.sopt.now.compose.ui.signUp

sealed class SignUpSideEffect {
data class Success(val message: String) : SignUpSideEffect()
data class Loading(val message: String) : SignUpSideEffect()
object Loading : SignUpSideEffect()
data class Error(val message: String) : SignUpSideEffect()
}
}

0 comments on commit 1638b2c

Please sign in to comment.