mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Removed interacting use cases for the sake of code simplicity
This commit is contained in:
1 parent
0110de8104
commit
c91c58ac69
12 files changed
+28
-159
No files matched your search
@@ -17,6 +17,12 @@ class SatelliteRepo(
|
||||
private val remoteSource: RemoteDataSource,
|
||||
private val ioDispatcher: CoroutineDispatcher
|
||||
) {
|
||||
private val defaultSources = listOf(
|
||||
"https://celestrak.com/NORAD/elements/active.txt",
|
||||
"https://amsat.org/tle/current/nasabare.txt",
|
||||
"https://www.prismnet.com/~mmccants/tles/classfd.zip",
|
||||
"https://www.prismnet.com/~mmccants/tles/inttles.zip"
|
||||
)
|
||||
|
||||
fun getSatItems(): Flow<List<SatItem>> {
|
||||
return localSource.getSatItems()
|
||||
@@ -34,7 +40,7 @@ class SatelliteRepo(
|
||||
localSource.updateEntries(importSatEntries(stream))
|
||||
}
|
||||
|
||||
suspend fun updateEntriesFromWeb(sources: List<String>) {
|
||||
suspend fun updateEntriesFromWeb(sources: List<String> = defaultSources) {
|
||||
coroutineScope {
|
||||
launch(ioDispatcher) {
|
||||
val streams = mutableListOf<InputStream>()
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.rtbishop.look4sat.interactors
|
||||
|
||||
import com.rtbishop.look4sat.data.SatelliteRepo
|
||||
import com.rtbishop.look4sat.domain.model.SatItem
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
class GetSatItems(private val satelliteRepo: SatelliteRepo) {
|
||||
|
||||
operator fun invoke(): Flow<List<SatItem>> {
|
||||
return satelliteRepo.getSatItems()
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.rtbishop.look4sat.interactors
|
||||
|
||||
import com.rtbishop.look4sat.data.SatelliteRepo
|
||||
import com.rtbishop.look4sat.domain.model.SatTrans
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
class GetSatTransmitters(private val satelliteRepo: SatelliteRepo) {
|
||||
|
||||
operator fun invoke(catNum: Int): Flow<List<SatTrans>> {
|
||||
return satelliteRepo.getSatTransmitters(catNum)
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.rtbishop.look4sat.interactors
|
||||
|
||||
import com.rtbishop.look4sat.data.SatelliteRepo
|
||||
import com.rtbishop.look4sat.domain.predict4kotlin.Satellite
|
||||
|
||||
class GetSelectedSatellites(private val satelliteRepo: SatelliteRepo) {
|
||||
|
||||
suspend operator fun invoke(): List<Satellite> {
|
||||
return satelliteRepo.getSelectedSatellites()
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.rtbishop.look4sat.interactors
|
||||
|
||||
import com.rtbishop.look4sat.data.SatelliteRepo
|
||||
import java.io.InputStream
|
||||
|
||||
class UpdateEntriesFromFile(private val satelliteRepo: SatelliteRepo) {
|
||||
|
||||
suspend operator fun invoke(stream: InputStream) {
|
||||
satelliteRepo.updateEntriesFromFile(stream)
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.rtbishop.look4sat.interactors
|
||||
|
||||
import com.rtbishop.look4sat.data.SatelliteRepo
|
||||
|
||||
class UpdateEntriesFromWeb(private val satelliteRepo: SatelliteRepo) {
|
||||
|
||||
private val defaultSources = listOf(
|
||||
"https://celestrak.com/NORAD/elements/active.txt",
|
||||
"https://amsat.org/tle/current/nasabare.txt",
|
||||
"https://www.prismnet.com/~mmccants/tles/classfd.zip",
|
||||
"https://www.prismnet.com/~mmccants/tles/inttles.zip"
|
||||
)
|
||||
|
||||
suspend operator fun invoke(sources: List<String> = defaultSources) {
|
||||
satelliteRepo.updateEntriesFromWeb(sources)
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.rtbishop.look4sat.interactors
|
||||
|
||||
import com.rtbishop.look4sat.data.SatelliteRepo
|
||||
|
||||
class UpdateEntriesSelection(private val satelliteRepo: SatelliteRepo) {
|
||||
|
||||
suspend operator fun invoke(catNums: List<Int>, isSelected: Boolean) {
|
||||
satelliteRepo.updateEntriesSelection(catNums, isSelected)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user