kopia lustrzana https://github.com/rt-bishop/Look4Sat
Updated gradle plugin, removed BuildConfig usages
rodzic
6fbe5c2df8
commit
96ea0779e8
|
@ -21,7 +21,6 @@ android {
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
buildConfig = true
|
|
||||||
compose = true
|
compose = true
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -31,7 +30,7 @@ android {
|
||||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
composeOptions { kotlinCompilerExtensionVersion = "1.5.1" }
|
composeOptions { kotlinCompilerExtensionVersion = "1.5.2" }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -45,12 +44,12 @@ dependencies {
|
||||||
|
|
||||||
implementation("androidx.activity:activity-compose:1.7.2")
|
implementation("androidx.activity:activity-compose:1.7.2")
|
||||||
implementation("androidx.compose.animation:animation:1.5.0")
|
implementation("androidx.compose.animation:animation:1.5.0")
|
||||||
implementation("androidx.compose.compiler:compiler:1.5.1")
|
implementation("androidx.compose.compiler:compiler:1.5.2")
|
||||||
implementation("androidx.compose.material3:material3:1.1.1")
|
implementation("androidx.compose.material3:material3:1.1.1")
|
||||||
implementation("androidx.compose.runtime:runtime:1.5.0")
|
implementation("androidx.compose.runtime:runtime:1.5.0")
|
||||||
implementation("androidx.compose.ui:ui-tooling-preview:1.5.0")
|
implementation("androidx.compose.ui:ui-tooling-preview:1.5.0")
|
||||||
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1")
|
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1")
|
||||||
implementation("androidx.navigation:navigation-compose:2.7.0")
|
implementation("androidx.navigation:navigation-compose:2.7.1")
|
||||||
|
|
||||||
implementation("com.squareup.okhttp3:okhttp:4.10.0")
|
implementation("com.squareup.okhttp3:okhttp:4.10.0")
|
||||||
implementation("org.osmdroid:osmdroid-android:6.1.16")
|
implementation("org.osmdroid:osmdroid-android:6.1.16")
|
||||||
|
@ -59,7 +58,7 @@ dependencies {
|
||||||
debugImplementation("com.squareup.leakcanary:leakcanary-android:2.12")
|
debugImplementation("com.squareup.leakcanary:leakcanary-android:2.12")
|
||||||
|
|
||||||
testImplementation("junit:junit:4.13.2")
|
testImplementation("junit:junit:4.13.2")
|
||||||
testImplementation("io.mockk:mockk:1.13.5")
|
testImplementation("io.mockk:mockk:1.13.7")
|
||||||
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
|
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
|
||||||
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.5.0")
|
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.5.0")
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package com.rtbishop.look4sat
|
package com.rtbishop.look4sat
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
|
import android.content.pm.ApplicationInfo
|
||||||
import android.os.StrictMode
|
import android.os.StrictMode
|
||||||
import android.os.StrictMode.ThreadPolicy
|
import android.os.StrictMode.ThreadPolicy
|
||||||
import android.os.StrictMode.VmPolicy
|
import android.os.StrictMode.VmPolicy
|
||||||
|
@ -31,7 +32,7 @@ class MainApplication : Application() {
|
||||||
lateinit var container: MainContainer
|
lateinit var container: MainContainer
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
if (BuildConfig.DEBUG) enableStrictMode()
|
enableStrictMode()
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
container = MainContainer(this)
|
container = MainContainer(this)
|
||||||
container.mainScope.launch { checkAutoUpdate() }
|
container.mainScope.launch { checkAutoUpdate() }
|
||||||
|
@ -50,8 +51,11 @@ class MainApplication : Application() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun enableStrictMode() {
|
private fun enableStrictMode() {
|
||||||
StrictMode.setThreadPolicy(ThreadPolicy.Builder().detectAll().penaltyLog().build())
|
val isDebuggable = 0 != applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE
|
||||||
StrictMode.setVmPolicy(VmPolicy.Builder().detectAll().penaltyLog().build())
|
if (isDebuggable) {
|
||||||
|
StrictMode.setThreadPolicy(ThreadPolicy.Builder().detectAll().penaltyLog().build())
|
||||||
|
StrictMode.setVmPolicy(VmPolicy.Builder().detectAll().penaltyLog().build())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -33,7 +33,6 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
import com.rtbishop.look4sat.BuildConfig
|
|
||||||
import com.rtbishop.look4sat.R
|
import com.rtbishop.look4sat.R
|
||||||
import com.rtbishop.look4sat.domain.model.OtherSettings
|
import com.rtbishop.look4sat.domain.model.OtherSettings
|
||||||
import com.rtbishop.look4sat.domain.predict.GeoPos
|
import com.rtbishop.look4sat.domain.predict.GeoPos
|
||||||
|
@ -113,8 +112,9 @@ fun SettingsScreen() {
|
||||||
val toggleSensor = { value: Boolean -> viewModel.toggleSensor(value) }
|
val toggleSensor = { value: Boolean -> viewModel.toggleSensor(value) }
|
||||||
|
|
||||||
// Screen setup
|
// Screen setup
|
||||||
|
val versionName = context.packageManager.getPackageInfo(context.packageName, 0).versionName ?: "4.0.0"
|
||||||
LazyColumn(modifier = Modifier.padding(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
LazyColumn(modifier = Modifier.padding(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||||
item { CardAbout(BuildConfig.VERSION_NAME) }
|
item { CardAbout(versionName) }
|
||||||
item { LocationCard(positionSettings, setGpsPos, showPosDialog, showLocDialog, dismissPos) }
|
item { LocationCard(positionSettings, setGpsPos, showPosDialog, showLocDialog, dismissPos) }
|
||||||
item { DataCard(dataSettings, updateFromWeb, updateFromFile, clearAllData) }
|
item { DataCard(dataSettings, updateFromWeb, updateFromFile, clearAllData) }
|
||||||
item { OtherCard(otherSettings, toggleUtc, toggleUpdate, toggleSweep, toggleSensor) }
|
item { OtherCard(otherSettings, toggleUtc, toggleUpdate, toggleSweep, toggleSensor) }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application") version "8.1.0" apply false
|
id("com.android.application") version "8.1.1" apply false
|
||||||
id("com.android.library") version "8.1.0" apply false
|
id("com.android.library") version "8.1.1" apply false
|
||||||
id("com.google.devtools.ksp") version "1.9.0-1.0.13" apply false
|
id("com.google.devtools.ksp") version "1.9.0-1.0.13" apply false
|
||||||
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
|
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
|
||||||
id("org.jetbrains.kotlin.jvm") version "1.9.0" apply false
|
id("org.jetbrains.kotlin.jvm") version "1.9.0" apply false
|
||||||
|
|
|
@ -29,7 +29,7 @@ dependencies {
|
||||||
implementation("com.squareup.okhttp3:okhttp:4.10.0")
|
implementation("com.squareup.okhttp3:okhttp:4.10.0")
|
||||||
|
|
||||||
testImplementation("junit:junit:4.13.2")
|
testImplementation("junit:junit:4.13.2")
|
||||||
testImplementation("io.mockk:mockk:1.13.5")
|
testImplementation("io.mockk:mockk:1.13.7")
|
||||||
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
|
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
|
||||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||||
|
|
|
@ -48,11 +48,10 @@ class DatabaseRepo(
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun updateFromRemote() = withContext(dispatcher) {
|
override suspend fun updateFromRemote() = withContext(dispatcher) {
|
||||||
val sourcesMap = settingsRepo.satelliteSourcesMap
|
|
||||||
val importedEntries = mutableListOf<SatEntry>()
|
val importedEntries = mutableListOf<SatEntry>()
|
||||||
val importedRadios = mutableListOf<SatRadio>()
|
val importedRadios = mutableListOf<SatRadio>()
|
||||||
// fetch
|
// fetch
|
||||||
val jobsMap = sourcesMap.mapValues { async { remoteSource.getRemoteStream(it.value) } }
|
val jobsMap = settingsRepo.satelliteSourcesMap.mapValues { async { remoteSource.getRemoteStream(it.value) } }
|
||||||
val jobRadios = async { remoteSource.getRemoteStream(settingsRepo.radioSourceUrl) }
|
val jobRadios = async { remoteSource.getRemoteStream(settingsRepo.radioSourceUrl) }
|
||||||
// parse
|
// parse
|
||||||
jobsMap.mapValues { job -> job.value.await() }.forEach { entry ->
|
jobsMap.mapValues { job -> job.value.await() }.forEach { entry ->
|
||||||
|
|
|
@ -11,6 +11,6 @@ dependencies {
|
||||||
implementation("org.json:json:20230618")
|
implementation("org.json:json:20230618")
|
||||||
|
|
||||||
testImplementation("junit:junit:4.13.2")
|
testImplementation("junit:junit:4.13.2")
|
||||||
testImplementation("io.mockk:mockk:1.13.5")
|
testImplementation("io.mockk:mockk:1.13.7")
|
||||||
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
|
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ class DataParserTest {
|
||||||
private val validCSVStream = """
|
private val validCSVStream = """
|
||||||
OBJECT_NAME,OBJECT_ID,EPOCH,MEAN_MOTION,ECCENTRICITY,INCLINATION,RA_OF_ASC_NODE,ARG_OF_PERICENTER,MEAN_ANOMALY,EPHEMERIS_TYPE,CLASSIFICATION_TYPE,NORAD_CAT_ID,ELEMENT_SET_NO,REV_AT_EPOCH,BSTAR,MEAN_MOTION_DOT,MEAN_MOTION_DDOT
|
OBJECT_NAME,OBJECT_ID,EPOCH,MEAN_MOTION,ECCENTRICITY,INCLINATION,RA_OF_ASC_NODE,ARG_OF_PERICENTER,MEAN_ANOMALY,EPHEMERIS_TYPE,CLASSIFICATION_TYPE,NORAD_CAT_ID,ELEMENT_SET_NO,REV_AT_EPOCH,BSTAR,MEAN_MOTION_DOT,MEAN_MOTION_DDOT
|
||||||
ISS (ZARYA),1998-067A,2021-11-16T12:28:09.322176,15.48582035,.0004694,51.6447,309.4881,203.6966,299.8876,0,U,25544,999,31220,.31985E-4,.1288E-4,0
|
ISS (ZARYA),1998-067A,2021-11-16T12:28:09.322176,15.48582035,.0004694,51.6447,309.4881,203.6966,299.8876,0,U,25544,999,31220,.31985E-4,.1288E-4,0
|
||||||
FLTSATCOM 8 (USA 46),1989-077A,2022-01-07T11:37:38.074080,1.00273350,.0001114,12.9044,1.3272,91.5769,260.4200,0,U,20253,999,24434,0,-.85E-6,0
|
|
||||||
""".trimIndent().byteInputStream()
|
""".trimIndent().byteInputStream()
|
||||||
private val invalidCSVStream = """
|
private val invalidCSVStream = """
|
||||||
ISS (ZARYA),1998-067A,2021-11-16T12:28:09.322176,15.48582035,.0004694,51.6447,309.4881,203.6966,299.8876,0,U,25544,999,31220,.31985E-4,.1288E-4,0
|
ISS (ZARYA),1998-067A,2021-11-16T12:28:09.322176,15.48582035,.0004694,51.6447,309.4881,203.6966,299.8876,0,U,25544,999,31220,.31985E-4,.1288E-4,0
|
||||||
|
@ -41,9 +40,6 @@ class DataParserTest {
|
||||||
ISS (ZARYA)
|
ISS (ZARYA)
|
||||||
1 25544U 98067A 21320.51955234 .00001288 00000+0 31985-4 0 9990
|
1 25544U 98067A 21320.51955234 .00001288 00000+0 31985-4 0 9990
|
||||||
2 25544 51.6447 309.4881 0004694 203.6966 299.8876 15.48582035312205
|
2 25544 51.6447 309.4881 0004694 203.6966 299.8876 15.48582035312205
|
||||||
FLTSATCOM 8 (USA 46)
|
|
||||||
1 20253U 89077A 22007.48446845 -.00000085 00000+0 00000+0 0 9999
|
|
||||||
2 20253 12.9044 1.3272 0001114 91.5769 260.4200 1.00273350244345
|
|
||||||
""".trimIndent().byteInputStream()
|
""".trimIndent().byteInputStream()
|
||||||
private val invalidTLEStream = """
|
private val invalidTLEStream = """
|
||||||
1 25544U 98067A 21320.51955234 .00001288 00000+0 31985-4 0 9990
|
1 25544U 98067A 21320.51955234 .00001288 00000+0 31985-4 0 9990
|
||||||
|
@ -58,44 +54,36 @@ class DataParserTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Given valid CSV stream returns valid data`() = runTest(testDispatcher) {
|
fun `Given valid CSV stream returns valid data`() = runTest(testDispatcher) {
|
||||||
val parsedList = dataParser.parseCSVStream(validCSVStream)
|
assert(dataParser.parseCSVStream(validCSVStream)[0].epoch == 21320.51955234)
|
||||||
assert(parsedList[0].epoch == 21320.51955234)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Given invalid CSV stream returns empty list`() = runTest(testDispatcher) {
|
fun `Given invalid CSV stream returns empty list`() = runTest(testDispatcher) {
|
||||||
val parsedList = dataParser.parseCSVStream(invalidCSVStream)
|
assert(dataParser.parseCSVStream(invalidCSVStream).isEmpty())
|
||||||
assert(parsedList.isEmpty())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Given valid TLE stream returns valid data`() = runTest(testDispatcher) {
|
fun `Given valid TLE stream returns valid data`() = runTest(testDispatcher) {
|
||||||
val parsedList = dataParser.parseTLEStream(validTLEStream)
|
assert(dataParser.parseTLEStream(validTLEStream)[0].epoch == 21320.51955234)
|
||||||
assert(parsedList[0].epoch == 21320.51955234)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Given invalid TLE stream returns empty list`() = runTest(testDispatcher) {
|
fun `Given invalid TLE stream returns empty list`() = runTest(testDispatcher) {
|
||||||
val parsedList = dataParser.parseTLEStream(invalidTLEStream)
|
assert(dataParser.parseTLEStream(invalidTLEStream).isEmpty())
|
||||||
assert(parsedList.isEmpty())
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `Given valid data streams parsed results match`() = runTest(testDispatcher) {
|
|
||||||
val csvResult = dataParser.parseCSVStream(validCSVStream)
|
|
||||||
val tleResult = dataParser.parseTLEStream(validTLEStream)
|
|
||||||
assert(csvResult == tleResult)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Given valid JSON stream returns valid data`() = runTest(testDispatcher) {
|
fun `Given valid JSON stream returns valid data`() = runTest(testDispatcher) {
|
||||||
val parsedList = dataParser.parseJSONStream(validJSONStream)
|
assert(dataParser.parseJSONStream(validJSONStream)[0].downlink == 136658500L)
|
||||||
assert(parsedList[0].downlink == 136658500L)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Given invalid JSON stream returns empty list`() = runTest(testDispatcher) {
|
fun `Given invalid JSON stream returns empty list`() = runTest(testDispatcher) {
|
||||||
val parsedList = dataParser.parseJSONStream(invalidJSONStream)
|
assert(dataParser.parseJSONStream(invalidJSONStream).isEmpty())
|
||||||
assert(parsedList.isEmpty())
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `Given valid data streams parsed results match`() = runTest(testDispatcher) {
|
||||||
|
assert(dataParser.parseCSVStream(validCSVStream) == dataParser.parseTLEStream(validTLEStream))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,6 @@ class QthConverterTest {
|
||||||
fun `Given valid QTH returns correct POS`() {
|
fun `Given valid QTH returns correct POS`() {
|
||||||
var result = qthToPosition("io91VL39FX")
|
var result = qthToPosition("io91VL39FX")
|
||||||
assert(result?.latitude == 51.4792 && result.longitude == -0.2083)
|
assert(result?.latitude == 51.4792 && result.longitude == -0.2083)
|
||||||
result = qthToPosition("JN58TD")
|
|
||||||
assert(result?.latitude == 48.1458 && result.longitude == 11.6250)
|
|
||||||
result = qthToPosition("gf15vc")
|
result = qthToPosition("gf15vc")
|
||||||
assert(result?.latitude == -34.8958 && result.longitude == -56.2083)
|
assert(result?.latitude == -34.8958 && result.longitude == -56.2083)
|
||||||
}
|
}
|
||||||
|
@ -43,7 +41,6 @@ class QthConverterTest {
|
||||||
fun `Given valid POS returns correct QTH`() {
|
fun `Given valid POS returns correct QTH`() {
|
||||||
assert(positionToQth(51.4878, -0.2146) == "IO91vl")
|
assert(positionToQth(51.4878, -0.2146) == "IO91vl")
|
||||||
assert(positionToQth(48.1466, 11.6083) == "JN58td")
|
assert(positionToQth(48.1466, 11.6083) == "JN58td")
|
||||||
assert(positionToQth(-34.91, -56.2116) == "GF15vc")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#Sat Aug 12 17:56:04 BST 2023
|
#Fri Sep 01 22:09:30 BST 2023
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
Ładowanie…
Reference in New Issue