File tree 2 files changed +11
-5
lines changed
app/src/main/java/fr/free/nrw/commons
2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -58,13 +58,12 @@ protected void onSaveInstanceState(Bundle outState) {
58
58
* Makes API call to check if user is blocked from Commons. If the user is blocked, a snackbar
59
59
* is created to notify the user
60
60
*/
61
- protected void showBlockStatus ()
62
- {
63
- Observable .fromCallable (() -> mediaWikiApi .isUserBlockedFromCommons ())
61
+ protected void showBlockStatus () {
62
+ compositeDisposable .add (Observable .fromCallable (() -> mediaWikiApi .isUserBlockedFromCommons ())
64
63
.subscribeOn (Schedulers .io ())
65
64
.observeOn (AndroidSchedulers .mainThread ())
66
65
.filter (result -> result )
67
66
.subscribe (result -> ViewUtil .showShortSnackbar (findViewById (android .R .id .content ), R .string .block_notification )
68
- );
67
+ )) ;
69
68
}
70
69
}
Original file line number Diff line number Diff line change 8
8
import fr .free .nrw .commons .R ;
9
9
import fr .free .nrw .commons .di .CommonsDaggerAppCompatActivity ;
10
10
import fr .free .nrw .commons .kvstore .JsonKvStore ;
11
- import fr . free . nrw . commons . kvstore . JsonKvStore ;
11
+ import io . reactivex . disposables . CompositeDisposable ;
12
12
13
13
public abstract class BaseActivity extends CommonsDaggerAppCompatActivity {
14
14
@ Inject
15
15
@ Named ("default_preferences" )
16
16
public JsonKvStore defaultKvStore ;
17
17
18
+ protected CompositeDisposable compositeDisposable = new CompositeDisposable ();
18
19
protected boolean wasPreviouslyDarkTheme ;
19
20
20
21
@ Override
@@ -33,4 +34,10 @@ protected void onResume() {
33
34
34
35
super .onResume ();
35
36
}
37
+
38
+ @ Override
39
+ protected void onDestroy () {
40
+ super .onDestroy ();
41
+ compositeDisposable .clear ();
42
+ }
36
43
}
You can’t perform that action at this time.
0 commit comments