Remove unused methods in HistoryRecordManager.
This commit is contained in:
parent
1a8f396e77
commit
ee6a279596
|
@ -3,7 +3,6 @@ package org.schabi.newpipe.database;
|
||||||
import androidx.room.Dao;
|
import androidx.room.Dao;
|
||||||
import androidx.room.Delete;
|
import androidx.room.Delete;
|
||||||
import androidx.room.Insert;
|
import androidx.room.Insert;
|
||||||
import androidx.room.OnConflictStrategy;
|
|
||||||
import androidx.room.Update;
|
import androidx.room.Update;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -14,13 +13,10 @@ import io.reactivex.rxjava3.core.Flowable;
|
||||||
@Dao
|
@Dao
|
||||||
public interface BasicDAO<Entity> {
|
public interface BasicDAO<Entity> {
|
||||||
/* Inserts */
|
/* Inserts */
|
||||||
@Insert(onConflict = OnConflictStrategy.ABORT)
|
@Insert
|
||||||
long insert(Entity entity);
|
long insert(Entity entity);
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.ABORT)
|
@Insert
|
||||||
List<Long> insertAll(Entity... entities);
|
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.ABORT)
|
|
||||||
List<Long> insertAll(Collection<Entity> entities);
|
List<Long> insertAll(Collection<Entity> entities);
|
||||||
|
|
||||||
/* Searches */
|
/* Searches */
|
||||||
|
@ -32,9 +28,6 @@ public interface BasicDAO<Entity> {
|
||||||
@Delete
|
@Delete
|
||||||
void delete(Entity entity);
|
void delete(Entity entity);
|
||||||
|
|
||||||
@Delete
|
|
||||||
int delete(Collection<Entity> entities);
|
|
||||||
|
|
||||||
int deleteAll();
|
int deleteAll();
|
||||||
|
|
||||||
/* Updates */
|
/* Updates */
|
||||||
|
|
|
@ -28,7 +28,6 @@ import org.schabi.newpipe.NewPipeDatabase;
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
import org.schabi.newpipe.database.AppDatabase;
|
import org.schabi.newpipe.database.AppDatabase;
|
||||||
import org.schabi.newpipe.database.LocalItem;
|
import org.schabi.newpipe.database.LocalItem;
|
||||||
import org.schabi.newpipe.database.feed.dao.FeedDAO;
|
|
||||||
import org.schabi.newpipe.database.history.dao.SearchHistoryDAO;
|
import org.schabi.newpipe.database.history.dao.SearchHistoryDAO;
|
||||||
import org.schabi.newpipe.database.history.dao.StreamHistoryDAO;
|
import org.schabi.newpipe.database.history.dao.StreamHistoryDAO;
|
||||||
import org.schabi.newpipe.database.history.model.SearchHistoryEntry;
|
import org.schabi.newpipe.database.history.model.SearchHistoryEntry;
|
||||||
|
@ -51,7 +50,6 @@ import org.schabi.newpipe.util.ExtractorHelper;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.core.Completable;
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
|
@ -89,7 +87,6 @@ public class HistoryRecordManager {
|
||||||
* Marks a stream item as watched such that it is hidden from the feed if watched videos are
|
* Marks a stream item as watched such that it is hidden from the feed if watched videos are
|
||||||
* hidden. Adds a history entry and updates the stream progress to 100%.
|
* hidden. Adds a history entry and updates the stream progress to 100%.
|
||||||
*
|
*
|
||||||
* @see FeedDAO#getLiveOrNotPlayedStreams
|
|
||||||
* @see FeedViewModel#togglePlayedItems
|
* @see FeedViewModel#togglePlayedItems
|
||||||
* @param info the item to mark as watched
|
* @param info the item to mark as watched
|
||||||
* @return a Maybe containing the ID of the item if successful
|
* @return a Maybe containing the ID of the item if successful
|
||||||
|
@ -176,10 +173,6 @@ public class HistoryRecordManager {
|
||||||
.subscribeOn(Schedulers.io());
|
.subscribeOn(Schedulers.io());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Flowable<List<StreamHistoryEntry>> getStreamHistory() {
|
|
||||||
return streamHistoryTable.getHistory().subscribeOn(Schedulers.io());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Flowable<List<StreamHistoryEntry>> getStreamHistorySortedById() {
|
public Flowable<List<StreamHistoryEntry>> getStreamHistorySortedById() {
|
||||||
return streamHistoryTable.getHistorySortedById().subscribeOn(Schedulers.io());
|
return streamHistoryTable.getHistorySortedById().subscribeOn(Schedulers.io());
|
||||||
}
|
}
|
||||||
|
@ -188,24 +181,6 @@ public class HistoryRecordManager {
|
||||||
return streamHistoryTable.getStatistics().subscribeOn(Schedulers.io());
|
return streamHistoryTable.getStatistics().subscribeOn(Schedulers.io());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Single<List<Long>> insertStreamHistory(final Collection<StreamHistoryEntry> entries) {
|
|
||||||
final List<StreamHistoryEntity> entities = new ArrayList<>(entries.size());
|
|
||||||
for (final StreamHistoryEntry entry : entries) {
|
|
||||||
entities.add(entry.toStreamHistoryEntity());
|
|
||||||
}
|
|
||||||
return Single.fromCallable(() -> streamHistoryTable.insertAll(entities))
|
|
||||||
.subscribeOn(Schedulers.io());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Single<Integer> deleteStreamHistory(final Collection<StreamHistoryEntry> entries) {
|
|
||||||
final List<StreamHistoryEntity> entities = new ArrayList<>(entries.size());
|
|
||||||
for (final StreamHistoryEntry entry : entries) {
|
|
||||||
entities.add(entry.toStreamHistoryEntity());
|
|
||||||
}
|
|
||||||
return Single.fromCallable(() -> streamHistoryTable.delete(entities))
|
|
||||||
.subscribeOn(Schedulers.io());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isStreamHistoryEnabled() {
|
private boolean isStreamHistoryEnabled() {
|
||||||
return sharedPreferences.getBoolean(streamHistoryKey, false);
|
return sharedPreferences.getBoolean(streamHistoryKey, false);
|
||||||
}
|
}
|
||||||
|
@ -259,13 +234,6 @@ public class HistoryRecordManager {
|
||||||
// Stream State History
|
// Stream State History
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
|
|
||||||
public Maybe<StreamHistoryEntity> getStreamHistory(final StreamInfo info) {
|
|
||||||
return Maybe.fromCallable(() -> {
|
|
||||||
final long streamId = streamTable.upsert(new StreamEntity(info));
|
|
||||||
return streamHistoryTable.getLatestEntry(streamId);
|
|
||||||
}).subscribeOn(Schedulers.io());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Maybe<StreamStateEntity> loadStreamState(final PlayQueueItem queueItem) {
|
public Maybe<StreamStateEntity> loadStreamState(final PlayQueueItem queueItem) {
|
||||||
return queueItem.getStream()
|
return queueItem.getStream()
|
||||||
.map(info -> streamTable.upsert(new StreamEntity(info)))
|
.map(info -> streamTable.upsert(new StreamEntity(info)))
|
||||||
|
@ -311,28 +279,6 @@ public class HistoryRecordManager {
|
||||||
}).subscribeOn(Schedulers.io());
|
}).subscribeOn(Schedulers.io());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Single<List<StreamStateEntity>> loadStreamStateBatch(final List<InfoItem> infos) {
|
|
||||||
return Single.fromCallable(() -> {
|
|
||||||
final List<StreamStateEntity> result = new ArrayList<>(infos.size());
|
|
||||||
for (final InfoItem info : infos) {
|
|
||||||
final List<StreamEntity> entities = streamTable
|
|
||||||
.getStream(info.getServiceId(), info.getUrl()).blockingFirst();
|
|
||||||
if (entities.isEmpty()) {
|
|
||||||
result.add(null);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
final List<StreamStateEntity> states = streamStateTable
|
|
||||||
.getState(entities.get(0).getUid()).blockingFirst();
|
|
||||||
if (states.isEmpty()) {
|
|
||||||
result.add(null);
|
|
||||||
} else {
|
|
||||||
result.add(states.get(0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}).subscribeOn(Schedulers.io());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Single<List<StreamStateEntity>> loadLocalStreamStateBatch(
|
public Single<List<StreamStateEntity>> loadLocalStreamStateBatch(
|
||||||
final List<? extends LocalItem> items) {
|
final List<? extends LocalItem> items) {
|
||||||
return Single.fromCallable(() -> {
|
return Single.fromCallable(() -> {
|
||||||
|
|
Loading…
Reference in New Issue