@@ -18,23 +18,21 @@ type FocusAfterMoveEnum = 'focusBlockMoved' | 'focusActionPanel';
1818
1919export default class ProgramChangeController {
2020 app : App ;
21- intl : IntlShape ;
2221 audioManager : AudioManager ;
2322 announcementBuilder : AnnouncementBuilder ;
2423
25- constructor ( app : App , intl : IntlShape , audioManager : AudioManager ) {
24+ constructor ( app : App , audioManager : AudioManager ) {
2625 this . app = app ;
27- this . intl = intl ;
2826 this . audioManager = audioManager ;
2927 this . announcementBuilder = new AnnouncementBuilder ( ) ;
3028 }
3129
3230 insertSelectedActionIntoProgram ( programBlockEditor : ?ProgramBlockEditor ,
33- index : number , selectedAction : ?CommandName ) {
31+ index : number , selectedAction : ?CommandName , intl : IntlShape ) {
3432
3533 this . app . setState ( ( state ) => {
3634 if ( selectedAction ) {
37- this . playAnnouncementForAdd ( selectedAction ) ;
35+ this . playAnnouncementForAdd ( selectedAction , intl ) ;
3836 this . doActivitiesForAdd ( programBlockEditor , index ) ;
3937 return {
4038 programSequence : state . programSequence . insertStep ( index ,
@@ -47,11 +45,11 @@ export default class ProgramChangeController {
4745 }
4846
4947 addSelectedActionToProgramEnd ( programBlockEditor : ?ProgramBlockEditor ,
50- selectedAction : ?CommandName ) {
48+ selectedAction : ?CommandName , intl : IntlShape ) {
5149
5250 this . app . setState ( ( state ) => {
5351 if ( selectedAction ) {
54- this . playAnnouncementForAdd ( selectedAction ) ;
52+ this . playAnnouncementForAdd ( selectedAction , intl ) ;
5553 const index = state . programSequence . getProgramLength ( ) ;
5654 this . doActivitiesForAdd ( programBlockEditor , index ) ;
5755 return {
@@ -65,17 +63,17 @@ export default class ProgramChangeController {
6563 }
6664
6765 deleteProgramStep ( programBlockEditor : ?ProgramBlockEditor ,
68- index : number , command : string ) {
66+ index : number , command : string , intl : IntlShape ) {
6967
7068 this . app . setState ( ( state ) => {
7169 // Check that the step to delete hasn't changed since the
7270 // user made the deletion
7371 const currentStep = state . programSequence . getProgramStepAt ( index ) ;
7472 if ( command === currentStep . block ) {
7573 // Play the announcement
76- const announcementData = this . announcementBuilder . buildDeleteStepAnnouncement ( currentStep , this . intl ) ;
74+ const announcementData = this . announcementBuilder . buildDeleteStepAnnouncement ( currentStep , intl ) ;
7775 this . audioManager . playAnnouncement ( announcementData . messageIdSuffix ,
78- this . intl , announcementData . values ) ;
76+ intl , announcementData . values ) ;
7977
8078 if ( programBlockEditor ) {
8179 // If there are steps following the one being deleted, focus
@@ -115,19 +113,19 @@ export default class ProgramChangeController {
115113 }
116114
117115 replaceProgramStep ( programBlockEditor : ?ProgramBlockEditor ,
118- index : number , selectedAction : ?CommandName ) {
116+ index : number , selectedAction : ?CommandName , intl : IntlShape ) {
119117
120118 this . app . setState ( ( state ) => {
121119 const currentStep = state . programSequence . getProgramStepAt ( index ) ;
122120 if ( isLoopBlock ( currentStep . block ) ) {
123- this . audioManager . playAnnouncement ( 'cannotReplaceLoopBlocks' , this . intl ) ;
121+ this . audioManager . playAnnouncement ( 'cannotReplaceLoopBlocks' , intl ) ;
124122 return { } ;
125123 } else if ( selectedAction ) {
126124 // Play the announcement
127125 const announcementData = this . announcementBuilder . buildReplaceStepAnnouncement (
128- currentStep , selectedAction , this . intl ) ;
126+ currentStep , selectedAction , intl ) ;
129127 this . audioManager . playAnnouncement ( announcementData . messageIdSuffix ,
130- this . intl , announcementData . values ) ;
128+ intl , announcementData . values ) ;
131129
132130 // Set up focus, scrolling, and animation
133131 if ( programBlockEditor ) {
@@ -140,15 +138,15 @@ export default class ProgramChangeController {
140138 programSequence : state . programSequence . overwriteStep ( index , selectedAction )
141139 } ;
142140 } else {
143- this . audioManager . playAnnouncement ( 'noActionSelected' , this . intl ) ;
141+ this . audioManager . playAnnouncement ( 'noActionSelected' , intl ) ;
144142 return { } ;
145143 }
146144 } ) ;
147145 }
148146
149147 moveProgramStepNext ( programBlockEditor : ?ProgramBlockEditor ,
150148 indexFrom : number , commandAtIndexFrom : string ,
151- focusAfterMove : FocusAfterMoveEnum ) {
149+ focusAfterMove : FocusAfterMoveEnum , intl : IntlShape ) {
152150
153151 this . app . setState ( ( state ) => {
154152 // Check that the step at indexFrom has not changed
@@ -157,11 +155,11 @@ export default class ProgramChangeController {
157155 if ( state . programSequence . moveToNextStepDisabled ( indexFrom ) ) {
158156 // Move next is not possible:
159157 // Play an announcement and do not change the program
160- this . audioManager . playAnnouncement ( 'cannotMoveNext' , this . intl ) ;
158+ this . audioManager . playAnnouncement ( 'cannotMoveNext' , intl ) ;
161159 return { } ;
162160 } else {
163161 // Play the announcement
164- this . audioManager . playAnnouncement ( 'moveToNext' , this . intl ) ;
162+ this . audioManager . playAnnouncement ( 'moveToNext' , intl ) ;
165163
166164 return this . doMove (
167165 programBlockEditor ,
@@ -181,7 +179,7 @@ export default class ProgramChangeController {
181179
182180 moveProgramStepPrevious ( programBlockEditor : ?ProgramBlockEditor ,
183181 indexFrom : number , commandAtIndexFrom : string ,
184- focusAfterMove : FocusAfterMoveEnum ) {
182+ focusAfterMove : FocusAfterMoveEnum , intl : IntlShape ) {
185183
186184 this . app . setState ( ( state ) => {
187185 // Check that the step at indexFrom has not changed
@@ -190,11 +188,11 @@ export default class ProgramChangeController {
190188 if ( state . programSequence . moveToPreviousStepDisabled ( indexFrom ) ) {
191189 // Move previous is not possible:
192190 // Play an announcement and do not change the program
193- this . audioManager . playAnnouncement ( 'cannotMovePrevious' , this . intl ) ;
191+ this . audioManager . playAnnouncement ( 'cannotMovePrevious' , intl ) ;
194192 return { } ;
195193 } else {
196194 // Play the announcement
197- this . audioManager . playAnnouncement ( 'moveToPrevious' , this . intl ) ;
195+ this . audioManager . playAnnouncement ( 'moveToPrevious' , intl ) ;
198196
199197 return this . doMove (
200198 programBlockEditor ,
@@ -214,10 +212,10 @@ export default class ProgramChangeController {
214212
215213 // Internal methods
216214
217- playAnnouncementForAdd ( action : string ) {
218- const announcementData = this . announcementBuilder . buildAddStepAnnouncement ( action , this . intl ) ;
215+ playAnnouncementForAdd ( action : string , intl : IntlShape ) {
216+ const announcementData = this . announcementBuilder . buildAddStepAnnouncement ( action , intl ) ;
219217 this . audioManager . playAnnouncement ( announcementData . messageIdSuffix ,
220- this . intl , announcementData . values ) ;
218+ intl , announcementData . values ) ;
221219 }
222220
223221 doActivitiesForAdd ( programBlockEditor : ?ProgramBlockEditor , index : number ) {
0 commit comments