mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 16:40:32 +00:00
add clear orphans
This commit is contained in:
parent
a079a0c901
commit
0471fd8145
@ -19,6 +19,7 @@ import org.schabi.newpipe.util.InfoCache;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
@ -74,6 +75,19 @@ public class HistorySettingsFragment extends BasePreferenceFragment {
|
||||
"Delete view history",
|
||||
R.string.general_error)));
|
||||
|
||||
final Disposable onClearOrphans = recordManager.removeOrphanedRecords()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
howManyDeleted -> {},
|
||||
throwable -> ErrorActivity.reportError(getContext(),
|
||||
throwable,
|
||||
SettingsActivity.class, null,
|
||||
ErrorActivity.ErrorInfo.make(
|
||||
UserAction.DELETE_FROM_HISTORY,
|
||||
"none",
|
||||
"Delete search history",
|
||||
R.string.general_error)));
|
||||
disposables.add(onClearOrphans);
|
||||
disposables.add(onDelete);
|
||||
}))
|
||||
.create()
|
||||
@ -99,7 +113,6 @@ public class HistorySettingsFragment extends BasePreferenceFragment {
|
||||
"none",
|
||||
"Delete search history",
|
||||
R.string.general_error)));
|
||||
|
||||
disposables.add(onDelete);
|
||||
}))
|
||||
.create()
|
||||
|
Loading…
Reference in New Issue
Block a user