Fix new manga sources enabling

This commit is contained in:
Koitharu
2023-07-24 20:21:57 +03:00
parent 5ca22f1419
commit e4942b0d93
2 changed files with 3 additions and 3 deletions

View File

@@ -24,7 +24,7 @@ abstract class MangaSourcesDao {
@Query("SELECT * FROM sources ORDER BY sort_key")
abstract fun observeAll(): Flow<List<MangaSourceEntity>>
@Query("SELECT MAX(sort_key) FROM sources")
@Query("SELECT IFNULL(MAX(sort_key),0) FROM sources")
abstract suspend fun getMaxSortKey(): Int
@Query("UPDATE sources SET enabled = 0")
@@ -35,7 +35,7 @@ abstract class MangaSourcesDao {
@Insert(onConflict = OnConflictStrategy.IGNORE)
@Transaction
abstract suspend fun insertIfAbsent(entries: Iterable<MangaSourceEntity>)
abstract suspend fun insertIfAbsent(entries: Collection<MangaSourceEntity>)
@Upsert
abstract suspend fun upsert(entry: MangaSourceEntity)

View File

@@ -84,6 +84,6 @@ class MainViewModel @Inject constructor(
}
private fun observeNewSourcesCount() = sourcesRepository.observeNewSources()
.map { it.size }
.map { if (sourcesRepository.isSetupRequired()) 0 else it.size }
.distinctUntilChanged()
}