Now clearing satellite transceivers data on update

This commit is contained in:
Arty Bishop committed 2021-03-27 19:32:47 +00:00
1 parent 76dce66a4a
commit 040ad844f5
4 files changed
+13 -5

No files matched your search

@@ -33,7 +33,7 @@ interface SatelliteDao {
@Query("SELECT catNum, name, isSelected FROM entries ORDER BY name ASC")
fun getAllSatItems(): Flow<List<SatItem>>
@Query("SELECT * FROM transmitters WHERE isAlive = 1 and catNum = :catNum")
@Query("SELECT * FROM transmitters WHERE catNum = :catNum")
fun getTransmittersByCatNum(catNum: Int): Flow<List<SatTrans>>
@Query("SELECT tle FROM entries WHERE isSelected = 1")
@@ -47,6 +47,12 @@ interface SatelliteDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertEntries(entries: List<SatEntry>)
@Transaction
suspend fun updateTransmitters(transmitters: List<SatTrans>) {
deleteTransmitters()
insertTransmitters(transmitters)
}
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertTransmitters(transmitters: List<SatTrans>)
@@ -87,8 +87,8 @@ class SatelliteRepo @Inject constructor(
}
private suspend fun importTransmitters() {
val transmitters = satelliteService.fetchTransmitters()
satelliteDao.insertTransmitters(transmitters)
val transmitters = satelliteService.fetchTransmitters().filter { it.isAlive }
satelliteDao.updateTransmitters(transmitters)
}
private suspend fun getStreamsForSources(sources: List<TleSource>): List<InputStream> {
+2 -1
View File
@@ -20,6 +20,8 @@
<string name="entries_no_data">Пожалуйста, обновите спутники</string>
<string name="entries_update_error">Ошибка обновления спутников</string>
<string name="modes_title">Выберите модуляцию трансивера</string>
<string name="passes_error">Нет предстоящих пролётов</string>
<string name="pass_aosAz">НПС - %.1f°</string>
@@ -79,5 +81,4 @@
к ним по лицензии <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache-2.0</a></string>
<string name="info_warranty"><a href="https://sites.google.com/view/look4sat-privacy-policy/home">Политика конфиденциальности</a>
\nЭто ПО поставляется без гарантий. \nПодробности в лицензии <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU GPLv3</a>.</string>
<string name="modes_title">Выберите модуляцию трансивера</string>
</resources>
+2 -1
View File
@@ -23,6 +23,8 @@
<string name="entries_no_data">Please update TLE data</string>
<string name="entries_update_error">Error importing satellite data</string>
<string name="modes_title">Choose transceiver mode</string>
<string name="timer_zero" translatable="false">00:00:00</string>
<string name="timer_placeholder" translatable="false">-</string>
@@ -99,5 +101,4 @@
</string>
<string name="info_warranty"><a href="https://sites.google.com/view/look4sat-privacy-policy/home">Privacy Policy</a>
\nThis app comes with no warranty. \nSee the <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU GPLv3</a> license for details.</string>
<string name="modes_title">Choose transmitter mode</string>
</resources>