@@ -16,7 +16,7 @@ protocol GlobalUIServiceProtocol: Sendable {
1616 func setSelectedTab( _ tab: TabType )
1717 func setIsErrorAlertPresented( _ value: Bool )
1818 func setIsMenuOpen( _ value: Bool )
19- func setToast( _ toast: ToastType ? )
19+ func setToast( _ toast: ToastType ? , showButton : Bool ? )
2020
2121 func openEllipsis( for timetable: TimetableMetadata )
2222 func closeEllipsis( )
@@ -50,6 +50,12 @@ protocol GlobalUIServiceProtocol: Sendable {
5050 func showNoticeViewIfNeeded( ) async throws
5151}
5252
53+ extension GlobalUIServiceProtocol {
54+ func setToast( _ toast: ToastType ? , showButton: Bool ? = true ) {
55+ setToast ( toast, showButton: showButton)
56+ }
57+ }
58+
5359struct GlobalUIService : GlobalUIServiceProtocol , UserAuthHandler , ConfigsProvidable {
5460 var appState : AppState
5561 var localRepositories : AppEnvironment . LocalRepositories
@@ -152,14 +158,14 @@ struct GlobalUIService: GlobalUIServiceProtocol, UserAuthHandler, ConfigsProvida
152158
153159 // MARK: Toast
154160
155- func setToast( _ toast: ToastType ? ) {
161+ func setToast( _ toast: ToastType ? , showButton : Bool ? = true ) {
156162 if let toast = toast {
157163 switch toast {
158164 case . reminderNone,
159165 . reminder10Before,
160166 . reminderOnTime,
161167 . reminder10After:
162- setReminderToast ( toast)
168+ setReminderToast ( toast, showButton )
163169 case . bookmark:
164170 setBookmarkToast ( toast)
165171 case . vacancy:
@@ -170,8 +176,15 @@ struct GlobalUIService: GlobalUIServiceProtocol, UserAuthHandler, ConfigsProvida
170176 }
171177 }
172178
173- private func setReminderToast( _ toast: ToastType ) {
174- appState. system. toast = . init( type: toast) { setSelectedTab ( . settings) }
179+ private func setReminderToast( _ toast: ToastType , _ showButton: Bool ? ) {
180+ var toast = Toast ( type: toast)
181+ if showButton == true {
182+ toast. action = {
183+ setSelectedTab ( . settings)
184+ appState. routing. settingScene. pushToReminder = true
185+ }
186+ }
187+ appState. system. toast = toast
175188 }
176189
177190 private func setBookmarkToast( _ toast: ToastType ) {
@@ -264,7 +277,7 @@ class FakeGlobalUIService: GlobalUIServiceProtocol {
264277 func setSelectedTab( _: TabType ) { }
265278 func setIsErrorAlertPresented( _: Bool ) { }
266279 func setIsMenuOpen( _: Bool ) { }
267- func setToast( _ toast: ToastType ? ) { }
280+ func setToast( _ toast: ToastType ? , showButton : Bool ? = true ) { }
268281
269282 func openEllipsis( for _: TimetableMetadata ) { }
270283 func closeEllipsis( ) { }
0 commit comments