@@ -22,7 +22,7 @@ import Foundation
2222import DataSource
2323import Observation
2424
25- @MainActor @Observable public final class ExtraMenu {
25+ @MainActor @Observable public final class ExtraMenu : Composable {
2626 private let appStateClient : AppStateClient
2727 private let executeClient : ExecuteClient
2828 private let nsAppClient : NSAppClient
@@ -36,12 +36,14 @@ import Observation
3636 public var shiftPatterns : [ ShiftPattern ]
3737 public var hideIcons : Bool
3838 public var canChecksForUpdates : Bool
39+ public let action : ( Action ) async -> Void
3940
4041 public init (
4142 _ appDependencies: AppDependencies ,
4243 shiftPatterns: [ ShiftPattern ] = [ ] ,
4344 hideIcons: Bool = false ,
44- canChecksForUpdates: Bool = false
45+ canChecksForUpdates: Bool = false ,
46+ action: @escaping ( Action ) async -> Void = { _ in }
4547 ) {
4648 self . appStateClient = appDependencies. appStateClient
4749 self . executeClient = appDependencies. executeClient
@@ -53,9 +55,10 @@ import Observation
5355 self . shiftPatterns = shiftPatterns
5456 self . hideIcons = ( try ? executeClient. checkIconsVisible ( ) ) ?? hideIcons
5557 self . canChecksForUpdates = canChecksForUpdates
58+ self . action = action
5659 }
5760
58- public func send ( _ action: Action ) async {
61+ public func reduce ( _ action: Action ) async {
5962 switch action {
6063 case let . task( screenName) :
6164 logService. notice ( . screenView( name: screenName) )
@@ -77,9 +80,7 @@ import Observation
7780 }
7881
7982 case let . shiftPatternButtonTapped( shiftType) :
80- await Task { @MainActor [ shiftService] in
81- await shiftService. shiftWindow ( shiftType: shiftType)
82- } . value
83+ await shiftService. shiftWindow ( shiftType: shiftType)
8384
8485 case let . hideDesktopIconsButtonTapped( isOn) :
8586 do {
@@ -112,7 +113,7 @@ import Observation
112113 self . canChecksForUpdates = canChecksForUpdates
113114 }
114115
115- public enum Action {
116+ public enum Action : Sendable {
116117 case task( String )
117118 case shiftPatternButtonTapped( ShiftType )
118119 case hideDesktopIconsButtonTapped( Bool )
0 commit comments