diff --git a/app/schemas/org.schabi.newpipe.database.AppDatabase/10.json b/app/schemas/org.schabi.newpipe.database.AppDatabase/10.json index 69c83e09a9..58d6c275a1 100644 --- a/app/schemas/org.schabi.newpipe.database.AppDatabase/10.json +++ b/app/schemas/org.schabi.newpipe.database.AppDatabase/10.json @@ -2,7 +2,7 @@ "formatVersion": 1, "database": { "version": 10, - "identityHash": "377d92119f9bf8b38d1d4ec87453405e", + "identityHash": "7591e8039faa74d8c0517dc867af9d3e", "entities": [ { "tableName": "subscriptions", @@ -719,32 +719,12 @@ ] } ] - }, - { - "tableName": "sponsorblock_whitelist", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uploader` TEXT NOT NULL, PRIMARY KEY(`uploader`))", - "fields": [ - { - "fieldPath": "uploader", - "columnName": "uploader", - "affinity": "TEXT", - "notNull": true - } - ], - "primaryKey": { - "autoGenerate": false, - "columnNames": [ - "uploader" - ] - }, - "indices": [], - "foreignKeys": [] } ], "views": [], "setupQueries": [ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", - "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '377d92119f9bf8b38d1d4ec87453405e')" + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '7591e8039faa74d8c0517dc867af9d3e')" ] } } \ No newline at end of file diff --git a/app/src/main/java/org/schabi/newpipe/database/AppDatabase.java b/app/src/main/java/org/schabi/newpipe/database/AppDatabase.java index 184aaad53b..04d93a238d 100644 --- a/app/src/main/java/org/schabi/newpipe/database/AppDatabase.java +++ b/app/src/main/java/org/schabi/newpipe/database/AppDatabase.java @@ -1,6 +1,6 @@ package org.schabi.newpipe.database; -import static org.schabi.newpipe.database.Migrations.DB_VER_10; +import static org.schabi.newpipe.database.Migrations.DB_VER_9; import androidx.room.Database; import androidx.room.RoomDatabase; @@ -22,8 +22,6 @@ import org.schabi.newpipe.database.playlist.model.PlaylistEntity; import org.schabi.newpipe.database.playlist.model.PlaylistRemoteEntity; import org.schabi.newpipe.database.playlist.model.PlaylistStreamEntity; -import org.schabi.newpipe.database.sponsorblock.dao.SponsorBlockWhitelistDAO; -import org.schabi.newpipe.database.sponsorblock.dao.SponsorBlockWhitelistEntry; import org.schabi.newpipe.database.stream.dao.StreamDAO; import org.schabi.newpipe.database.stream.dao.StreamStateDAO; import org.schabi.newpipe.database.stream.model.StreamEntity; @@ -38,9 +36,9 @@ StreamEntity.class, StreamHistoryEntity.class, StreamStateEntity.class, PlaylistEntity.class, PlaylistStreamEntity.class, PlaylistRemoteEntity.class, FeedEntity.class, FeedGroupEntity.class, FeedGroupSubscriptionEntity.class, - FeedLastUpdatedEntity.class, SponsorBlockWhitelistEntry.class + FeedLastUpdatedEntity.class }, - version = DB_VER_10 + version = DB_VER_9 ) public abstract class AppDatabase extends RoomDatabase { public static final String DATABASE_NAME = "newpipe.db"; @@ -64,6 +62,4 @@ public abstract class AppDatabase extends RoomDatabase { public abstract FeedGroupDAO feedGroupDAO(); public abstract SubscriptionDAO subscriptionDAO(); - - public abstract SponsorBlockWhitelistDAO sponsorBlockWhitelistDAO(); } diff --git a/app/src/main/java/org/schabi/newpipe/database/Migrations.java b/app/src/main/java/org/schabi/newpipe/database/Migrations.java index 70127a5cfe..c71b819123 100644 --- a/app/src/main/java/org/schabi/newpipe/database/Migrations.java +++ b/app/src/main/java/org/schabi/newpipe/database/Migrations.java @@ -252,9 +252,15 @@ public void migrate(@NonNull final SupportSQLiteDatabase database) { database.execSQL("DELETE FROM search_history WHERE id NOT IN (SELECT id FROM (SELECT " + "MIN(id) as id FROM search_history GROUP BY trim(search), service_id ) tmp)"); database.execSQL("UPDATE search_history SET search = trim(search)"); + + // TODO: remove later - this meant to be a temporary fix for + // "rolling back" the database to fix poly's dumb mistake... + database.execSQL("DROP TABLE `sponsorblock_whitelist`"); + MIGRATION_9_10.migrate(database); } }; + // TODO: change back to MIGRATION_8_9 = new Migration(DB_VER_8, DB_VER_9) public static final Migration MIGRATION_9_10 = new Migration(DB_VER_9, DB_VER_10) { @Override public void migrate(@NonNull final SupportSQLiteDatabase database) { diff --git a/app/src/main/java/org/schabi/newpipe/local/sponsorblock/SponsorBlockDataManager.java b/app/src/main/java/org/schabi/newpipe/local/sponsorblock/SponsorBlockDataManager.java index 3df9ea7629..da592c6b2e 100644 --- a/app/src/main/java/org/schabi/newpipe/local/sponsorblock/SponsorBlockDataManager.java +++ b/app/src/main/java/org/schabi/newpipe/local/sponsorblock/SponsorBlockDataManager.java @@ -5,38 +5,39 @@ import org.schabi.newpipe.NewPipeDatabase; import org.schabi.newpipe.database.AppDatabase; import org.schabi.newpipe.database.sponsorblock.dao.SponsorBlockWhitelistDAO; -import org.schabi.newpipe.database.sponsorblock.dao.SponsorBlockWhitelistEntry; import io.reactivex.rxjava3.core.Completable; import io.reactivex.rxjava3.core.Maybe; import io.reactivex.rxjava3.core.Single; -import io.reactivex.rxjava3.schedulers.Schedulers; public class SponsorBlockDataManager { - private final SponsorBlockWhitelistDAO sponsorBlockWhitelistTable; + private final SponsorBlockWhitelistDAO sponsorBlockWhitelistTable = null; public SponsorBlockDataManager(final Context context) { final AppDatabase database = NewPipeDatabase.getInstance(context); - sponsorBlockWhitelistTable = database.sponsorBlockWhitelistDAO(); } public Maybe addToWhitelist(final String uploader) { - return Maybe.fromCallable(() -> { - final SponsorBlockWhitelistEntry entry = new SponsorBlockWhitelistEntry(uploader); - return sponsorBlockWhitelistTable.insert(entry); - }).subscribeOn(Schedulers.io()); +// return Maybe.fromCallable(() -> { +// final SponsorBlockWhitelistEntry entry = new SponsorBlockWhitelistEntry(uploader); +// return sponsorBlockWhitelistTable.insert(entry); +// }).subscribeOn(Schedulers.io()); + return Maybe.empty(); } public Completable removeFromWhitelist(final String uploader) { - return Completable.fromAction(() -> sponsorBlockWhitelistTable.deleteByUploader(uploader)); +// return Completable.fromAction(() -> sponsorBlockWhitelistTable.deleteByUploader(uploader)); + return Completable.complete(); } public Single isWhiteListed(final String uploader) { - return Single.fromCallable(() -> sponsorBlockWhitelistTable.exists(uploader)) - .subscribeOn(Schedulers.io()); +// return Single.fromCallable(() -> sponsorBlockWhitelistTable.exists(uploader)) +// .subscribeOn(Schedulers.io()); + return Single.just(false); } public Completable clearWhitelist() { - return Completable.fromAction(sponsorBlockWhitelistTable::deleteAll); +// return Completable.fromAction(sponsorBlockWhitelistTable::deleteAll); + return Completable.complete(); } }