-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX/#257] 유빈 담당 뷰 / QA 이슈 대응 #258
Changes from 5 commits
9d3bf28
bfa5ca1
21cda2d
ab763c7
5a2a836
13917ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,9 @@ import com.going.domain.entity.request.PreferenceChangeRequestModel | |
import com.going.domain.repository.ProfileRepository | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.flow.MutableSharedFlow | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.SharedFlow | ||
import kotlinx.coroutines.flow.StateFlow | ||
import kotlinx.coroutines.launch | ||
import javax.inject.Inject | ||
|
||
|
@@ -20,13 +22,80 @@ class ChangeTagViewModel @Inject constructor( | |
private val _preferencePatchState = MutableSharedFlow<Boolean>() | ||
val preferencePatchState: SharedFlow<Boolean> = _preferencePatchState | ||
|
||
private val _isButtonValid = MutableStateFlow(false) | ||
val isButtonValid: StateFlow<Boolean> = _isButtonValid | ||
|
||
var tripId: Long = 0 | ||
|
||
val styleA = MutableLiveData(0) | ||
val styleB = MutableLiveData(0) | ||
val styleC = MutableLiveData(0) | ||
val styleD = MutableLiveData(0) | ||
val styleE = MutableLiveData(0) | ||
private val defaultStyleA = MutableLiveData(0) | ||
private val defaultStyleB = MutableLiveData(0) | ||
private val defaultStyleC = MutableLiveData(0) | ||
private val defaultStyleD = MutableLiveData(0) | ||
private val defaultStyleE = MutableLiveData(0) | ||
|
||
private val styleA = MutableLiveData(0) | ||
private val styleB = MutableLiveData(0) | ||
private val styleC = MutableLiveData(0) | ||
private val styleD = MutableLiveData(0) | ||
private val styleE = MutableLiveData(0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 혹시 이걸 전부 다 observe 혹은 데바에 쓰고있나요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아하! 그렇네요!! 수정했습니다~!! |
||
|
||
private var isStyleAChanged: Boolean = false | ||
private var isStyleBChanged: Boolean = false | ||
private var isStyleCChanged: Boolean = false | ||
private var isStyleDChanged: Boolean = false | ||
private var isStyleEChanged: Boolean = false | ||
|
||
fun setDefaultPreference(styleA: Int, styleB: Int, styleC: Int, styleD: Int, styleE: Int) { | ||
defaultStyleA.value = styleA | ||
this.styleA.value = styleA | ||
|
||
defaultStyleB.value = styleB | ||
this.styleB.value = styleB | ||
|
||
defaultStyleC.value = styleC | ||
this.styleC.value = styleC | ||
|
||
defaultStyleD.value = styleD | ||
this.styleD.value = styleD | ||
|
||
defaultStyleE.value = styleE | ||
this.styleE.value = styleE | ||
} | ||
|
||
fun checkIsPreferenceChange(number: Int, index: Int) { | ||
when (number) { | ||
1 -> { | ||
styleA.value = index | ||
isStyleAChanged = index != defaultStyleA.value | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 굿굿! |
||
} | ||
|
||
2 -> { | ||
styleB.value = index | ||
isStyleBChanged = index != defaultStyleB.value | ||
} | ||
|
||
3 -> { | ||
styleC.value = index | ||
isStyleCChanged = index != defaultStyleC.value | ||
} | ||
|
||
4 -> { | ||
styleD.value = index | ||
isStyleDChanged = index != defaultStyleD.value | ||
} | ||
|
||
5 -> { | ||
styleE.value = index | ||
isStyleEChanged = index != defaultStyleE.value | ||
} | ||
} | ||
checkIsButtonValid() | ||
} | ||
|
||
private fun checkIsButtonValid() { | ||
_isButtonValid.value = | ||
isStyleAChanged || isStyleBChanged || isStyleCChanged || isStyleDChanged || isStyleEChanged | ||
} | ||
|
||
fun patchPreferenceTagToServer() { | ||
viewModelScope.launch { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@color/white_000" | ||
android:background="@color/gray_50" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 역시 매의 눈 ....들이시군요 |
||
tools:context=".entertrip.invitetrip.preference.FinishPreferenceActivity"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굿뜨~~