From 546cb4baccaf66cd3e12b8cee20f973d3ee59f27 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Sun, 22 Sep 2019 08:19:44 +0200 Subject: [PATCH] upgrade autodispose (#1490) * upgrade autodispose * set AutoDisposePlugins.setHideProxies to false --- app/build.gradle | 4 ++-- .../java/com/keylesspalace/tusky/AccountsInListFragment.kt | 3 ++- app/src/main/java/com/keylesspalace/tusky/ListsActivity.kt | 6 +++--- .../java/com/keylesspalace/tusky/TabPreferenceActivity.kt | 4 ++-- .../main/java/com/keylesspalace/tusky/TuskyApplication.java | 3 +++ .../main/java/com/keylesspalace/tusky/ViewMediaActivity.kt | 4 ++-- .../instancemute/fragment/InstanceListFragment.kt | 4 ++-- .../components/search/fragments/SearchStatusesFragment.kt | 4 ++-- .../com/keylesspalace/tusky/fragment/AccountListFragment.kt | 4 ++-- 9 files changed, 20 insertions(+), 16 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1282c7231..12c82f38f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -148,8 +148,8 @@ dependencies { implementation 'io.reactivex.rxjava2:rxjava:2.2.12' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' implementation 'io.reactivex.rxjava2:rxkotlin:2.4.0' - implementation 'com.uber.autodispose:autodispose-android-archcomponents:1.3.0' - implementation 'com.uber.autodispose:autodispose:1.3.0' + implementation 'com.uber.autodispose:autodispose-android-archcomponents:1.4.0' + implementation 'com.uber.autodispose:autodispose:1.4.0' implementation 'androidx.paging:paging-runtime-ktx:2.1.0' //Glide diff --git a/app/src/main/java/com/keylesspalace/tusky/AccountsInListFragment.kt b/app/src/main/java/com/keylesspalace/tusky/AccountsInListFragment.kt index 50f04d8b0..6b2fd2744 100644 --- a/app/src/main/java/com/keylesspalace/tusky/AccountsInListFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/AccountsInListFragment.kt @@ -36,6 +36,7 @@ import com.keylesspalace.tusky.viewmodel.AccountsInListViewModel import com.keylesspalace.tusky.viewmodel.State import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from import com.uber.autodispose.autoDisposable +import com.uber.autodispose.autoDispose import io.reactivex.android.schedulers.AndroidSchedulers import kotlinx.android.extensions.LayoutContainer import kotlinx.android.synthetic.main.fragment_accounts_in_list.* @@ -106,7 +107,7 @@ class AccountsInListFragment : DialogFragment(), Injectable { viewModel.state .observeOn(AndroidSchedulers.mainThread()) - .autoDisposable(from(this)) + .autoDispose(from(this)) .subscribe { state -> adapter.submitList(state.accounts.asRightOrNull() ?: listOf()) diff --git a/app/src/main/java/com/keylesspalace/tusky/ListsActivity.kt b/app/src/main/java/com/keylesspalace/tusky/ListsActivity.kt index 190b9e408..54aca8971 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ListsActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/ListsActivity.kt @@ -42,7 +42,7 @@ import com.keylesspalace.tusky.viewmodel.ListsViewModel.LoadingState.* import com.mikepenz.google_material_typeface_library.GoogleMaterial import com.mikepenz.iconics.IconicsDrawable import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from -import com.uber.autodispose.autoDisposable +import com.uber.autodispose.autoDispose import dagger.android.DispatchingAndroidInjector import dagger.android.HasAndroidInjector import io.reactivex.android.schedulers.AndroidSchedulers @@ -92,7 +92,7 @@ class ListsActivity : BaseActivity(), Injectable, HasAndroidInjector { viewModel = viewModelFactory.create(ListsViewModel::class.java) viewModel.state .observeOn(AndroidSchedulers.mainThread()) - .autoDisposable(from(this)) + .autoDispose(from(this)) .subscribe(this::update) viewModel.retryLoading() @@ -101,7 +101,7 @@ class ListsActivity : BaseActivity(), Injectable, HasAndroidInjector { } viewModel.events.observeOn(AndroidSchedulers.mainThread()) - .autoDisposable(from(this)) + .autoDispose(from(this)) .subscribe { event -> @Suppress("WHEN_ENUM_CAN_BE_NULL_IN_JAVA") when (event) { diff --git a/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt b/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt index d341ee1c8..f2876bbec 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt @@ -32,7 +32,7 @@ import com.keylesspalace.tusky.di.Injectable import com.keylesspalace.tusky.util.onTextChanged import com.keylesspalace.tusky.util.visible import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from -import com.uber.autodispose.autoDisposable +import com.uber.autodispose.autoDispose import io.reactivex.Single import io.reactivex.schedulers.Schedulers import kotlinx.android.synthetic.main.activity_tab_preference.* @@ -252,7 +252,7 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene accountManager.saveAccount(it) } .subscribeOn(Schedulers.io()) - .autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)) + .autoDispose(from(this, Lifecycle.Event.ON_DESTROY)) .subscribe() } diff --git a/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java b/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java index b9092fe7f..39c21cdc1 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java +++ b/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java @@ -30,6 +30,7 @@ import com.keylesspalace.tusky.di.AppInjector; import com.keylesspalace.tusky.util.EmojiCompatFont; import com.keylesspalace.tusky.util.LocaleManager; import com.keylesspalace.tusky.util.NotificationPullJobCreator; +import com.uber.autodispose.AutoDisposePlugins; import org.conscrypt.Conscrypt; @@ -86,6 +87,8 @@ public class TuskyApplication extends Application implements HasAndroidInjector } }; + AutoDisposePlugins.setHideProxies(false); + initAppInjector(); initEmojiCompat(); diff --git a/app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt b/app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt index 8806ae432..2791ba2f1 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/ViewMediaActivity.kt @@ -50,7 +50,7 @@ import com.keylesspalace.tusky.pager.ImagePagerAdapter import com.keylesspalace.tusky.util.getTemporaryMediaFilename import com.keylesspalace.tusky.viewdata.AttachmentViewData import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider -import com.uber.autodispose.autoDisposable +import com.uber.autodispose.autoDispose import io.reactivex.Single import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.schedulers.Schedulers @@ -285,7 +285,7 @@ class ViewMediaActivity : BaseActivity(), ViewImageFragment.PhotoActionsListener .doOnDispose { futureTask.cancel(true) } - .autoDisposable(AndroidLifecycleScopeProvider.from(this, Lifecycle.Event.ON_DESTROY)) + .autoDispose(AndroidLifecycleScopeProvider.from(this, Lifecycle.Event.ON_DESTROY)) .subscribe( { result -> Log.d(TAG, "Download image result: $result") diff --git a/app/src/main/java/com/keylesspalace/tusky/components/instancemute/fragment/InstanceListFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/instancemute/fragment/InstanceListFragment.kt index 625de5fe8..bb850bdcf 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/instancemute/fragment/InstanceListFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/instancemute/fragment/InstanceListFragment.kt @@ -21,7 +21,7 @@ import com.keylesspalace.tusky.util.hide import com.keylesspalace.tusky.util.show import com.keylesspalace.tusky.view.EndlessOnScrollListener import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from -import com.uber.autodispose.autoDisposable +import com.uber.autodispose.autoDispose import io.reactivex.android.schedulers.AndroidSchedulers import kotlinx.android.synthetic.main.fragment_instance_list.* import retrofit2.Call @@ -115,7 +115,7 @@ class InstanceListFragment: BaseFragment(), Injectable, InstanceActionListener { api.domainBlocks(id, bottomId) .observeOn(AndroidSchedulers.mainThread()) - .autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)) + .autoDispose(from(this, Lifecycle.Event.ON_DESTROY)) .subscribe({ response -> val instances = response.body() diff --git a/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt index fe9f06415..1362db884 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchStatusesFragment.kt @@ -50,7 +50,7 @@ import com.keylesspalace.tusky.util.NetworkState import com.keylesspalace.tusky.viewdata.AttachmentViewData import com.keylesspalace.tusky.viewdata.StatusViewData import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from -import com.uber.autodispose.autoDisposable +import com.uber.autodispose.autoDispose import io.reactivex.android.schedulers.AndroidSchedulers import kotlinx.android.synthetic.main.fragment_search.* import java.util.* @@ -392,7 +392,7 @@ class SearchStatusesFragment : SearchFragment viewModel.deleteStatus(id) .observeOn(AndroidSchedulers.mainThread()) - .autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)) + .autoDispose(from(this, Lifecycle.Event.ON_DESTROY)) .subscribe ({ deletedStatus -> removeItem(position) diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/AccountListFragment.kt b/app/src/main/java/com/keylesspalace/tusky/fragment/AccountListFragment.kt index c4cf9993e..eb5960b03 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/AccountListFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/AccountListFragment.kt @@ -40,7 +40,7 @@ import com.keylesspalace.tusky.util.hide import com.keylesspalace.tusky.util.show import com.keylesspalace.tusky.view.EndlessOnScrollListener import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider.from -import com.uber.autodispose.autoDisposable +import com.uber.autodispose.autoDispose import io.reactivex.Single import io.reactivex.android.schedulers.AndroidSchedulers import kotlinx.android.synthetic.main.fragment_account_list.* @@ -275,7 +275,7 @@ class AccountListFragment : BaseFragment(), AccountActionListener, Injectable { getFetchCallByListType(type, id) .observeOn(AndroidSchedulers.mainThread()) - .autoDisposable(from(this, Lifecycle.Event.ON_DESTROY)) + .autoDispose(from(this, Lifecycle.Event.ON_DESTROY)) .subscribe({ response -> val accountList = response.body()