-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: skip failing test, move to action executor
- Loading branch information
1 parent
d9790ea
commit 888fd40
Showing
5 changed files
with
52 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Foundation | ||
import AppKit | ||
|
||
class ActionExecutor { | ||
private let queue: DispatchQueue | ||
|
||
init(queue: DispatchQueue = DispatchQueue(label: "com.MiniSim.ActionExecutor")) { | ||
self.queue = queue | ||
} | ||
|
||
func execute( | ||
device: Device, | ||
commandTag: SubMenuItems.Tags, | ||
itemName: String | ||
) { | ||
let action: Action | ||
|
||
switch device.platform { | ||
case .android: | ||
action = AndroidActionFactory.createAction( | ||
for: commandTag, | ||
device: device, | ||
itemName: itemName | ||
) | ||
case .ios: | ||
action = IOSActionFactory.createAction( | ||
for: commandTag, | ||
device: device, | ||
itemName: itemName | ||
) | ||
} | ||
|
||
if action.showQuestionDialog() { | ||
return | ||
} | ||
|
||
queue.async { | ||
do { | ||
try action.execute() | ||
} catch { | ||
NSAlert.showError(message: error.localizedDescription) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters