Skip to content

Commit

Permalink
v3.1.1 - R4UAB source, minor fixes, libs update
Browse files Browse the repository at this point in the history
  • Loading branch information
rt-bishop committed Aug 7, 2022
1 parent bf1ac5f commit bbb89b7
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 254 deletions.
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ android {
applicationId "com.rtbishop.look4sat"
minSdk 21
targetSdk 31
versionCode 310
versionName '3.1.0'
resConfigs 'en,ru,zh_CN'
versionCode 311
versionName '3.1.1'

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class SettingsManager @Inject constructor(private val prefs: SharedPreferences)

companion object {
const val keyFirstEverLaunch = "isFirstEverLaunch"
const val keyDataSources = "dataSources"
const val keyModes = "satModes"
const val keyCompass = "compass"
const val keyRadarSweep = "radarSweep"
Expand Down Expand Up @@ -203,15 +202,6 @@ class SettingsManager @Inject constructor(private val prefs: SharedPreferences)
prefs.edit { putString(keyBTFormat, value) }
}

override fun loadDataSources(): List<String> {
val sourcesList = prefs.getStringSet(keyDataSources, null)?.toList()
return if (sourcesList.isNullOrEmpty()) defaultSources else sourcesList.sortedDescending()
}

override fun saveDataSources(sources: List<String>) {
if (sources.isNotEmpty()) prefs.edit { putStringSet(keyDataSources, sources.toSet()) }
}

private fun SharedPreferences.getDouble(key: String, default: Double): Double {
return Double.fromBits(getLong(key, default.toRawBits()))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class PassesViewModel @Inject constructor(
init {
viewModelScope.launch {
if (!settings.isFirstEverLaunchDone()) {
repository.updateFromWebNew()
repository.updateFromWeb()
settings.setFirstEverLaunchDone()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class SettingsViewModel @Inject constructor(
fun updateDataFromWeb() {
// settings.saveDataSources(sources)
// repository.updateFromWeb(sources)
repository.updateFromWebNew()
repository.updateFromWeb()
}

fun clearData() {
Expand Down

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions app/src/main/res/navigation/nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@
android:id="@+id/nav_settings"
android:name="com.rtbishop.look4sat.presentation.settingsScreen.SettingsFragment"
tools:layout="@layout/fragment_settings">
<action
android:id="@+id/settings_to_sources"
app:destination="@id/nav_sources"
app:enterAnim="@anim/nav_default_enter_anim"
app:exitAnim="@anim/nav_default_exit_anim"
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
</fragment>
<dialog
android:id="@+id/nav_modes"
Expand All @@ -70,10 +63,6 @@
android:id="@+id/nav_filter"
android:name="com.rtbishop.look4sat.presentation.passesScreen.FilterDialog"
tools:layout="@layout/dialog_filter" />
<dialog
android:id="@+id/nav_sources"
android:name="com.rtbishop.look4sat.presentation.settingsScreen.SourcesDialog"
tools:layout="@layout/dialog_sources" />
<dialog
android:id="@+id/nav_position"
android:name="com.rtbishop.look4sat.presentation.settingsScreen.PositionDialog"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ interface IDataRepository {

fun updateFromFile(uri: String)

fun updateFromWeb(urls: List<String>)

fun updateFromWebNew()
fun updateFromWeb()

fun setUpdateStateHandled()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ import com.rtbishop.look4sat.domain.predict.GeoPos

interface ISettingsManager {

val defaultSources: List<String>
get() = listOf(
"https://www.prismnet.com/~mmccants/tles/inttles.zip",
"https://www.prismnet.com/~mmccants/tles/classfd.zip",
"https://celestrak.com/NORAD/elements/gp.php?GROUP=active&FORMAT=csv",
"https://amsat.org/tle/current/nasabare.txt"
)
val sourcesMap: Map<String, String>
get() = mapOf(
"All" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=active&FORMAT=csv",
Expand All @@ -47,6 +40,7 @@ interface ISettingsManager {
"New" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=last-30-days&FORMAT=csv",
"OneWeb" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=oneweb&FORMAT=csv",
"Orbcomm" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=orbcomm&FORMAT=csv",
"R4UAB" to "https://r4uab.ru/satonline.txt",
"Resource" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=resource&FORMAT=csv",
"SatNOGS" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=satnogs&FORMAT=csv",
"Science" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=science&FORMAT=csv",
Expand Down Expand Up @@ -128,8 +122,4 @@ interface ISettingsManager {
fun getBTFormat(): String

fun setBTFormat(value: String)

fun loadDataSources(): List<String>

fun saveDataSources(sources: List<String>)
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,38 +66,7 @@ class DataRepository(
}
}

override fun updateFromWeb(urls: List<String>) {
_updateState.value = DataState.Loading
repositoryScope.launch(exceptionHandler) {
val streams = mutableListOf<InputStream>()
val entries = mutableListOf<SatEntry>()
val jobs = urls.associateWith { url -> async { remoteSource.getDataStream(url) } }
jobs.mapValues { job -> job.value.await() }.forEach { result ->
result.value?.let { stream ->
when {
result.key.contains("=csv", true) -> {
val orbitalData = dataParser.parseCSVStream(stream)
entries.addAll(orbitalData.map { data -> SatEntry(data) })
}
result.key.contains(".zip", true) -> {
streams.add(ZipInputStream(stream).apply { nextEntry })
}
else -> streams.add(stream)
}
}
}
streams.forEach { stream -> entries.addAll(importSatellites(stream)) }
entrySource.insertEntries(entries)
}
repositoryScope.launch(exceptionHandler) {
remoteSource.getDataStream(remoteSource.radioApi)?.let { stream ->
radioSource.insertRadios(dataParser.parseJSONStream(stream))
_updateState.value = DataState.Success(0L)
}
}
}

override fun updateFromWebNew() {
override fun updateFromWeb() {
_updateState.value = DataState.Loading
repositoryScope.launch(exceptionHandler) {
val importedEntries = mutableListOf<SatEntry>()
Expand All @@ -106,7 +75,7 @@ class DataRepository(
jobsMap.mapValues { job -> job.value.await() }.forEach { entry ->
entry.value?.let { stream ->
when (val type = entry.key) {
"AMSAT" -> {
"AMSAT", "R4UAB" -> {
// parse tle stream
val satellites = importSatellites(stream)
val catnums = satellites.map { it.data.catnum }
Expand Down
18 changes: 9 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
buildscript {
ext {
hilt_version = '2.42'
hilt_version = '2.43.2'
safe_args_version = '2.4.1'
application_version = '7.2.1'
application_version = '7.2.2'
library_version = '7.1.2'
kotlin_android_version = '1.6.10'
core_ktx_version = '1.8.0'
core_splashscreen_version = '1.0.0-rc01'
core_splashscreen_version = '1.0.0'
constraint_version = '2.1.4'
lifecycle_version = '2.4.1'
navigation_version = '2.4.2'
room_version = '2.4.2'
lifecycle_version = '2.5.1'
navigation_version = '2.5.1'
room_version = '2.4.3'
material_version = '1.6.1'
osmdroid_version = '6.1.13'
json_version = '20220320'
compose_version = '1.1.1'
activity_compose_version = '1.4.0'
material_adapter_version = '1.1.10'
fragment_test_version = '1.4.1'
fragment_test_version = '1.5.1'
leakcanary_version = '2.9.1'
junit_version = '4.13.2'
mockito_version = '4.6.0'
mockito_version = '4.6.1'
robolectric_version = '4.8.1'
coroutines_test_version = '1.6.2'
coroutines_test_version = '1.6.4'
androidx_test_version = '1.4.0'
androidx_junit_version = '1.1.3'
espresso_version = '3.4.0'
Expand Down
5 changes: 5 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/311.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Re-enabled the rotator control switch (fix)
Increased radar sweep rotation speed
Fixed negative lat/lon manual input bug
Added R4UAB TLE source and category
Updated libraries and dependencies
11 changes: 5 additions & 6 deletions fastlane/metadata/android/en-US/whatsnew/whatsnew-en-US
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Integrated AJohns bluetooth reporting function
Ref - https://github.com/rt-bishop/Look4Sat/pull/87
Integrated BA7LWN Simplified Chinese translation
Ref - https://github.com/rt-bishop/Look4Sat/pull/92
Added satellites sorting by their reported categories
Removed custom sources dialog, use file import instead
Re-enabled the rotator control switch (fix)
Increased radar sweep rotation speed
Fixed negative lat/lon manual input bug
Added R4UAB TLE source and category
Updated libraries and dependencies
Loading

0 comments on commit bbb89b7

Please sign in to comment.