Fix new manga sources enabling
This commit is contained in:
@@ -24,7 +24,7 @@ abstract class MangaSourcesDao {
|
|||||||
@Query("SELECT * FROM sources ORDER BY sort_key")
|
@Query("SELECT * FROM sources ORDER BY sort_key")
|
||||||
abstract fun observeAll(): Flow<List<MangaSourceEntity>>
|
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
|
abstract suspend fun getMaxSortKey(): Int
|
||||||
|
|
||||||
@Query("UPDATE sources SET enabled = 0")
|
@Query("UPDATE sources SET enabled = 0")
|
||||||
@@ -35,7 +35,7 @@ abstract class MangaSourcesDao {
|
|||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
||||||
@Transaction
|
@Transaction
|
||||||
abstract suspend fun insertIfAbsent(entries: Iterable<MangaSourceEntity>)
|
abstract suspend fun insertIfAbsent(entries: Collection<MangaSourceEntity>)
|
||||||
|
|
||||||
@Upsert
|
@Upsert
|
||||||
abstract suspend fun upsert(entry: MangaSourceEntity)
|
abstract suspend fun upsert(entry: MangaSourceEntity)
|
||||||
|
|||||||
@@ -84,6 +84,6 @@ class MainViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun observeNewSourcesCount() = sourcesRepository.observeNewSources()
|
private fun observeNewSourcesCount() = sourcesRepository.observeNewSources()
|
||||||
.map { it.size }
|
.map { if (sourcesRepository.isSetupRequired()) 0 else it.size }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user