Skip to content

Commit

Permalink
設定画面で削除されたアカウントのタブを連動して削除する
Browse files Browse the repository at this point in the history
  • Loading branch information
upsilon committed Jun 9, 2024
1 parent ddc0046 commit 4239ace
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions OpenTween/Tween.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2593,6 +2593,7 @@ private async void SettingStripMenuItem_Click(object sender, EventArgs e)
var newSecondaryAccounts = currentSecondaryAccounts
.Where(x => !previousSecondaryAccounts.Any(y => y.UniqueKey == x.UniqueKey));
this.AddSecondaryAccountTabs(newSecondaryAccounts);
this.RemoveMissingAccountTabs();
}

private void AddSecondaryAccountTabs(IEnumerable<ISocialAccount> accounts)
Expand All @@ -2612,6 +2613,19 @@ private void AddSecondaryAccountTabs(IEnumerable<ISocialAccount> accounts)
}
}

private void RemoveMissingAccountTabs()
{
var secondaryAccounts = this.accounts.SecondaryAccounts;
var secondaryAccountTabs = this.statuses.GetTabsByType<HomeSpecifiedAccountTabModel>();

foreach (var tab in secondaryAccountTabs)
{
var isAccountExists = secondaryAccounts.Any(x => x.UniqueKey == tab.SourceAccountId);
if (!isAccountExists)
this.RemoveSpecifiedTab(tab.TabName, confirm: false);
}
}

/// <summary>
/// タブの表示位置を設定する
/// </summary>
Expand Down

0 comments on commit 4239ace

Please sign in to comment.