Fix new manga sources enabling

pull/440/head
Koitharu 3 years ago
parent 5ca22f1419
commit e4942b0d93
Signed by: Koitharu
GPG Key ID: 676DEE768C17A9D7

@ -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)

@ -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()
}

Loading…
Cancel
Save