Integrated the data update fix from v3.1.3

This commit is contained in:
Arty Bishop committed 2025-12-27 15:01:45 +00:00
1 parent 7e2b3bc712
commit 9bb73f28b7
7 files changed
+55 -43

No files matched your search

+3 -2
View File
@@ -12,8 +12,8 @@ android {
applicationId "com.rtbishop.look4sat" applicationId "com.rtbishop.look4sat"
minSdk 21 minSdk 21
targetSdk 33 targetSdk 33
versionCode 312 versionCode 313
versionName "3.1.2" versionName '3.1.3'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
@@ -69,6 +69,7 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
implementation "androidx.navigation:navigation-compose:$navigation_version" implementation "androidx.navigation:navigation-compose:$navigation_version"
// Utility // Utility
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
implementation "org.osmdroid:osmdroid-android:$osmdroid_version" implementation "org.osmdroid:osmdroid-android:$osmdroid_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version" debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version" debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
@@ -27,6 +27,7 @@ import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.SupervisorJob
import okhttp3.OkHttpClient
import org.osmdroid.config.Configuration import org.osmdroid.config.Configuration
class MainContainer(private val context: Context) { class MainContainer(private val context: Context) {
@@ -57,8 +58,9 @@ class MainContainer(private val context: Context) {
} }
private fun provideDatabaseRepo(): IDatabaseRepo { private fun provideDatabaseRepo(): IDatabaseRepo {
val httpClient = OkHttpClient.Builder().build()
val dataParser = DataParser(Dispatchers.Default) val dataParser = DataParser(Dispatchers.Default)
val dataSource = DataSource(context.contentResolver, Dispatchers.IO) val dataSource = DataSource(context.contentResolver, httpClient, Dispatchers.IO)
return DatabaseRepo(Dispatchers.Default, dataParser, dataSource, localStorage, settingsRepo) return DatabaseRepo(Dispatchers.Default, dataParser, dataSource, localStorage, settingsRepo)
} }
@@ -22,18 +22,26 @@ import android.net.Uri
import com.rtbishop.look4sat.data.IDataSource import com.rtbishop.look4sat.data.IDataSource
import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import okhttp3.OkHttpClient
import okhttp3.Request
import java.io.InputStream import java.io.InputStream
import java.net.URL
class DataSource( class DataSource(
private val resolver: ContentResolver, private val dispatcher: CoroutineDispatcher private val contentResolver: ContentResolver,
private val httpClient: OkHttpClient,
private val dispatcher: CoroutineDispatcher
) : IDataSource { ) : IDataSource {
override suspend fun getFileStream(uri: String): InputStream? { override suspend fun getFileStream(uri: String): InputStream? {
return withContext(dispatcher) { resolver.openInputStream(Uri.parse(uri)) } return withContext(dispatcher) { contentResolver.openInputStream(Uri.parse(uri)) }
} }
override suspend fun getNetworkStream(url: String): InputStream? { override suspend fun getNetworkStream(url: String): InputStream? = withContext(dispatcher) {
return withContext(dispatcher) { URL(url).openStream() } try {
val request = Request.Builder().url(url).build()
httpClient.newCall(request).execute().body?.byteStream()
} catch (exception: Exception) {
null
}
} }
} }
@@ -28,32 +28,32 @@ interface ISettingsRepo {
val radioSourceUrl: String get() = "https://db.satnogs.org/api/transmitters/?format=json" val radioSourceUrl: String get() = "https://db.satnogs.org/api/transmitters/?format=json"
val satelliteSourcesMap: Map<String, String> val satelliteSourcesMap: Map<String, String>
get() = mapOf( get() = mapOf(
"All" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=active&FORMAT=csv", "All" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=active&FORMAT=csv",
"Amsat" to "https://amsat.org/tle/current/nasabare.txt", "Amsat" to "https://amsat.org/tle/current/nasabare.txt",
"Amateur" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=amateur&FORMAT=csv", "Amateur" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=amateur&FORMAT=csv",
"Classified" to "https://www.mmccants.org/tles/classfd.zip", "Classified" to "https://www.mmccants.org/tles/classfd.zip",
"Cubesat" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=cubesat&FORMAT=csv", "Cubesat" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=cubesat&FORMAT=csv",
"Education" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=education&FORMAT=csv", "Education" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=education&FORMAT=csv",
"Engineer" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=engineering&FORMAT=csv", "Engineer" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=engineering&FORMAT=csv",
"Geostationary" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=geo&FORMAT=csv", "Geostationary" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=geo&FORMAT=csv",
"Globalstar" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=globalstar&FORMAT=csv", "Globalstar" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=globalstar&FORMAT=csv",
"GNSS" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=gnss&FORMAT=csv", "GNSS" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=gnss&FORMAT=csv",
"Intelsat" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=intelsat&FORMAT=csv", "Intelsat" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=intelsat&FORMAT=csv",
"Iridium" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=iridium-NEXT&FORMAT=csv", "Iridium" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=iridium-NEXT&FORMAT=csv",
"McCants" to "https://www.mmccants.org/tles/inttles.zip", "McCants" to "https://www.mmccants.org/tles/inttles.zip",
"Military" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=military&FORMAT=csv", "Military" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=military&FORMAT=csv",
"New" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=last-30-days&FORMAT=csv", "New" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=last-30-days&FORMAT=csv",
"OneWeb" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=oneweb&FORMAT=csv", "OneWeb" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=oneweb&FORMAT=csv",
"Orbcomm" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=orbcomm&FORMAT=csv", "Orbcomm" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=orbcomm&FORMAT=csv",
"R4UAB" to "https://r4uab.ru/satonline.txt", "R4UAB" to "https://r4uab.ru/satonline.txt",
"Resource" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=resource&FORMAT=csv", "Resource" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=resource&FORMAT=csv",
"SatNOGS" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=satnogs&FORMAT=csv", "SatNOGS" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=satnogs&FORMAT=csv",
"Science" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=science&FORMAT=csv", "Science" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=science&FORMAT=csv",
"Spire" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=spire&FORMAT=csv", "Spire" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=spire&FORMAT=csv",
"Starlink" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=starlink&FORMAT=csv", "Starlink" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=starlink&FORMAT=csv",
"Swarm" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=swarm&FORMAT=csv", "Swarm" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=swarm&FORMAT=csv",
"Weather" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=weather&FORMAT=csv", "Weather" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=weather&FORMAT=csv",
"X-Comm" to "https://celestrak.com/NORAD/elements/gp.php?GROUP=x-comm&FORMAT=csv" "X-Comm" to "https://celestrak.org/NORAD/elements/gp.php?GROUP=x-comm&FORMAT=csv"
) )
//region # Station position settings //region # Station position settings
+11 -10
View File
@@ -1,27 +1,28 @@
buildscript { buildscript {
ext { ext {
gradle_plugin_version = '8.0.0' gradle_plugin_version = '8.0.2'
library_plugin_version = '7.1.2' library_plugin_version = '7.1.2'
ksp_version = '1.8.10-1.0.9' ksp_version = '1.8.21-1.0.11'
kotlin_android_version = '1.8.10' kotlin_android_version = '1.8.21'
// Android // Android
splashscreen_version = '1.0.0' splashscreen_version = '1.0.1'
room_version = '2.5.1' room_version = '2.5.1'
// Compose // Compose
activity_compose_version = '1.7.0' activity_compose_version = '1.7.2'
compose_version = '1.4.1' compose_version = '1.4.3'
compose_compiler_version = '1.4.5' compose_compiler_version = '1.4.7'
material3_version = '1.0.1' material3_version = '1.1.0'
lifecycle_version = '2.6.1' lifecycle_version = '2.6.1'
navigation_version = '2.5.3' navigation_version = '2.5.3'
// Utility // Utility
okhttp_version = '4.10.0'
osmdroid_version = '6.1.16' osmdroid_version = '6.1.16'
json_version = '20230227' json_version = '20230227'
leakcanary_version = '2.10' leakcanary_version = '2.11'
// Test // Test
junit_version = '4.13.2' junit_version = '4.13.2'
mockk_version = '1.13.5' mockk_version = '1.13.5'
coroutines_test_version = '1.6.4' coroutines_test_version = '1.7.1'
} }
} }
+1 -1
View File
@@ -21,7 +21,7 @@
# resources declared in the library itself and none from the library's dependencies, # resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library # thereby reducing the size of the R class for that library
#android.nonTransitiveRClass=true #android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=false android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=false android.enableJetifier=false
android.nonFinalResIds=false android.nonFinalResIds=false
android.nonTransitiveRClass=true android.nonTransitiveRClass=true
+2 -2
View File
@@ -1,6 +1,6 @@
#Fri Apr 14 10:44:38 BST 2023 #Fri Apr 21 15:31:10 BST 2023
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists