@@ -57,10 +57,12 @@ public ChannelsConfigViewModel(
5757 Status = new ReactiveProperty < ConfigStatusMessage > ( new ConfigStatusMessage ( string . Empty , ConfigStatusTone . Neutral ) ) ;
5858 Step = new ChannelPickerStepViewModel ( slackProbe , discordProbe )
5959 {
60- DoneActionText = "channel settings " ,
61- DoneKeyActionLabel = "Apply " ,
62- DoneKey = ConsoleKey . S ,
60+ DoneActionText = "return to Settings Areas " ,
61+ DoneKeyActionLabel = "Done " ,
62+ DoneKey = ConsoleKey . D ,
6363 ShowDoneAction = false ,
64+ ShowDonePickerRow = true ,
65+ DonePickerRowLabel = "Done adding channels" ,
6466 PreserveDisabledAdapterDrafts = true
6567 } ;
6668 _context = new WizardContext
@@ -211,7 +213,7 @@ internal async Task<bool> SaveFromInputAsync(CancellationToken ct = default)
211213
212214 internal bool TryOpenSelectedAdapterManagement ( )
213215 {
214- if ( ! Step . IsInPickerMode )
216+ if ( ! Step . IsInPickerMode || ! Step . IsAdapterRowSelected )
215217 return false ;
216218
217219 var type = Step . SelectedAdapterType ;
@@ -224,7 +226,7 @@ internal bool TryOpenSelectedAdapterManagement()
224226
225227 internal bool TryToggleSelectedAdapterFromPicker ( )
226228 {
227- if ( ! Step . IsInPickerMode )
229+ if ( ! Step . IsInPickerMode || ! Step . IsAdapterRowSelected )
228230 return false ;
229231
230232 var type = Step . SelectedAdapterType ;
@@ -371,7 +373,8 @@ internal IReadOnlyList<ChannelPermissionRow> GetChannelRows(bool includeAddActio
371373 FormatChannelLabel ( _activeAdapterType , channelId ) ,
372374 GetChannelAudience ( _activeAdapterType , channelId , DefaultChannelAudience ( ) ) ,
373375 IsDirectMessage : false ,
374- IsAddAction : false ) ) ;
376+ IsAddAction : false ,
377+ IsDoneAction : false ) ) ;
375378 }
376379
377380 if ( GetAllowDirectMessages ( _activeAdapterType ) )
@@ -381,7 +384,8 @@ internal IReadOnlyList<ChannelPermissionRow> GetChannelRows(bool includeAddActio
381384 "Direct messages" ,
382385 GetChannelAudience ( _activeAdapterType , "dm" , DefaultDirectMessageAudience ( ) ) ,
383386 IsDirectMessage : true ,
384- IsAddAction : false ) ) ;
387+ IsAddAction : false ,
388+ IsDoneAction : false ) ) ;
385389 }
386390
387391 if ( includeAddAction )
@@ -391,7 +395,15 @@ internal IReadOnlyList<ChannelPermissionRow> GetChannelRows(bool includeAddActio
391395 "+ Add channel" ,
392396 DefaultChannelAudience ( ) ,
393397 IsDirectMessage : false ,
394- IsAddAction : true ) ) ;
398+ IsAddAction : true ,
399+ IsDoneAction : false ) ) ;
400+ rows . Add ( new ChannelPermissionRow (
401+ string . Empty ,
402+ "Done adding channels" ,
403+ DefaultChannelAudience ( ) ,
404+ IsDirectMessage : false ,
405+ IsAddAction : false ,
406+ IsDoneAction : true ) ) ;
395407 }
396408
397409 if ( _channelRowIndex >= rows . Count )
@@ -419,6 +431,12 @@ internal void OpenSelectedChannelAudience()
419431 return ;
420432 }
421433
434+ if ( row . IsDoneAction )
435+ {
436+ FinishChannelPermissions ( ) ;
437+ return ;
438+ }
439+
422440 _editingAudienceId = row . Id ;
423441 _editingAudienceLabel = row . DisplayName ;
424442 _editingAudienceIsDm = row . IsDirectMessage ;
@@ -434,7 +452,7 @@ internal void ChangeSelectedChannelAudience(int delta)
434452 return ;
435453
436454 var row = rows [ _channelRowIndex ] ;
437- if ( row . IsAddAction )
455+ if ( row . IsAction )
438456 return ;
439457
440458 var currentIndex = AudienceIndex ( row . Audience ) ;
@@ -450,7 +468,7 @@ internal void RemoveSelectedChannel()
450468 return ;
451469
452470 var row = rows [ _channelRowIndex ] ;
453- if ( row . IsAddAction || row . IsDirectMessage )
471+ if ( row . IsAction || row . IsDirectMessage )
454472 return ;
455473
456474 var remaining = GetChannelIds ( _activeAdapterType )
@@ -502,12 +520,22 @@ internal void ApplyAddChannel()
502520 SetChannelIds ( _activeAdapterType , [ .. existing , channelId ] ) ;
503521 SetChannelAudience ( _activeAdapterType , channelId , AudienceOptions [ _audienceSelectionIndex ] ) ;
504522 UpdateAdapterPickerSummary ( _activeAdapterType ) ;
505- _channelRowIndex = Math . Max ( GetChannelRows ( ) . Count - 2 , 0 ) ;
523+ _channelRowIndex = GetChannelRows ( )
524+ . Select ( ( row , index ) => ( row , index ) )
525+ . Single ( entry => string . Equals ( entry . row . Id , channelId , StringComparison . Ordinal ) )
526+ . index ;
506527 Screen . Value = ChannelsConfigScreen . ChannelPermissions ;
507528 AutosaveCompletedAction ( $ "Added { channelId } and saved.") ;
508529 NotifyContentChanged ( ) ;
509530 }
510531
532+ internal void FinishChannelPermissions ( )
533+ {
534+ Screen . Value = ChannelsConfigScreen . AdapterMenu ;
535+ Status . Value = new ConfigStatusMessage ( "Done adding channels. Completed changes are already saved." , ConfigStatusTone . Neutral ) ;
536+ NotifyContentChanged ( ) ;
537+ }
538+
511539 internal string ? EditingAudienceLabel => _editingAudienceLabel ;
512540 internal string ? EditingAudienceId => _editingAudienceId ;
513541 internal bool EditingAudienceIsDm => _editingAudienceIsDm ;
@@ -1456,7 +1484,11 @@ internal sealed record ChannelPermissionRow(
14561484 string DisplayName ,
14571485 TrustAudience Audience ,
14581486 bool IsDirectMessage ,
1459- bool IsAddAction ) ;
1487+ bool IsAddAction ,
1488+ bool IsDoneAction )
1489+ {
1490+ internal bool IsAction => IsAddAction || IsDoneAction ;
1491+ }
14601492
14611493internal sealed record CredentialFieldSpec (
14621494 string Key ,
0 commit comments