-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat] 새 Toast, Dialog 적용 #409
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
Changes from all commits
2589ba1
3ac0fa5
dcaa269
127de15
a089334
1ffacc0
ac58048
6e3a35f
e5c58b7
9f0ea55
b4ba1e2
623ebc2
4ffd262
3cfe7bc
0a5519f
800f0fa
89c5f43
19d383a
bd145e3
e8c3c62
53e9335
93619ef
aa0a7df
f08a036
688e65e
d3e40ce
1a8e91f
8c19d55
b2b895a
ef3e155
2d9ea2e
7d71f39
9c5fff6
a0ba703
54132e6
ce369a1
8b8767a
ca02ee5
18da734
cd8031a
39c5dc6
3a1a60a
8d2c5a0
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 |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ import com.eatssu.android.domain.usecase.review.GetReviewListUseCase | |
| import com.eatssu.common.UiEvent | ||
| import com.eatssu.common.UiState | ||
| import com.eatssu.common.enums.MenuType | ||
| import com.eatssu.common.enums.ToastType | ||
| import dagger.hilt.android.lifecycle.HiltViewModel | ||
| import kotlinx.coroutines.flow.MutableSharedFlow | ||
| import kotlinx.coroutines.flow.MutableStateFlow | ||
|
|
@@ -53,7 +54,7 @@ class ReviewListViewModel @Inject constructor( | |
| _uiState.value = UiState.Success(ReviewListState(reviewInfo, reviewList)) | ||
| } catch (e: Exception) { | ||
| _uiState.value = UiState.Error | ||
| _uiEvent.emit(UiEvent.ShowToast("리뷰를 불러오지 못했습니다.")) | ||
| _uiEvent.emit(UiEvent.ShowToast("리뷰를 불러오지 못했습니다.", ToastType.ERROR)) | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -63,12 +64,12 @@ class ReviewListViewModel @Inject constructor( | |
| val success = deleteReviewUseCase(reviewId) | ||
|
|
||
| if (!success) { | ||
| _uiEvent.emit(UiEvent.ShowToast("리뷰 삭제에 실패했습니다.")) | ||
| _uiEvent.emit(UiEvent.ShowToast("리뷰 삭제에 실패했습니다.", ToastType.ERROR)) | ||
|
Member
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. 지금 드는 생각인데 하드코딩이 아니라 리소스에서 string을 한번에 관리하려면 뷰모델에서는 리소스 접근이 불가하니 event 유형만 넘겨주고 뷰에서 string 호출을 해야하지 않을까..? 싶네영 근데 그 방법이 좋을지는 몰르겠어요...
Member
Author
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. https://medium.com/@muhammetemingundogar53/accessing-string-resource-file-in-viewmodel-65bf2ad8b39 다만 궁극적으로 ViewModel이 R 자체를 몰라도 되게끔 I18nProvider 같은 외부 서비스가 enum/String을 집어넣으면 알아서 현재 context에서 resolve해주는 형태로 가야할 것 같아요! 말씀해주신 부분은 이벤트 유형 케이스가 너무..많아서 유지보수가 어려울 것 같네용
Member
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. 뷰모델에서 한테 context 주고 리소스 id를 호출하는게 최선일 것 같슴다 |
||
| return@launch | ||
| } | ||
|
|
||
| // 삭제 성공 시 | ||
| _uiEvent.emit(UiEvent.ShowToast("리뷰를 삭제했습니다.")) | ||
| _uiEvent.emit(UiEvent.ShowToast("리뷰를 삭제했습니다.", ToastType.SUCCESS)) | ||
| val type = lastMenuType | ||
| val id = lastItemId | ||
| if (type != null && id != null) { | ||
|
|
||
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.
Using ToastType.ERROR for a missing nickname seems too severe. A missing nickname is more of a required input prompt rather than an error condition. Consider using ToastType.INFO or ToastType.WARNING instead, as this is guiding the user to complete their profile rather than indicating a system error.