Fix tests (#3022)
This commit is contained in:
parent
88125ef7da
commit
51d02388b9
1 changed files with 22 additions and 21 deletions
|
@ -22,11 +22,8 @@ import android.util.Log
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import androidx.fragment.app.commit
|
import androidx.fragment.app.commit
|
||||||
import androidx.lifecycle.Lifecycle
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import at.connyduck.calladapter.networkresult.fold
|
import at.connyduck.calladapter.networkresult.fold
|
||||||
import autodispose2.androidx.lifecycle.AndroidLifecycleScopeProvider
|
|
||||||
import autodispose2.autoDispose
|
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.keylesspalace.tusky.appstore.EventHub
|
import com.keylesspalace.tusky.appstore.EventHub
|
||||||
import com.keylesspalace.tusky.appstore.PreferenceChangedEvent
|
import com.keylesspalace.tusky.appstore.PreferenceChangedEvent
|
||||||
|
@ -37,7 +34,6 @@ import com.keylesspalace.tusky.entity.Filter
|
||||||
import com.keylesspalace.tusky.util.viewBinding
|
import com.keylesspalace.tusky.util.viewBinding
|
||||||
import dagger.android.DispatchingAndroidInjector
|
import dagger.android.DispatchingAndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -175,16 +171,16 @@ class StatusListActivity : BottomSheetActivity(), HasAndroidInjector {
|
||||||
muteTagItem?.isEnabled = false
|
muteTagItem?.isEnabled = false
|
||||||
unmuteTagItem?.isVisible = false
|
unmuteTagItem?.isVisible = false
|
||||||
|
|
||||||
mastodonApi.getFilters().observeOn(AndroidSchedulers.mainThread())
|
lifecycleScope.launch {
|
||||||
.autoDispose(AndroidLifecycleScopeProvider.from(this, Lifecycle.Event.ON_DESTROY))
|
mastodonApi.getFilters().fold(
|
||||||
.subscribe { filters ->
|
{ filters ->
|
||||||
for (filter in filters) {
|
for (filter in filters) {
|
||||||
if ((tag == filter.phrase) and filter.context.contains(Filter.HOME)) {
|
if ((tag == filter.phrase) and filter.context.contains(Filter.HOME)) {
|
||||||
Log.d(TAG, "Tag $hashtag is filtered")
|
Log.d(TAG, "Tag $hashtag is filtered")
|
||||||
muteTagItem?.isVisible = false
|
muteTagItem?.isVisible = false
|
||||||
unmuteTagItem?.isVisible = true
|
unmuteTagItem?.isVisible = true
|
||||||
mutedFilter = filter
|
mutedFilter = filter
|
||||||
return@subscribe
|
return@fold
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,6 +189,11 @@ class StatusListActivity : BottomSheetActivity(), HasAndroidInjector {
|
||||||
muteTagItem?.isEnabled = true
|
muteTagItem?.isEnabled = true
|
||||||
muteTagItem?.isVisible = true
|
muteTagItem?.isVisible = true
|
||||||
muteTagItem?.isVisible = true
|
muteTagItem?.isVisible = true
|
||||||
|
},
|
||||||
|
{ throwable ->
|
||||||
|
Log.e(TAG, "Error getting filters: $throwable")
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue