From 4e594b06cc8a629d6a07cc4081448c554346b093 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Thu, 22 Oct 2026 14:55:56 +0800 Subject: [PATCH] Apply review feedback for Kotlin conversion * Use fromRunnable in updateJoin to return like other methods * Relocate saveStreamState to group loadStreamState overloads Signed-off-by: Aayush Gupta --- .../local/history/HistoryRecordManager.kt | 28 +++++++++---------- .../local/playlist/LocalPlaylistManager.kt | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/history/HistoryRecordManager.kt b/app/src/main/java/org/schabi/newpipe/local/history/HistoryRecordManager.kt index 886437a21..90ab5ce8e 100644 --- a/app/src/main/java/org/schabi/newpipe/local/history/HistoryRecordManager.kt +++ b/app/src/main/java/org/schabi/newpipe/local/history/HistoryRecordManager.kt @@ -237,20 +237,6 @@ class HistoryRecordManager(context: Context) { .subscribeOn(Schedulers.io()) } - fun saveStreamState(info: StreamInfo, progressMillis: Long): Completable { - return Completable.fromAction { - runBlocking { - database.withWriteTransaction { - val streamId = streamTable.upsert(StreamEntity(info)) - val state = StreamStateEntity(streamId, progressMillis) - if (state.isValid(info.duration)) { - streamStateTable.upsert(state) - } - } - } - }.subscribeOn(Schedulers.io()) - } - fun loadStreamState(info: InfoItem): Maybe { return Maybe.fromCallable { streamTable.getStream(info.serviceId.toLong(), info.url) @@ -281,6 +267,20 @@ class HistoryRecordManager(context: Context) { }.subscribeOn(Schedulers.io()) } + fun saveStreamState(info: StreamInfo, progressMillis: Long): Completable { + return Completable.fromAction { + runBlocking { + database.withWriteTransaction { + val streamId = streamTable.upsert(StreamEntity(info)) + val state = StreamStateEntity(streamId, progressMillis) + if (state.isValid(info.duration)) { + streamStateTable.upsert(state) + } + } + } + }.subscribeOn(Schedulers.io()) + } + // /////////////////////////////////////////////////////// // Utility // /////////////////////////////////////////////////////// diff --git a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistManager.kt b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistManager.kt index d914ca72c..d6a541746 100644 --- a/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistManager.kt +++ b/app/src/main/java/org/schabi/newpipe/local/playlist/LocalPlaylistManager.kt @@ -80,7 +80,7 @@ class LocalPlaylistManager(private val database: AppDatabase) { PlaylistStreamEntity(playlistId, streamId, index) } - return Completable.fromAction { + return Completable.fromRunnable { playlistStreamTable.updatePlaylistStreams(playlistId, joinEntities) }.subscribeOn(Schedulers.io()) }