mirror of
https://github.com/rt-bishop/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Added mockito dependency, fixed radar view update bug #51
This commit is contained in:
1 parent
4cfab17413
commit
1806e0d147
13 files changed
+31
-31
No files matched your search
@@ -13,5 +13,6 @@ dependencies {
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
|
||||
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation "org.mockito:mockito-core:$mockito_version"
|
||||
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_test_version"
|
||||
}
|
||||
@@ -31,7 +31,7 @@ class DefaultSatelliteRepo(
|
||||
return localSource.getSelectedSatellites()
|
||||
}
|
||||
|
||||
override suspend fun importDataFromFile(stream: InputStream) = withContext(ioDispatcher) {
|
||||
override suspend fun importDataFromStream(stream: InputStream) = withContext(ioDispatcher) {
|
||||
val importedEntries = Satellite.importElements(stream).map { tle -> SatEntry(tle) }
|
||||
localSource.updateEntries(importedEntries)
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class DefaultSatelliteRepo(
|
||||
val importedEntries = mutableListOf<SatEntry>()
|
||||
val streams = mutableListOf<InputStream>()
|
||||
sources.forEach { source ->
|
||||
remoteSource.fetchFileStream(source)?.let { stream ->
|
||||
remoteSource.fetchDataStream(source)?.let { stream ->
|
||||
if (source.contains(".zip", true)) {
|
||||
val zipStream = ZipInputStream(stream).apply { nextEntry }
|
||||
streams.add(zipStream)
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.io.InputStream
|
||||
|
||||
interface RemoteDataSource {
|
||||
|
||||
suspend fun fetchFileStream(url: String): InputStream?
|
||||
suspend fun fetchDataStream(url: String): InputStream?
|
||||
|
||||
suspend fun fetchTransmitters(): List<SatTrans>
|
||||
}
|
||||
@@ -14,7 +14,7 @@ interface SatelliteRepo {
|
||||
|
||||
suspend fun getSelectedSatellites(): List<Satellite>
|
||||
|
||||
suspend fun importDataFromFile(stream: InputStream)
|
||||
suspend fun importDataFromStream(stream: InputStream)
|
||||
|
||||
suspend fun importDataFromWeb(sources: List<String>)
|
||||
|
||||
|
||||
@@ -21,5 +21,5 @@ data class StationPosition(
|
||||
val latitude: Double,
|
||||
val longitude: Double,
|
||||
val altitude: Double,
|
||||
val name: String = "base"
|
||||
val name: String = "default"
|
||||
)
|
||||
+2
-2
@@ -3,9 +3,9 @@ package com.rtbishop.look4sat.interactors
|
||||
import com.rtbishop.look4sat.domain.SatelliteRepo
|
||||
import java.io.InputStream
|
||||
|
||||
class ImportDataFromFile(private val satelliteRepo: SatelliteRepo) {
|
||||
class ImportDataFromStream(private val satelliteRepo: SatelliteRepo) {
|
||||
|
||||
suspend operator fun invoke(stream: InputStream) {
|
||||
satelliteRepo.importDataFromFile(stream)
|
||||
satelliteRepo.importDataFromStream(stream)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user