Skip to content

Commit

Permalink
#91 댓글 나오는 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
pknujsp committed Jun 8, 2023
1 parent cdc91c6 commit 0046760
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class MedicineCommentsFragment :

is CommentActionState.COMPLETED_LIKE -> {
action.result.fold(onSuccess = {
adapter.retry()
adapter.refresh()
}, onFailure = {
toast(it.message.toString())
})
Expand All @@ -103,15 +103,15 @@ class MedicineCommentsFragment :
action.result.fold(onSuccess = {
replyHeader.isVisible = false
toast(getString(R.string.appliedComment))
adapter.retry()
adapter.refresh()
}, onFailure = {
toast(it.message.toString())
})
}

is CommentActionState.COMPLETED_APPLY_EDITED_COMMENT -> {
action.result.fold(onSuccess = {
adapter.retry()
adapter.refresh()
toast(getString(R.string.appliedEditComment))
}, onFailure = {
toast(it.message.toString())
Expand All @@ -120,7 +120,7 @@ class MedicineCommentsFragment :

is CommentActionState.COMPLETED_DELETE_COMMENT -> {
action.result.fold(onSuccess = {
adapter.retry()
adapter.refresh()
toast(getString(R.string.deletedComment))
}, onFailure = {
toast(it.message.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import com.android.mediproject.feature.comments.commentsofamedicine.CommentActio
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharedFlow
Expand Down Expand Up @@ -113,7 +112,6 @@ class MedicineCommentsViewModel @Inject constructor(
subOrdinationId = replyId.value.toString())).collectLatest { result ->
result.onSuccess {
// 댓글 등록 성공
delay(200)
commentsUseCase.scrollChannel.send(Unit)
_action.emit(CommentActionState.COMPLETED_APPLY_COMMENT_REPLY(Result.success(Unit)))
}.onFailure {
Expand All @@ -134,7 +132,6 @@ class MedicineCommentsViewModel @Inject constructor(
subOrdinationId = "0")).collectLatest { result ->
result.onSuccess {
// 댓글 등록 성공
delay(200)
commentsUseCase.scrollChannel.send(Unit)
_action.emit(CommentActionState.COMPLETED_APPLY_COMMENT_REPLY(Result.success(Unit)))
}.onFailure {
Expand All @@ -156,7 +153,6 @@ class MedicineCommentsViewModel @Inject constructor(
medicineId = medicineBasicInfo.replayCache.last().medicineIdInAws)).collectLatest { result ->
result.onSuccess {
// 댓글 수정 성공
delay(200)
_action.emit(CommentActionState.COMPLETED_APPLY_EDITED_COMMENT(Result.success(Unit)))
}.onFailure {
_action.emit(CommentActionState.COMPLETED_APPLY_EDITED_COMMENT(Result.failure(it)))
Expand Down Expand Up @@ -201,7 +197,6 @@ class MedicineCommentsViewModel @Inject constructor(
.collectLatest { result ->
result.onSuccess {
// 댓글 삭제 성공
delay(200)
commentsUseCase.scrollChannel.send(Unit)
_action.emit(CommentActionState.COMPLETED_DELETE_COMMENT(Result.success(Unit)))
}.onFailure {
Expand All @@ -223,7 +218,6 @@ class MedicineCommentsViewModel @Inject constructor(
.collectLatest { result ->
result.onSuccess {
// like 처리 완료
delay(200)
_action.emit(CommentActionState.COMPLETED_LIKE(Result.success(Unit)))
}.onFailure {
_action.emit(CommentActionState.COMPLETED_LIKE(Result.failure(it)))
Expand Down
3 changes: 1 addition & 2 deletions feature/search/src/main/res/layout/manual_medicine_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

<ImageView
android:id="@+id/medicineImgView"
android:src="@drawable/logo"
android:layout_width="60dp"
android:layout_height="60dp"
android:background="@drawable/circle_image_background"
app:img="@{item.imgUrl}"
android:contentDescription="@string/medicineImage"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down

0 comments on commit 0046760

Please sign in to comment.