herzbube / littlego

Little Go. An iOS application that lets you play the game of Go on the iPhone or iPad.
https://littlego.herzbube.ch/
Apache License 2.0
139 stars 54 forks source link

CommandProcessor should post "long running action" notifications #118

Open herzbube opened 11 years ago

herzbube commented 11 years ago

Currently every command implements its own handling for "long running action". This generally includes

It would be cleaner to implement this handling in CommandProcessor.

herzbube commented 11 years ago

A simple solution is to create a marker protocol (e.g. LongRunningAction) that can be adopted by commands that want to support "long running actions". When CommandProcessor detects the protocol it posts the start/end notifications before/after command execution begins/ends. Command execution is surrounded with @try/@catch.

One possible problem could be that some commands (LoadGameCommand?) may not execute all their parts entirely synchronously.