package Ġcom . sum era . sample . ui . wait until Ċ Ċ import Ġcom . sum era . core actor . Core actor Ċ import Ġcom . sum era . core actor . contract . action . Action Ċ import Ġcom . sum era . sample . ui . wait until . contract . Confirm Action Ċ import Ġcom . sum era . sample . ui . wait until . contract . Enable Confirm Buttons Reducer Ċ import Ġcom . sum era . sample . ui . wait until . contract . Enable Second Button Reducer Ċ import Ġcom . sum era . sample . ui . wait until . contract . Enable Third Button Reducer Ċ import Ġcom . sum era . sample . ui . wait until . contract . First Button Clicked Ċ import Ġcom . sum era . sample . ui . wait until . contract . Second Button Clicked Ċ import Ġcom . sum era . sample . ui . wait until . contract . Set Completed State Reducer Ċ import Ġcom . sum era . sample . ui . wait until . contract . Set InitialState Reducer Ċ import Ġcom . sum era . sample . ui . wait until . contract . Third Button Clicked Ċ import Ġcom . sum era . sample . ui . wait until . contract . Wait Until State Ċ import Ġkotlinx . coroutines . launch Ċ Ċ class ĠWait Until Core actor Ġ: ĠCore actor < Wait Until State >() Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġcreate InitialState () Ġ= ĠWait Until State ( ĊĠĠĠĠĠĠĠ Ġis First Button Enabled Ġ= Ġtrue , ĊĠĠĠĠĠĠĠ Ġis Second Button Enabled Ġ= Ġfalse , ĊĠĠĠĠĠĠĠ Ġis Third Button Enabled Ġ= Ġfalse , ĊĠĠĠĠĠĠĠ Ġis Confirm Enabled Ġ= Ġfalse , ĊĠĠĠĠĠĠĠ Ġis Completed Ġ= Ġfalse ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġoverride Ġfun Ġon Action ( action : ĠAction < Wait Until State >) Ġ{ ĊĠĠĠĠĠĠĠ Ġwhen Ġ( action ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠFirst Button Clicked Ġ-> Ġlaunch Ġ{ ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġemit Ġ{ ĠEnable Second Button Reducer Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwait Until Action Ġ{ Ġit Ġis ĠSecond Button Clicked Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġemit Ġ{ ĠEnable Third Button Reducer Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwait Until Action Ġ{ Ġit Ġis ĠThird Button Clicked Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġemit Ġ{ ĠEnable Confirm Buttons Reducer Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġconfirm Action Ġ= Ġwait Until ActionType < Confirm Action >() ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( confirm Action . confirmed ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġemit Ġ{ ĠSet Completed State Reducer Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġemit Ġ{ ĠSet InitialState Reducer Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ