clear history fix

This commit is contained in:
Yuriy Liskov 2024-05-14 23:02:26 +03:00
parent 66c6c360a8
commit 9e80a0bb34
2 changed files with 7 additions and 0 deletions

View File

@ -49,6 +49,11 @@ public class VideoStateService implements ProfileChangeListener {
mStates.remove(videoId);
}
public void clear() {
mStates.clear();
persistState();
}
private void restoreState() {
mStates.clear();
String data = mPrefs.getStateUpdaterData();

View File

@ -11,6 +11,7 @@ import com.liskovsoft.sharedutils.rx.RxHelper;
import com.liskovsoft.smartyoutubetv2.common.R;
import com.liskovsoft.smartyoutubetv2.common.app.models.data.BrowseSection;
import com.liskovsoft.smartyoutubetv2.common.app.models.data.Video;
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.service.VideoStateService;
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.ui.UiOptionItem;
import com.liskovsoft.smartyoutubetv2.common.app.presenters.AppDialogPresenter;
import com.liskovsoft.smartyoutubetv2.common.app.presenters.BrowsePresenter;
@ -509,6 +510,7 @@ public abstract class BaseMenuPresenter extends BasePresenter<Void> {
optionItem -> AppDialogUtil.showConfirmationDialog(getContext(),
getContext().getString(R.string.clear_history), () -> {
mServiceManager.clearHistory();
VideoStateService.instance(getContext()).clear();
getDialogPresenter().closeDialog();
presenter.refresh();
})));