MastodonApi: set withMuted to true everywhere for a while
This commit is contained in:
parent
b408d33428
commit
9796da7513
|
@ -73,11 +73,12 @@ class StatusesDataSource(private val accountId: String,
|
|||
retryInitial = null
|
||||
initialLoad.postValue(NetworkState.LOADING)
|
||||
val initialKey = params.requestedInitialKey
|
||||
val withMuted = true // TODO: configurable
|
||||
if (initialKey == null) {
|
||||
mastodonApi.accountStatusesObservable(accountId, null, null, params.requestedLoadSize, true)
|
||||
mastodonApi.accountStatusesObservable(accountId, null, null, params.requestedLoadSize, true, withMuted)
|
||||
} else {
|
||||
mastodonApi.statusObservable(initialKey).zipWith(
|
||||
mastodonApi.accountStatusesObservable(accountId, params.requestedInitialKey, null, params.requestedLoadSize - 1, true),
|
||||
mastodonApi.accountStatusesObservable(accountId, params.requestedInitialKey, null, params.requestedLoadSize - 1, true, withMuted),
|
||||
BiFunction { status: Status, list: List<Status> ->
|
||||
val ret = ArrayList<Status>()
|
||||
ret.add(status)
|
||||
|
@ -106,7 +107,8 @@ class StatusesDataSource(private val accountId: String,
|
|||
override fun loadAfter(params: LoadParams<String>, callback: LoadCallback<Status>) {
|
||||
networkStateAfter.postValue(NetworkState.LOADING)
|
||||
retryAfter = null
|
||||
mastodonApi.accountStatusesObservable(accountId, params.key, null, params.requestedLoadSize, true)
|
||||
val withMuted = true // TODO: configurable
|
||||
mastodonApi.accountStatusesObservable(accountId, params.key, null, params.requestedLoadSize, true, withMuted)
|
||||
.doOnSubscribe {
|
||||
disposables.add(it)
|
||||
}
|
||||
|
@ -128,7 +130,8 @@ class StatusesDataSource(private val accountId: String,
|
|||
override fun loadBefore(params: LoadParams<String>, callback: LoadCallback<Status>) {
|
||||
networkStateBefore.postValue(NetworkState.LOADING)
|
||||
retryBefore = null
|
||||
mastodonApi.accountStatusesObservable(accountId, null, params.key, params.requestedLoadSize, true)
|
||||
val withMuted = true // TODO: configurable
|
||||
mastodonApi.accountStatusesObservable(accountId, null, params.key, params.requestedLoadSize, true, withMuted)
|
||||
.doOnSubscribe {
|
||||
disposables.add(it)
|
||||
}
|
||||
|
@ -147,4 +150,4 @@ class StatusesDataSource(private val accountId: String,
|
|||
}
|
||||
|
||||
override fun getKey(item: Status): String = item.id
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,7 +207,8 @@ class AccountMediaFragment : BaseFragment(), RefreshableFragment, Injectable {
|
|||
statuses.lastOrNull()?.let { last ->
|
||||
Log.d(TAG, "Requesting statuses with max_id: ${last.id}, (bottom)")
|
||||
fetchingStatus = FetchingStatus.FETCHING_BOTTOM
|
||||
currentCall = api.accountStatuses(accountId, last.id, null, null, null, true, null)
|
||||
val withMuted = true // TODO: configurable
|
||||
currentCall = api.accountStatuses(accountId, last.id, null, null, null, true, null, withMuted)
|
||||
currentCall?.enqueue(bottomCallback)
|
||||
}
|
||||
}
|
||||
|
@ -220,13 +221,14 @@ class AccountMediaFragment : BaseFragment(), RefreshableFragment, Injectable {
|
|||
|
||||
private fun refresh() {
|
||||
statusView.hide()
|
||||
val withMuted = true // TODO: configurable
|
||||
if (fetchingStatus != FetchingStatus.NOT_FETCHING) return
|
||||
currentCall = if (statuses.isEmpty()) {
|
||||
fetchingStatus = FetchingStatus.INITIAL_FETCHING
|
||||
api.accountStatuses(accountId, null, null, null, null, true, null)
|
||||
api.accountStatuses(accountId, null, null, null, null, true, null, withMuted)
|
||||
} else {
|
||||
fetchingStatus = FetchingStatus.REFRESHING
|
||||
api.accountStatuses(accountId, null, statuses[0].id, null, null, true, null)
|
||||
api.accountStatuses(accountId, null, statuses[0].id, null, null, true, null, withMuted)
|
||||
}
|
||||
currentCall?.enqueue(callback)
|
||||
|
||||
|
@ -240,7 +242,8 @@ class AccountMediaFragment : BaseFragment(), RefreshableFragment, Injectable {
|
|||
}
|
||||
if (fetchingStatus == FetchingStatus.NOT_FETCHING && statuses.isEmpty()) {
|
||||
fetchingStatus = FetchingStatus.INITIAL_FETCHING
|
||||
currentCall = api.accountStatuses(accountId, null, null, null, null, true, null)
|
||||
val withMuted = true // TODO: configurable
|
||||
currentCall = api.accountStatuses(accountId, null, null, null, null, true, null, withMuted)
|
||||
currentCall?.enqueue(callback)
|
||||
}
|
||||
else if (needToRefresh)
|
||||
|
@ -347,4 +350,4 @@ class AccountMediaFragment : BaseFragment(), RefreshableFragment, Injectable {
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -920,7 +920,9 @@ public class NotificationsFragment extends SFragment implements
|
|||
bottomLoading = true;
|
||||
}
|
||||
|
||||
Call<List<Notification>> call = mastodonApi.notifications(fromId, uptoId, LOAD_AT_ONCE, showNotificationsFilter ? notificationFilter : null);
|
||||
boolean withMuted = true; // TODO: configurable
|
||||
|
||||
Call<List<Notification>> call = mastodonApi.notifications(fromId, uptoId, LOAD_AT_ONCE, showNotificationsFilter ? notificationFilter : null, withMuted);
|
||||
|
||||
call.enqueue(new Callback<List<Notification>>() {
|
||||
@Override
|
||||
|
|
|
@ -970,28 +970,29 @@ public class TimelineFragment extends SFragment implements
|
|||
private Call<List<Status>> getFetchCallByTimelineType(Kind kind, String tagOrId, String fromId,
|
||||
String uptoId) {
|
||||
MastodonApi api = mastodonApi;
|
||||
boolean withMuted = true; // TODO: configurable
|
||||
switch (kind) {
|
||||
default:
|
||||
case HOME:
|
||||
return api.homeTimeline(fromId, uptoId, LOAD_AT_ONCE);
|
||||
return api.homeTimeline(fromId, uptoId, LOAD_AT_ONCE, withMuted);
|
||||
case PUBLIC_FEDERATED:
|
||||
return api.publicTimeline(null, fromId, uptoId, LOAD_AT_ONCE);
|
||||
return api.publicTimeline(null, fromId, uptoId, LOAD_AT_ONCE, withMuted);
|
||||
case PUBLIC_LOCAL:
|
||||
return api.publicTimeline(true, fromId, uptoId, LOAD_AT_ONCE);
|
||||
return api.publicTimeline(true, fromId, uptoId, LOAD_AT_ONCE, withMuted);
|
||||
case TAG:
|
||||
return api.hashtagTimeline(tagOrId, null, fromId, uptoId, LOAD_AT_ONCE);
|
||||
return api.hashtagTimeline(tagOrId, null, fromId, uptoId, LOAD_AT_ONCE, withMuted);
|
||||
case USER:
|
||||
return api.accountStatuses(tagOrId, fromId, uptoId, LOAD_AT_ONCE, true, null, null);
|
||||
return api.accountStatuses(tagOrId, fromId, uptoId, LOAD_AT_ONCE, true, null, null, withMuted);
|
||||
case USER_PINNED:
|
||||
return api.accountStatuses(tagOrId, fromId, uptoId, LOAD_AT_ONCE, null, null, true);
|
||||
return api.accountStatuses(tagOrId, fromId, uptoId, LOAD_AT_ONCE, null, null, true, withMuted);
|
||||
case USER_WITH_REPLIES:
|
||||
return api.accountStatuses(tagOrId, fromId, uptoId, LOAD_AT_ONCE, null, null, null);
|
||||
return api.accountStatuses(tagOrId, fromId, uptoId, LOAD_AT_ONCE, null, null, null, withMuted);
|
||||
case FAVOURITES:
|
||||
return api.favourites(fromId, uptoId, LOAD_AT_ONCE);
|
||||
return api.favourites(fromId, uptoId, LOAD_AT_ONCE, withMuted);
|
||||
case BOOKMARKS:
|
||||
return api.bookmarks(fromId, uptoId, LOAD_AT_ONCE);
|
||||
return api.bookmarks(fromId, uptoId, LOAD_AT_ONCE, withMuted);
|
||||
case LIST:
|
||||
return api.listTimeline(tagOrId, fromId, uptoId, LOAD_AT_ONCE);
|
||||
return api.listTimeline(tagOrId, fromId, uptoId, LOAD_AT_ONCE, withMuted);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,8 @@ class TimelineRepositoryImpl(
|
|||
sinceIdMinusOne: String?, limit: Int,
|
||||
accountId: Long, requestMode: TimelineRequestMode
|
||||
): Single<out List<TimelineStatus>> {
|
||||
return mastodonApi.homeTimelineSingle(maxId, sinceIdMinusOne, limit + 1)
|
||||
val withMuted = true // TODO: configurable
|
||||
return mastodonApi.homeTimelineSingle(maxId, sinceIdMinusOne, limit + 1, withMuted)
|
||||
.map { statuses ->
|
||||
this.saveStatusesToDb(accountId, statuses, maxId, sinceId)
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ public final class NotificationPullJobCreator implements JobCreator {
|
|||
@Override
|
||||
protected Result onRunJob(@NonNull Params params) {
|
||||
List<AccountEntity> accountList = new ArrayList<>(accountManager.getAllAccountsOrderedByActive());
|
||||
boolean withMuted = true; // TODO: configurable
|
||||
for (AccountEntity account : accountList) {
|
||||
if (account.getNotificationsEnabled()) {
|
||||
try {
|
||||
|
@ -92,7 +93,8 @@ public final class NotificationPullJobCreator implements JobCreator {
|
|||
Response<List<Notification>> notifications =
|
||||
mastodonApi.notificationsWithAuth(
|
||||
String.format("Bearer %s", account.getAccessToken()),
|
||||
account.getDomain()
|
||||
account.getDomain(),
|
||||
withMuted
|
||||
)
|
||||
.execute();
|
||||
if (notifications.isSuccessful()) {
|
||||
|
|
Loading…
Reference in New Issue