mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Switched to MVI architecture for PassesScreen
This commit is contained in:
1 parent
b9ade5f243
commit
a088a7a0a2
20 files changed
+203
-236
No files matched your search
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Look4Sat. Amateur radio satellite tracker and pass predictor.
|
||||
* Copyright (C) 2019-2022 Arty Bishop (bishop.arty@gmail.com)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.rtbishop.look4sat.domain.model
|
||||
|
||||
sealed class DataState<out T> {
|
||||
data class Success<out T>(val data: T) : DataState<T>()
|
||||
data class Exception(val message: String?) : DataState<Nothing>()
|
||||
data object Loading : DataState<Nothing>()
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package com.rtbishop.look4sat.domain.model
|
||||
|
||||
data class DatabaseState(val numberOfRadios: Int, val numberOfSatellites: Int, val updateTimestamp: Long)
|
||||
|
||||
data class PassesSettings(val filterHoursAhead: Int, val filterMinElevation: Double)
|
||||
data class PassesSettings(val hoursAhead: Int, val minElevation: Double, val selectedModes: List<String>)
|
||||
|
||||
data class OtherSettings(
|
||||
val stateOfAutoUpdate: Boolean,
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
package com.rtbishop.look4sat.domain.repository
|
||||
|
||||
interface IDatabaseRepo {
|
||||
|
||||
suspend fun updateFromFile(uri: String)
|
||||
|
||||
suspend fun updateFromRemote()
|
||||
|
||||
suspend fun clearAllData()
|
||||
}
|
||||
@@ -8,24 +8,13 @@ import com.rtbishop.look4sat.domain.predict.Satellite
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
interface ISatelliteRepo {
|
||||
|
||||
val passes: StateFlow<List<SatPass>>
|
||||
|
||||
val satellites: StateFlow<List<Satellite>>
|
||||
|
||||
suspend fun getRadiosWithId(id: Int): List<SatRadio>
|
||||
|
||||
suspend fun initRepository()
|
||||
|
||||
suspend fun getPosition(sat: Satellite, pos: GeoPos, time: Long): SatPos
|
||||
|
||||
suspend fun getTrack(sat: Satellite, pos: GeoPos, start: Long, end: Long): List<SatPos>
|
||||
|
||||
suspend fun processRadios(
|
||||
sat: Satellite, pos: GeoPos, radios: List<SatRadio>, time: Long
|
||||
): List<SatRadio>
|
||||
|
||||
suspend fun getRadios(sat: Satellite, pos: GeoPos, radios: List<SatRadio>, time: Long): List<SatRadio>
|
||||
suspend fun processPasses(passList: List<SatPass>, time: Long): List<SatPass>
|
||||
|
||||
suspend fun calculatePasses(time: Long, hoursAhead: Int = 8, minElevation: Double = 16.0)
|
||||
}
|
||||
@@ -4,20 +4,12 @@ import com.rtbishop.look4sat.domain.model.SatItem
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface ISelectionRepo {
|
||||
|
||||
fun getCurrentType(): String
|
||||
|
||||
fun getTypesList(): List<String>
|
||||
|
||||
suspend fun getEntriesFlow(): Flow<List<SatItem>>
|
||||
|
||||
suspend fun setType(type: String)
|
||||
|
||||
suspend fun setQuery(query: String)
|
||||
|
||||
suspend fun setSelection(selectAll: Boolean)
|
||||
|
||||
suspend fun setSelection(ids: List<Int>, isTicked: Boolean)
|
||||
|
||||
suspend fun saveSelection()
|
||||
}
|
||||
@@ -63,9 +63,7 @@ interface ISettingsRepo {
|
||||
|
||||
//region # Passes filter settings
|
||||
val passesSettings: StateFlow<PassesSettings>
|
||||
fun getSelectedModes(): List<String>
|
||||
fun setSelectedModes(modes: List<String>)
|
||||
fun updatePassesSettings(settings: PassesSettings)
|
||||
fun setPassesSettings(settings: PassesSettings)
|
||||
//endregion
|
||||
|
||||
//region # Station position settings
|
||||
|
||||
@@ -23,22 +23,13 @@ import com.rtbishop.look4sat.domain.model.SatRadio
|
||||
import com.rtbishop.look4sat.domain.predict.Satellite
|
||||
|
||||
interface ILocalSource {
|
||||
|
||||
suspend fun getEntriesTotal(): Int
|
||||
|
||||
suspend fun getEntriesList(): List<SatItem>
|
||||
|
||||
suspend fun getEntriesWithIds(ids: List<Int>): List<Satellite>
|
||||
|
||||
suspend fun insertEntries(entries: List<SatEntry>)
|
||||
|
||||
suspend fun deleteEntries()
|
||||
|
||||
suspend fun getRadiosTotal(): Int
|
||||
|
||||
suspend fun getRadiosWithId(id: Int): List<SatRadio>
|
||||
|
||||
suspend fun insertRadios(radios: List<SatRadio>)
|
||||
|
||||
suspend fun deleteRadios()
|
||||
}
|
||||
@@ -3,10 +3,7 @@ package com.rtbishop.look4sat.domain.source
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
interface ISensorSource {
|
||||
|
||||
val orientation: StateFlow<Pair<Float, Float>>
|
||||
|
||||
fun enableSensor()
|
||||
|
||||
fun disableSensor()
|
||||
}
|
||||
Reference in new issue
Block a user