mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-02 09:46:51 +01:00
fixed timeline filter for mastodon
This commit is contained in:
parent
e48a39979a
commit
af53e88b72
@ -26,7 +26,11 @@ import org.mariotaku.restfu.http.SimpleValueMap;
|
||||
|
||||
public class TimelineOption extends SimpleValueMap {
|
||||
public TimelineOption excludeReplies(boolean excludeReplies) {
|
||||
put("exclude_replies", excludeReplies);
|
||||
if (excludeReplies) {
|
||||
put("exclude_replies", true);
|
||||
} else {
|
||||
remove("exclude_replies");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,11 @@ class UserTimelineLoader(
|
||||
|
||||
@WorkerThread
|
||||
override fun shouldFilterStatus(database: SQLiteDatabase, status: ParcelableStatus): Boolean {
|
||||
if (timelineFilter != null) {
|
||||
if (status.is_retweet && !timelineFilter.isIncludeRetweets) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (accountKey != null && userKey != null && TextUtils.equals(accountKey.id, userKey.id))
|
||||
return false
|
||||
val retweetUserKey = status.user_key.takeIf { status.is_retweet }
|
||||
@ -107,6 +112,7 @@ class UserTimelineLoader(
|
||||
if (timelineFilter != null) {
|
||||
option.excludeReplies(!timelineFilter.isIncludeReplies)
|
||||
}
|
||||
|
||||
return mastodon.getStatuses(id, paging, option)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user