mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Added database migration, removed moshi and Converters.kt
This commit is contained in:
1 parent
9baaf38a49
commit
253321f3c2
39 files changed
+400
-237
No files matched your search
@@ -2,6 +2,15 @@ plugins {
|
||||
id 'kotlin'
|
||||
}
|
||||
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "$jvm_version"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ class DataRepository(
|
||||
return localSource.getEntriesWithModes()
|
||||
}
|
||||
|
||||
override fun getSatTransmitters(catNum: Int): Flow<List<Transmitter>> {
|
||||
return localSource.getTransmitters(catNum)
|
||||
override fun getTransmitters(catnum: Int): Flow<List<Transmitter>> {
|
||||
return localSource.getTransmitters(catnum)
|
||||
}
|
||||
|
||||
override fun getDefaultSources(): List<String> {
|
||||
@@ -97,8 +97,8 @@ class DataRepository(
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun updateEntriesSelection(catNums: List<Int>, isSelected: Boolean) {
|
||||
localSource.updateEntriesSelection(catNums, isSelected)
|
||||
override suspend fun updateEntriesSelection(catnums: List<Int>, isSelected: Boolean) {
|
||||
localSource.updateEntriesSelection(catnums, isSelected)
|
||||
}
|
||||
|
||||
private fun importSatEntries(stream: InputStream): List<SatEntry> {
|
||||
|
||||
@@ -25,19 +25,22 @@ import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface LocalDataSource {
|
||||
|
||||
// Entries
|
||||
fun getEntriesWithModes(): Flow<List<SatItem>>
|
||||
|
||||
fun getTransmitters(catNum: Int): Flow<List<Transmitter>>
|
||||
|
||||
suspend fun getSources(): List<String>
|
||||
|
||||
suspend fun getSelectedSatellites(): List<Satellite>
|
||||
|
||||
suspend fun updateEntries(entries: List<SatEntry>)
|
||||
|
||||
suspend fun updateEntriesSelection(catNums: List<Int>, isSelected: Boolean)
|
||||
suspend fun updateEntriesSelection(catnums: List<Int>, isSelected: Boolean)
|
||||
|
||||
// Sources
|
||||
suspend fun getSources(): List<String>
|
||||
|
||||
suspend fun updateSources(sources: List<String>)
|
||||
|
||||
// Transmitters
|
||||
fun getTransmitters(catnum: Int): Flow<List<Transmitter>>
|
||||
|
||||
suspend fun updateTransmitters(transmitters: List<Transmitter>)
|
||||
}
|
||||
@@ -27,7 +27,7 @@ interface SatelliteRepo {
|
||||
|
||||
fun getSatItems(): Flow<List<SatItem>>
|
||||
|
||||
fun getSatTransmitters(catNum: Int): Flow<List<Transmitter>>
|
||||
fun getTransmitters(catnum: Int): Flow<List<Transmitter>>
|
||||
|
||||
fun getDefaultSources(): List<String>
|
||||
|
||||
@@ -39,5 +39,5 @@ interface SatelliteRepo {
|
||||
|
||||
suspend fun updateEntriesFromWeb(sources: List<String>)
|
||||
|
||||
suspend fun updateEntriesSelection(catNums: List<Int>, isSelected: Boolean)
|
||||
suspend fun updateEntriesSelection(catnums: List<Int>, isSelected: Boolean)
|
||||
}
|
||||
@@ -21,7 +21,5 @@ import com.rtbishop.look4sat.domain.predict.TLE
|
||||
|
||||
data class SatEntry(
|
||||
val tle: TLE,
|
||||
val catNum: Int = tle.catnum,
|
||||
val name: String = tle.name,
|
||||
var isSelected: Boolean = false
|
||||
)
|
||||
@@ -18,7 +18,7 @@
|
||||
package com.rtbishop.look4sat.domain.model
|
||||
|
||||
data class SatItem(
|
||||
val catNum: Int,
|
||||
val catnum: Int,
|
||||
val name: String,
|
||||
var isSelected: Boolean,
|
||||
val modes: List<String>
|
||||
|
||||
@@ -25,5 +25,5 @@ data class Transmitter(
|
||||
var uplink: Long?,
|
||||
val mode: String?,
|
||||
val isInverted: Boolean,
|
||||
val catNum: Int?
|
||||
val catnum: Int?
|
||||
)
|
||||
@@ -30,14 +30,14 @@ data class TLE(
|
||||
val argper: Double,
|
||||
val meanan: Double,
|
||||
val catnum: Int,
|
||||
val bstar: Double
|
||||
) {
|
||||
val xincl: Double = Math.toRadians(incl)
|
||||
val xnodeo: Double = Math.toRadians(raan)
|
||||
val omegao: Double = Math.toRadians(argper)
|
||||
val xmo: Double = Math.toRadians(meanan)
|
||||
val xno: Double = meanmo * Math.PI * 2.0 / 1440
|
||||
val bstar: Double,
|
||||
val xincl: Double = Math.toRadians(incl),
|
||||
val xnodeo: Double = Math.toRadians(raan),
|
||||
val omegao: Double = Math.toRadians(argper),
|
||||
val xmo: Double = Math.toRadians(meanan),
|
||||
val xno: Double = meanmo * Math.PI * 2.0 / 1440,
|
||||
val isDeepspace: Boolean = meanmo < 6.4
|
||||
) {
|
||||
|
||||
fun createSat(): Satellite {
|
||||
return when {
|
||||
|
||||
Reference in new issue
Block a user