@@ -7,6 +7,7 @@ import Environment
77import Foundation
88import Preferences
99import SwiftUI
10+ import Toast
1011import XcodeInspector
1112
1213public struct WidgetFeature : ReducerProtocol {
@@ -32,6 +33,8 @@ public struct WidgetFeature: ReducerProtocol {
3233 var focusingDocumentURL : URL ?
3334 public var colorScheme : ColorScheme = . light
3435
36+ public var toast = Toast . State ( )
37+
3538 // MARK: Panels
3639
3740 public var panelState = PanelFeature . State ( )
@@ -120,6 +123,7 @@ public struct WidgetFeature: ReducerProtocol {
120123 case updateWindowOpacityFinished
121124 case updateKeyWindow( WindowCanBecomeKey )
122125
126+ case toast( Toast . Action )
123127 case panel( PanelFeature . Action )
124128 case chatPanel( ChatPanelFeature . Action )
125129 case circularWidget( CircularWidgetFeature . Action )
@@ -143,6 +147,10 @@ public struct WidgetFeature: ReducerProtocol {
143147 public init ( ) { }
144148
145149 public var body : some ReducerProtocol < State , Action > {
150+ Scope ( state: \. toast, action: / Action. toast) {
151+ Toast ( )
152+ }
153+
146154 Scope ( state: \. _circularWidgetState, action: / Action. circularWidget) {
147155 CircularWidgetFeature ( )
148156 }
@@ -227,11 +235,14 @@ public struct WidgetFeature: ReducerProtocol {
227235 switch action {
228236 case . startup:
229237 return . merge(
230- . run { send in await send ( . observeActiveApplicationChange) } ,
231- . run { send in await send ( . observeCompletionPanelChange) } ,
232- . run { send in await send ( . observeFullscreenChange) } ,
233- . run { send in await send ( . observeColorSchemeChange) } ,
234- . run { send in await send ( . observePresentationModeChange) }
238+ . run { send in
239+ await send ( . toast( . start) )
240+ await send ( . observeActiveApplicationChange)
241+ await send ( . observeCompletionPanelChange)
242+ await send ( . observeFullscreenChange)
243+ await send ( . observeColorSchemeChange)
244+ await send ( . observePresentationModeChange)
245+ }
235246 )
236247
237248 case . observeActiveApplicationChange:
@@ -628,6 +639,9 @@ public struct WidgetFeature: ReducerProtocol {
628639 await windows. sharedPanelWindow. makeKeyAndOrderFront ( nil )
629640 }
630641 }
642+
643+ case . toast:
644+ return . none
631645
632646 case . circularWidget:
633647 return . none
0 commit comments