Skip to content

Commit

Permalink
メインアカウントに設定できるアカウントの種類をTwitterアカウントのみに制限
Browse files Browse the repository at this point in the history
  • Loading branch information
upsilon committed Jun 10, 2024
1 parent 62d8819 commit 3403fbb
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- 投稿欄やふぁぼ・RT等の機能も表示中のタブに連動して使用するアカウントが変わります
- 現時点ではメインアカウント以外のタブ設定は次回起動時に保持されません
* NEW: Misskeyアカウントのホームタイムライン表示・投稿に対応しました
- 現時点では Misskey アカウントをメインに設定することはできません
- MFMの表示には対応していません
* NEW: Twemoji 15.1.0 に対応しました
- Unicode 15.1 で追加された絵文字が表示されるようになります
Expand Down
9 changes: 9 additions & 0 deletions OpenTween/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions OpenTween/Properties/Resources.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>

<data name="AccountListBox_MakePrimaryError"><value>Only a Twitter account can be set as primary.</value></data>
<data name="AccountListBoxItem_Disabled"><value>(Disabled)</value></data>
<data name="AccountListBoxItem_Primary"><value>(Primary)</value></data>
<data name="AccountTypeErrorText"><value>This feature is not available for current account.</value></data>
Expand Down
1 change: 1 addition & 0 deletions OpenTween/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

<data name="AccountListBox_MakePrimaryError"><value>メインに設定できるのはTwitterアカウントのみです</value></data>
<data name="AccountListBoxItem_Disabled"><value>(無効)</value></data>
<data name="AccountListBoxItem_Primary"><value>(メイン)</value></data>
<data name="AccountTypeErrorText"><value>この機能は現在のアカウントでは使用できません</value></data>
Expand Down
18 changes: 16 additions & 2 deletions OpenTween/Setting/Panel/BasedPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,20 @@ private void RemoveAccountAt(int index)

private void MakeAccountPrimaryAt(int index)
{
var selectedListItem = this.AccountsList[index];
if (selectedListItem.AccountSettings.AccountType != "Twitter")
{
// 現時点での制約として Twitter アカウント以外はメインに設定できない
MessageBox.Show(
this,
Properties.Resources.AccountListBox_MakePrimaryError,
ApplicationSettings.ApplicationName,
MessageBoxButtons.OK,
MessageBoxIcon.Warning
);
return;
}

var oldPrimaryIndex = this.AccountsList.FindIndex(x => x.IsPrimary);
if (oldPrimaryIndex != -1)
{
Expand All @@ -181,10 +195,10 @@ private void MakeAccountPrimaryAt(int index)
}

// Disabled になっていたら強制的に解除する
this.AccountsList[index].AccountSettings.Disabled = false;
selectedListItem.AccountSettings.Disabled = false;

this.AccountsList[index] =
this.AccountsList[index] with { IsPrimary = true };
selectedListItem with { IsPrimary = true };
}

private void ToggleAccountDisabledAt(int index)
Expand Down

0 comments on commit 3403fbb

Please sign in to comment.