mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-13 02:00:39 +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 class TimelineOption extends SimpleValueMap {
|
||||||
public TimelineOption excludeReplies(boolean excludeReplies) {
|
public TimelineOption excludeReplies(boolean excludeReplies) {
|
||||||
put("exclude_replies", excludeReplies);
|
if (excludeReplies) {
|
||||||
|
put("exclude_replies", true);
|
||||||
|
} else {
|
||||||
|
remove("exclude_replies");
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +92,11 @@ class UserTimelineLoader(
|
|||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
override fun shouldFilterStatus(database: SQLiteDatabase, status: ParcelableStatus): Boolean {
|
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))
|
if (accountKey != null && userKey != null && TextUtils.equals(accountKey.id, userKey.id))
|
||||||
return false
|
return false
|
||||||
val retweetUserKey = status.user_key.takeIf { status.is_retweet }
|
val retweetUserKey = status.user_key.takeIf { status.is_retweet }
|
||||||
@ -107,6 +112,7 @@ class UserTimelineLoader(
|
|||||||
if (timelineFilter != null) {
|
if (timelineFilter != null) {
|
||||||
option.excludeReplies(!timelineFilter.isIncludeReplies)
|
option.excludeReplies(!timelineFilter.isIncludeReplies)
|
||||||
}
|
}
|
||||||
|
|
||||||
return mastodon.getStatuses(id, paging, option)
|
return mastodon.getStatuses(id, paging, option)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user