mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 05:13:53 +01:00
Fix crash(es) caused by failing to dispose Rx observables (#2669)
This commit is contained in:
parent
38d39e08ac
commit
8474c04c64
21 changed files with 121 additions and 86 deletions
|
|
@ -9,18 +9,27 @@ import androidx.fragment.app.Fragment;
|
|||
import dagger.android.AndroidInjector;
|
||||
import dagger.android.DispatchingAndroidInjector;
|
||||
import dagger.android.support.HasSupportFragmentInjector;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
|
||||
public abstract class CommonsDaggerSupportFragment extends Fragment implements HasSupportFragmentInjector {
|
||||
|
||||
@Inject
|
||||
DispatchingAndroidInjector<Fragment> childFragmentInjector;
|
||||
|
||||
protected CompositeDisposable compositeDisposable = new CompositeDisposable();
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
inject();
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
compositeDisposable.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AndroidInjector<Fragment> supportFragmentInjector() {
|
||||
return childFragmentInjector;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue