Restored entries selection restoration =)
This commit is contained in:
1 parent
63a759e499
commit
0ef2a09e8a
2 files changed
+7
No files matched your search
@@ -62,7 +62,9 @@ class DefaultRepository @Inject constructor(
|
||||
withContext(Dispatchers.IO) {
|
||||
resolver.openInputStream(fileUri)?.use { stream ->
|
||||
val importedEntries = TLE.importSat(stream).map { SatEntry(it) }
|
||||
val selection = entriesDao.getEntriesSelection()
|
||||
entriesDao.updateEntries(importedEntries)
|
||||
entriesDao.updateEntriesSelection(selection)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,7 +82,9 @@ class DefaultRepository @Inject constructor(
|
||||
val entries = TLE.importSat(stream).map { tle -> SatEntry(tle) }
|
||||
importedEntries.addAll(entries)
|
||||
}
|
||||
val selection = entriesDao.getEntriesSelection()
|
||||
entriesDao.updateEntries(importedEntries)
|
||||
entriesDao.updateEntriesSelection(selection)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@ interface EntriesDao {
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insertEntries(entries: List<SatEntry>)
|
||||
|
||||
@Query("SELECT catNum FROM entries WHERE isSelected = 1")
|
||||
suspend fun getEntriesSelection(): List<Int>
|
||||
|
||||
@Transaction
|
||||
suspend fun updateEntriesSelection(satIds: List<Int>) {
|
||||
clearSelection()
|
||||
|
||||
Reference in new issue
Block a user