OSDN Git Service
(root)
/
opentween
/
open-tween.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ae6d984
)
TweenMain内のIServiceAccountで代替可能な箇所を置き換える
author
Kimura Youichi
<kim.upsilon@bucyou.net>
Tue, 16 Jan 2024 18:04:53 +0000
(
03:04
+0900)
committer
Kimura Youichi
<kim.upsilon@bucyou.net>
Tue, 16 Jan 2024 19:40:31 +0000
(
04:40
+0900)
OpenTween/Tween.cs
patch
|
blob
|
history
diff --git
a/OpenTween/Tween.cs
b/OpenTween/Tween.cs
index
93c423c
..
ea324c8
100644
(file)
--- a/
OpenTween/Tween.cs
+++ b/
OpenTween/Tween.cs
@@
-114,9
+114,12
@@
namespace OpenTween
private readonly AccountCollection accounts;
#pragma warning disable SA1300
private readonly AccountCollection accounts;
#pragma warning disable SA1300
- private Twitter tw => ((TwitterAccount)this.
accounts.Primary
).Legacy; // AccountCollection への移行用
+ private Twitter tw => ((TwitterAccount)this.
PrimaryAccount
).Legacy; // AccountCollection への移行用
#pragma warning restore SA1300
#pragma warning restore SA1300
+ private ISocialAccount PrimaryAccount
+ => this.accounts.Primary;
+
// Growl呼び出し部
private readonly GrowlHelper gh = new(ApplicationSettings.ApplicationName);
// Growl呼び出し部
private readonly GrowlHelper gh = new(ApplicationSettings.ApplicationName);
@@
-313,7
+316,7
@@
namespace OpenTween
imgazyobizinet.Enabled = this.settings.Common.EnableImgAzyobuziNet;
imgazyobizinet.DisabledInDM = this.settings.Common.ImgAzyobuziNetDisabledInDM;
imgazyobizinet.Enabled = this.settings.Common.EnableImgAzyobuziNet;
imgazyobizinet.DisabledInDM = this.settings.Common.ImgAzyobuziNetDisabledInDM;
- Thumbnail.Services.TonTwitterCom.GetApiConnection = () => this.
tw.Api
.Connection;
+ Thumbnail.Services.TonTwitterCom.GetApiConnection = () => this.
PrimaryAccount
.Connection;
// 画像投稿サービス
this.ImageSelector.Model.InitializeServices(this.tw, this.tw.Configuration);
// 画像投稿サービス
this.ImageSelector.Model.InitializeServices(this.tw, this.tw.Configuration);
@@
-903,7
+906,8
@@
namespace OpenTween
{
if (this.settings.Common.ReadOwnPost)
{
{
if (this.settings.Common.ReadOwnPost)
{
- if (notifyPosts != null && notifyPosts.Length > 0 && notifyPosts.All(x => x.UserId == this.tw.UserId))
+ var primaryUserId = this.PrimaryAccount.UserId;
+ if (notifyPosts != null && notifyPosts.Length > 0 && notifyPosts.All(x => x.UserId == primaryUserId))
return;
}
return;
}
@@
-949,7
+953,7
@@
namespace OpenTween
GrowlHelper.NotifyType nt;
if (this.settings.Common.DispUsername)
{
GrowlHelper.NotifyType nt;
if (this.settings.Common.DispUsername)
{
- title.Append(this.
tw.Usern
ame);
+ title.Append(this.
PrimaryAccount.UserN
ame);
title.Append(" - ");
}
title.Append(" - ");
}
@@
-1007,7
+1011,7
@@
namespace OpenTween
ToolTipIcon ntIcon;
if (this.settings.Common.DispUsername)
{
ToolTipIcon ntIcon;
if (this.settings.Common.DispUsername)
{
- title.Append(this.
tw.Usern
ame);
+ title.Append(this.
PrimaryAccount.UserN
ame);
title.Append(" - ");
}
title.Append(" - ");
}
@@
-2232,7
+2236,7
@@
namespace OpenTween
this.StatusOpenMenuItem.Enabled = true;
this.ShowRelatedStatusesMenuItem.Enabled = true; // PublicSearchの時問題出るかも
this.StatusOpenMenuItem.Enabled = true;
this.ShowRelatedStatusesMenuItem.Enabled = true; // PublicSearchの時問題出るかも
- if (!post.CanRetweetBy(this.
tw
.UserId))
+ if (!post.CanRetweetBy(this.
PrimaryAccount
.UserId))
{
this.ReTweetStripMenuItem.Enabled = false;
this.ReTweetUnofficialStripMenuItem.Enabled = false;
{
this.ReTweetStripMenuItem.Enabled = false;
this.ReTweetUnofficialStripMenuItem.Enabled = false;
@@
-2261,8
+2265,9
@@
namespace OpenTween
if (this.ExistCurrentPost && post != null)
{
if (this.ExistCurrentPost && post != null)
{
- this.DeleteStripMenuItem.Enabled = post.CanDeleteBy(this.tw.UserId);
- if (post.RetweetedByUserId == this.tw.UserId)
+ var primaryUserId = this.PrimaryAccount.UserId;
+ this.DeleteStripMenuItem.Enabled = post.CanDeleteBy(primaryUserId);
+ if (post.RetweetedByUserId == primaryUserId)
this.DeleteStripMenuItem.Text = Properties.Resources.DeleteMenuText2;
else
this.DeleteStripMenuItem.Text = Properties.Resources.DeleteMenuText1;
this.DeleteStripMenuItem.Text = Properties.Resources.DeleteMenuText2;
else
this.DeleteStripMenuItem.Text = Properties.Resources.DeleteMenuText1;
@@
-2282,7
+2287,8
@@
namespace OpenTween
return;
// 選択されたツイートの中に削除可能なものが一つでもあるか
return;
// 選択されたツイートの中に削除可能なものが一つでもあるか
- if (!posts.Any(x => x.CanDeleteBy(this.tw.UserId)))
+ var primaryUserId = this.PrimaryAccount.UserId;
+ if (!posts.Any(x => x.CanDeleteBy(primaryUserId)))
return;
var ret = MessageBox.Show(
return;
var ret = MessageBox.Show(
@@
-2303,7
+2309,7
@@
namespace OpenTween
Exception? lastException = null;
foreach (var post in posts)
{
Exception? lastException = null;
foreach (var post in posts)
{
- if (!post.CanDeleteBy(
this.tw.
UserId))
+ if (!post.CanDeleteBy(
primary
UserId))
continue;
try
continue;
try
@@
-2314,7
+2320,7
@@
namespace OpenTween
}
else
{
}
else
{
- if (post.RetweetedByUserId ==
this.tw.
UserId)
+ if (post.RetweetedByUserId ==
primary
UserId)
{
// 自分が RT したツイート (自分が RT した自分のツイートも含む)
// => RT を取り消し
{
// 自分が RT したツイート (自分が RT した自分のツイートも含む)
// => RT を取り消し
@@
-2322,7
+2328,7
@@
namespace OpenTween
}
else
{
}
else
{
- if (post.UserId ==
this.tw.
UserId)
+ if (post.UserId ==
primary
UserId)
{
if (post.RetweetedId != null)
{
{
if (post.RetweetedId != null)
{
@@
-2681,7
+2687,7
@@
namespace OpenTween
this.TopMost = this.settings.Common.AlwaysTop;
this.SaveConfigsAll(false);
this.TopMost = this.settings.Common.AlwaysTop;
this.SaveConfigsAll(false);
- if (this.
tw
.UserId != previousUserId)
+ if (this.
PrimaryAccount
.UserId != previousUserId)
await this.DoGetFollowersMenu();
}
await this.DoGetFollowersMenu();
}
@@
-3508,9
+3514,10
@@
namespace OpenTween
disableFooter = true;
// 自分宛のリプライの場合は先頭の「@screen_name 」の部分を除去する (in_reply_to_status_id は維持される)
disableFooter = true;
// 自分宛のリプライの場合は先頭の「@screen_name 」の部分を除去する (in_reply_to_status_id は維持される)
- if (this.inReplyTo != null && this.inReplyTo.Value.ScreenName == this.tw.Username)
+ var primaryUserName = this.PrimaryAccount.UserName;
+ if (this.inReplyTo != null && this.inReplyTo.Value.ScreenName == primaryUserName)
{
{
- var mentionSelf = $"@{
this.tw.Usern
ame} ";
+ var mentionSelf = $"@{
primaryUserN
ame} ";
if (statusText.StartsWith(mentionSelf, StringComparison.OrdinalIgnoreCase))
{
if (statusText.Length > mentionSelf.Length || this.GetSelectedImageService() != null)
if (statusText.StartsWith(mentionSelf, StringComparison.OrdinalIgnoreCase))
{
if (statusText.Length > mentionSelf.Length || this.GetSelectedImageService() != null)
@@
-6031,7
+6038,7
@@
namespace OpenTween
this.inReplyTo = null;
}
this.inReplyTo = null;
}
- var selfScreenName = this.
tw.Usern
ame;
+ var selfScreenName = this.
PrimaryAccount.UserN
ame;
var targetScreenNames = new List<string>();
foreach (var post in selectedPosts)
{
var targetScreenNames = new List<string>();
foreach (var post in selectedPosts)
{
@@
-6865,7
+6872,7
@@
namespace OpenTween
}
}
}
}
- if (this.settings.Common.DispUsername) ttl.Append(this.
tw.Usern
ame).Append(" - ");
+ if (this.settings.Common.DispUsername) ttl.Append(this.
PrimaryAccount.UserN
ame).Append(" - ");
ttl.Append(ApplicationSettings.ApplicationName);
ttl.Append(" ");
switch (this.settings.Common.DispLatestPost)
ttl.Append(ApplicationSettings.ApplicationName);
ttl.Append(" ");
switch (this.settings.Common.DispLatestPost)
@@
-7027,7
+7034,7
@@
namespace OpenTween
ur.Remove(0, ur.Length);
if (this.settings.Common.DispUsername)
{
ur.Remove(0, ur.Length);
if (this.settings.Common.DispUsername)
{
- ur.Append(this.
tw.Usern
ame);
+ ur.Append(this.
PrimaryAccount.UserN
ame);
ur.Append(" - ");
}
ur.Append(ApplicationSettings.ApplicationName);
ur.Append(" - ");
}
ur.Append(ApplicationSettings.ApplicationName);
@@
-7996,8
+8003,9
@@
namespace OpenTween
if (this.ExistCurrentPost)
{
var selectedPosts = this.CurrentTab.SelectedPosts;
if (this.ExistCurrentPost)
{
var selectedPosts = this.CurrentTab.SelectedPosts;
+ var primaryUserId = this.PrimaryAccount.UserId;
- if (selectedPosts.Any(x => !x.CanRetweetBy(
this.tw.
UserId)))
+ if (selectedPosts.Any(x => !x.CanRetweetBy(
primary
UserId)))
{
if (selectedPosts.Any(x => x.IsProtect))
MessageBox.Show("Protected.");
{
if (selectedPosts.Any(x => x.IsProtect))
MessageBox.Show("Protected.");
@@
-8338,7
+8346,7
@@
namespace OpenTween
try
{
try
{
- var task = this.tw.Api.FriendshipsShow(this.
tw.Usern
ame, id);
+ var task = this.tw.Api.FriendshipsShow(this.
PrimaryAccount.UserN
ame, id);
var friendship = await dialog.WaitForAsync(this, task);
isFollowing = friendship.Relationship.Source.Following;
var friendship = await dialog.WaitForAsync(this, task);
isFollowing = friendship.Relationship.Source.Following;
@@
-8388,7
+8396,7
@@
namespace OpenTween
try
{
try
{
- var task = this.tw.Api.FriendshipsShow(this.
tw.Usern
ame, id);
+ var task = this.tw.Api.FriendshipsShow(this.
PrimaryAccount.UserN
ame, id);
var friendship = await dialog.WaitForAsync(this, task);
isFollowing = friendship.Relationship.Source.Following;
var friendship = await dialog.WaitForAsync(this, task);
isFollowing = friendship.Relationship.Source.Following;
@@
-8448,7
+8456,7
@@
namespace OpenTween
}
private async void OwnStatusMenuItem_Click(object sender, EventArgs e)
}
private async void OwnStatusMenuItem_Click(object sender, EventArgs e)
- => await this.DoShowUserStatus(this.
tw.Usern
ame, false);
+ => await this.DoShowUserStatus(this.
PrimaryAccount.UserN
ame, false);
// TwitterIDでない固定文字列を調べる(文字列検証のみ 実際に取得はしない)
// URLから切り出した文字列を渡す
// TwitterIDでない固定文字列を調べる(文字列検証のみ 実際に取得はしない)
// URLから切り出した文字列を渡す
@@
-8789,7
+8797,7
@@
namespace OpenTween
this.OpenStatusOpMenuItem.Enabled = true;
this.ShowRelatedStatusesMenuItem2.Enabled = true; // PublicSearchの時問題出るかも
this.OpenStatusOpMenuItem.Enabled = true;
this.ShowRelatedStatusesMenuItem2.Enabled = true; // PublicSearchの時問題出るかも
- if (!post.CanRetweetBy(this.
tw
.UserId))
+ if (!post.CanRetweetBy(this.
PrimaryAccount
.UserId))
{
this.RtOpMenuItem.Enabled = false;
this.RtUnOpMenuItem.Enabled = false;
{
this.RtOpMenuItem.Enabled = false;
this.RtUnOpMenuItem.Enabled = false;
@@
-8826,7
+8834,7
@@
namespace OpenTween
if (this.ExistCurrentPost && post != null)
{
if (this.ExistCurrentPost && post != null)
{
- this.DelOpMenuItem.Enabled = post.CanDeleteBy(this.
tw
.UserId);
+ this.DelOpMenuItem.Enabled = post.CanDeleteBy(this.
PrimaryAccount
.UserId);
}
}
}
}
@@
-9268,7
+9276,7
@@
namespace OpenTween
}
private async void OpenOwnHomeMenuItem_Click(object sender, EventArgs e)
}
private async void OpenOwnHomeMenuItem_Click(object sender, EventArgs e)
- => await MyCommon.OpenInBrowserAsync(this, MyCommon.TwitterUrl + this.
tw.Usern
ame);
+ => await MyCommon.OpenInBrowserAsync(this, MyCommon.TwitterUrl + this.
PrimaryAccount.UserN
ame);
private bool ExistCurrentPost
{
private bool ExistCurrentPost
{