File tree Expand file tree Collapse file tree 4 files changed +25
-0
lines changed
Projects/Presentation/Sources Expand file tree Collapse file tree 4 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -10,4 +10,5 @@ import Foundation
1010extension Notification . Name {
1111 static let showRecommendedRoutineToast = Notification . Name ( " showRecommendedRoutineToast " )
1212 static let showDeletedRoutineToast = Notification . Name ( " showDeletedRoutineToast " )
13+ static let showUpdatedRoutineToast = Notification . Name ( " showUpdatedRoutineToast " )
1314}
Original file line number Diff line number Diff line change @@ -155,6 +155,7 @@ final class RoutineCreationViewController: BaseViewController<RoutineCreationVie
155155 viewModel. action ( input: . showRecommendedRoutineToastMessageView)
156156 }
157157 } else {
158+ viewModel. action ( input: . showUpdateRoutineToastMessageView)
158159 self . navigationController? . popViewController ( animated: true )
159160 }
160161 } ,
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ final class RoutineCreationViewModel: ViewModel {
3434 case configureExecution( type: ExecutionTime )
3535 case registerRoutine
3636 case showRecommendedRoutineToastMessageView
37+ case showUpdateRoutineToastMessageView
3738 }
3839
3940 struct Output {
@@ -111,6 +112,8 @@ final class RoutineCreationViewModel: ViewModel {
111112 periodEndSubject. send ( date)
112113 case . showRecommendedRoutineToastMessageView:
113114 showRecommendedRoutineToastMessageView ( )
115+ case . showUpdateRoutineToastMessageView:
116+ showUpdatedRoutineToastMessageView ( )
114117 }
115118
116119 updateIsRoutineValid ( )
@@ -291,4 +294,13 @@ final class RoutineCreationViewModel: ViewModel {
291294 userInfo: nil )
292295 }
293296 }
297+
298+ private func showUpdatedRoutineToastMessageView( ) {
299+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.6 ) {
300+ NotificationCenter . default. post (
301+ name: . showUpdatedRoutineToast,
302+ object: nil ,
303+ userInfo: nil )
304+ }
305+ }
294306}
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ final class RoutineListViewController: BaseViewController<RoutineListViewModel>
3030 private let routineStackView = UIStackView ( )
3131 private var routineCardViews : [ String : RoutineCardView ] = [ : ]
3232 private let deleteToastMessage : String = " 삭제가 완료되었습니다. "
33+ private let updateToastMessage : String = " 루틴 수정이 완료되었습니다. "
3334 private var toastMessageView = ToastView ( message: " " )
3435 private var dimmedView : UIView ?
3536 private var cancellables : Set < AnyCancellable >
@@ -149,6 +150,16 @@ final class RoutineListViewController: BaseViewController<RoutineListViewModel>
149150 self . toastMessageView. showToastMessageView ( message: deleteToastMessage)
150151 }
151152 . store ( in: & cancellables)
153+
154+ NotificationCenter . default. publisher ( for: . showUpdatedRoutineToast)
155+ . receive ( on: DispatchQueue . main)
156+ . sink { [ weak self] _ in
157+ guard let self else { return }
158+ self . viewModel. action ( input: . fetchRoutineList)
159+ self . viewModel. action ( input: . fetchDailyRoutine)
160+ self . toastMessageView. showToastMessageView ( message: updateToastMessage)
161+ }
162+ . store ( in: & cancellables)
152163 }
153164
154165 private func updateRoutineStackView( routines: [ Routine ] ) {
You can’t perform that action at this time.
0 commit comments