}
}
- this.CreatePostsFromJson(statuses, MyCommon.WORKERTYPE.Timeline, tab, firstLoad);
+ this.CreatePostsFromJson(statuses, tab, firstLoad);
}
public async Task GetMentionsTimelineApi(MentionsTabModel tab, bool more, bool firstLoad)
}
}
- this.CreatePostsFromJson(statuses, MyCommon.WORKERTYPE.Reply, tab, firstLoad);
+ this.CreatePostsFromJson(statuses, tab, firstLoad);
}
public async Task GetUserTimelineApi(UserTimelineTabModel tab, bool more, bool firstLoad)
}
}
- this.CreatePostsFromJson(statuses, MyCommon.WORKERTYPE.UserTimeline, tab, firstLoad);
+ this.CreatePostsFromJson(statuses, tab, firstLoad);
}
public async Task<PostClass> GetStatusApi(TwitterStatusId id, bool firstLoad = false)
return post;
}
- private void CreatePostsFromJson(TwitterStatus[] items, MyCommon.WORKERTYPE gType, TabModel? tab, bool firstLoad)
+ private void CreatePostsFromJson(TwitterStatus[] items, TabModel tab, bool firstLoad)
{
var posts = items.Select(x => this.CreatePostsFromStatusData(x, firstLoad)).ToArray();
TwitterPostFactory.AdjustSortKeyForPromotedPost(posts);
- foreach (var post in posts)
+ if (tab is not UserTimelineTabModel)
{
- // 二重取得回避
- lock (this.lockObj)
- {
- var id = post.StatusId;
- if (tab == null)
- {
- if (TabInformations.GetInstance().ContainsKey(id)) continue;
- }
- else
- {
- if (tab.Contains(id)) continue;
- }
- }
-
- // RT禁止ユーザーによるもの
- if (gType != MyCommon.WORKERTYPE.UserTimeline &&
- post.RetweetedByUserId != null && this.noRTId.Contains(post.RetweetedByUserId.Value)) continue;
-
- if (tab != null && tab is InternalStorageTabModel)
- tab.AddPostQueue(post);
- else
- TabInformations.GetInstance().AddPost(post);
+ // RT 禁止ユーザーによる RT を除外
+ posts = posts.Where(
+ x => x.RetweetedByUserId == null || this.noRTId.Contains(x.RetweetedByUserId.Value)
+ ).ToArray();
}
- }
-
- private void CreatePostsFromSearchJson(TwitterStatus[] statuses, PublicSearchTabModel tab, bool firstLoad)
- {
- var posts = statuses.Select(x => this.CreatePostsFromStatusData(x, firstLoad)).ToArray();
-
- TwitterPostFactory.AdjustSortKeyForPromotedPost(posts);
foreach (var post in posts)
{
- // 二重取得回避
- lock (this.lockObj)
- {
- if (tab.Contains(post.StatusId))
- continue;
- }
-
- tab.AddPostQueue(post);
- }
- }
-
- private void CreateFavoritePostsFromJson(TwitterStatus[] items, bool firstLoad)
- {
- var favTab = TabInformations.GetInstance().FavoriteTab;
-
- foreach (var status in items)
- {
- var statusId = new TwitterStatusId(status.IdStr);
-
- // 二重取得回避
- lock (this.lockObj)
- {
- if (favTab.Contains(statusId))
- continue;
- }
-
- var post = this.CreatePostsFromStatusData(status, firstLoad, favTweet: true);
-
- TabInformations.GetInstance().AddPost(post);
+ if (tab is InternalStorageTabModel)
+ tab.AddPostQueue(post);
+ else
+ TabInformations.GetInstance().AddPost(post);
}
}
}
}
- this.CreatePostsFromJson(statuses, MyCommon.WORKERTYPE.List, tab, firstLoad);
+ this.CreatePostsFromJson(statuses, tab, firstLoad);
}
/// <summary>
if (!TabInformations.GetInstance().ContainsTab(tab))
return;
- this.CreatePostsFromSearchJson(statuses, tab, firstLoad);
+ this.CreatePostsFromJson(statuses, tab, firstLoad);
}
public async Task GetDirectMessageEvents(DirectMessagesTabModel dmTab, bool backward, bool firstLoad)
}
}
- this.CreateFavoritePostsFromJson(statuses, firstLoad);
+ this.CreatePostsFromJson(statuses, tab, firstLoad);
}
/// <summary>