Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ package org.schabi.newpipe.database.history.dao
import androidx.room.Dao
import androidx.room.Query
import io.reactivex.rxjava3.core.Flowable
import org.schabi.newpipe.database.BasicDAO
import org.schabi.newpipe.database.history.model.SearchHistoryEntry

@Dao
interface SearchHistoryDAO : HistoryDAO<SearchHistoryEntry> {
interface SearchHistoryDAO : BasicDAO<SearchHistoryEntry> {

@get:Query("SELECT * FROM search_history WHERE id = (SELECT MAX(id) FROM search_history)")
override val latestEntry: SearchHistoryEntry
val latestEntry: SearchHistoryEntry?

@Query("DELETE FROM search_history")
override fun deleteAll(): Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ import androidx.room.Dao
import androidx.room.Query
import androidx.room.RewriteQueriesToDropUnusedColumns
import io.reactivex.rxjava3.core.Flowable
import org.schabi.newpipe.database.BasicDAO
import org.schabi.newpipe.database.history.model.StreamHistoryEntity
import org.schabi.newpipe.database.history.model.StreamHistoryEntry
import org.schabi.newpipe.database.stream.StreamStatisticsEntry

@Dao
abstract class StreamHistoryDAO : HistoryDAO<StreamHistoryEntity> {

@get:Query("SELECT * FROM stream_history WHERE access_date = (SELECT MAX(access_date) FROM stream_history)")
abstract override val latestEntry: StreamHistoryEntity
abstract class StreamHistoryDAO : BasicDAO<StreamHistoryEntity> {

@Query("SELECT * FROM stream_history")
abstract override fun getAll(): Flowable<List<StreamHistoryEntity>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import java.util.Date;
import java.util.Locale;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class BackupRestoreSettingsFragment extends BasePreferenceFragment {

Expand Down Expand Up @@ -155,9 +157,9 @@ private void requestImportPathResult(final ActivityResult result) {
}

private void exportDatabase(final StoredFileHelper file, final Uri exportDataUri) {
try {
try (ExecutorService executor = Executors.newSingleThreadExecutor()) {
//checkpoint before export
NewPipeDatabase.checkpoint();
executor.submit(NewPipeDatabase::checkpoint).get();

final SharedPreferences preferences = PreferenceManager
.getDefaultSharedPreferences(requireContext());
Expand Down