seven332 / Nimingban

[DEPRECATED] A Nimingban Client
Apache License 2.0
309 stars 51 forks source link

模仿蘆葦島提供時間線屏蔽的可能性 #98

Open WUGqnwvMQPzl opened 5 years ago

WUGqnwvMQPzl commented 5 years ago

今天有很多人抱怨LOL相關內容霸佔時間線的問題,說到蘆葦島有時間線屏蔽的功能

不知道能不能在紫島裏也提供這一功能

我目前的想法是直接利用紫島的板塊隱藏功能,在 ListActivity 下手,檢測某個板塊是否隱藏,然後屏蔽某個板塊的串:

while (postIterator.hasNext()) {
    Post post = postIterator.next();
    // 獲取串所發表的板塊
    ACForumRaw postForum = DB.getACForumForForumid(post.getNMBFid());
    // 然後檢查是否屬於隱藏狀態
    // 檢查 postForum 是否爲 null,是因爲前面的方法可能會拋出空指針
    boolean flag = postForum != null && !postForum.getVisibility();
    if (PostIgnoreUtils.INSTANCE.checkPostIgnored(post.getNMBPostId()) || flag)
        postIterator.remove();
}

在下測試時基本沒什麼問題,不過可能長久使用下去是否會出現因爲屏蔽過多的串,然後出現異常的情況?

不知道還有什麼更好的方法可以屏蔽整一板塊的串,或許最好的解決方案是逼A島在後端實現這一功能

seven332 commented 5 years ago

主要是如果某一页所有的串都被屏蔽了,就会出问题。

WUGqnwvMQPzl commented 5 years ago

那如果說像前幾天那樣LOL幾乎佔領整個時間線的話,恐怕問題不小

不知道還有什麼更好的解決方案

drpo commented 4 years ago

捞,设置里加个选项

bool ignoreForum = Settings.getIgnoreForumFromTimeline() && ACUrl.FORUM_ID_TIME_LINE.equals(mForumId);
while (postIterator.hasNext()) {
    Post post = postIterator.next();
    bool ignored = false;
    if (ignoreForum) {
        ACForumRaw postForum = DB.getACForumForForumid(post.getNMBFid());
        if (postForum != null && !postForum.getVisibility())
            ignored = true;
    }
    if (PostIgnoreUtils.INSTANCE.checkPostIgnored(post.getNMBPostId()))
        ignored = true;
    if (ignored)
        postIterator.remove();
}

if (!result.isEmpty()) {
    mPostHelper.setPages(Integer.MAX_VALUE);
    mPostHelper.onGetPageData(mTaskId, result);
}