mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
v4.1.0 - Remote freq control for Hamlib/SDR++, by londre7
This commit is contained in:
1 parent
e717d75324
commit
de99e09f5e
15 files changed
+42
-40
No files matched your search
@@ -13,8 +13,8 @@ android {
|
||||
defaultConfig {
|
||||
applicationId = "com.rtbishop.look4sat"
|
||||
minSdk = 24
|
||||
versionCode = 404
|
||||
versionName = "4.0.4"
|
||||
versionCode = 410
|
||||
versionName = "4.1.0"
|
||||
}
|
||||
buildFeatures {
|
||||
compose = true
|
||||
|
||||
@@ -299,7 +299,7 @@ fun SharedDialog(
|
||||
@Composable
|
||||
fun InfoDialog(title: String, text: String, onDismiss: () -> Unit) {
|
||||
val padding = LocalSpacing.current.large
|
||||
Dialog(onDismissRequest = onDismiss) {
|
||||
Dialog(onDismissRequest = {}) {
|
||||
ElevatedCard {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
|
||||
@@ -110,12 +110,12 @@ private fun PassesScreen(uiState: PassesState, navigateToRadar: (Int, Long) -> U
|
||||
uiState.takeAction(PassesAction.FilterRadios(modes))
|
||||
}
|
||||
}
|
||||
if (uiState.shouldSeeWelcome) {
|
||||
if (uiState.shouldSeeWhatsNew) {
|
||||
InfoDialog(
|
||||
title = stringResource(R.string.pass_welcome_title),
|
||||
text = stringResource(R.string.pass_welcome_message)
|
||||
title = stringResource(R.string.pass_whatsnew_title),
|
||||
text = stringResource(R.string.pass_whatsnew_message)
|
||||
) {
|
||||
uiState.takeAction(PassesAction.DismissWelcome)
|
||||
uiState.takeAction(PassesAction.DismissWhatsNew)
|
||||
}
|
||||
}
|
||||
val gridState = rememberLazyGridState()
|
||||
|
||||
@@ -31,12 +31,12 @@ data class PassesState(
|
||||
val elevation: Double,
|
||||
val modes: List<String>,
|
||||
val itemsList: List<OrbitalPass>,
|
||||
val shouldSeeWelcome: Boolean,
|
||||
val shouldSeeWhatsNew: Boolean,
|
||||
val takeAction: (PassesAction) -> Unit
|
||||
)
|
||||
|
||||
sealed class PassesAction {
|
||||
data object DismissWelcome : PassesAction()
|
||||
data object DismissWhatsNew : PassesAction()
|
||||
data class FilterPasses(val hoursAhead: Int, val minElevation: Double) : PassesAction()
|
||||
data class FilterRadios(val modes: List<String>) : PassesAction()
|
||||
data object RefreshPasses : PassesAction()
|
||||
|
||||
@@ -40,7 +40,8 @@ import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class PassesViewModel(
|
||||
private val satelliteRepo: ISatelliteRepo, private val settingsRepo: ISettingsRepo
|
||||
private val satelliteRepo: ISatelliteRepo,
|
||||
private val settingsRepo: ISettingsRepo
|
||||
) : ViewModel() {
|
||||
|
||||
private val _uiState = MutableStateFlow(
|
||||
@@ -56,7 +57,7 @@ class PassesViewModel(
|
||||
elevation = settingsRepo.passesSettings.value.minElevation,
|
||||
modes = settingsRepo.passesSettings.value.selectedModes,
|
||||
itemsList = emptyList(),
|
||||
shouldSeeWelcome = settingsRepo.otherSettings.value.shouldSeeWelcome,
|
||||
shouldSeeWhatsNew = settingsRepo.otherSettings.value.shouldSeeWhatsNew,
|
||||
takeAction = ::handleAction
|
||||
)
|
||||
)
|
||||
@@ -81,14 +82,14 @@ class PassesViewModel(
|
||||
}
|
||||
viewModelScope.launch {
|
||||
settingsRepo.otherSettings.collectLatest { settings ->
|
||||
_uiState.update { it.copy(shouldSeeWelcome = settings.shouldSeeWelcome) }
|
||||
_uiState.update { it.copy(shouldSeeWhatsNew = settings.shouldSeeWhatsNew) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleAction(action: PassesAction) {
|
||||
when (action) {
|
||||
PassesAction.DismissWelcome -> settingsRepo.setWelcomeDismissed()
|
||||
PassesAction.DismissWhatsNew -> settingsRepo.setWhatsNewDismissed()
|
||||
is PassesAction.FilterPasses -> applyFilter(action.hoursAhead, action.minElevation, uiState.value.modes)
|
||||
is PassesAction.FilterRadios -> applyFilter(uiState.value.hours, uiState.value.elevation, action.modes)
|
||||
PassesAction.RefreshPasses -> refreshPasses()
|
||||
|
||||
@@ -472,7 +472,7 @@ private fun OtherCardPreview() = MainTheme {
|
||||
stateOfUtc = false,
|
||||
stateOfLightTheme = false,
|
||||
shouldSeeWarning = false,
|
||||
shouldSeeWelcome = false
|
||||
shouldSeeWhatsNew = false
|
||||
)
|
||||
OtherCard(settings = values, {}, {}, {}, {})
|
||||
}
|
||||
|
||||
@@ -46,8 +46,7 @@ class SettingsViewModel(
|
||||
private val databaseRepo: IDatabaseRepo,
|
||||
private val satelliteRepo: ISatelliteRepo,
|
||||
private val settingsRepo: ISettingsRepo,
|
||||
private val showToast: IShowToast,
|
||||
appVersionName: String
|
||||
private val showToast: IShowToast
|
||||
) : ViewModel() {
|
||||
|
||||
private val defaultPosSettings = PositionSettings(false, settingsRepo.stationPosition.value, 0)
|
||||
@@ -63,7 +62,7 @@ class SettingsViewModel(
|
||||
nextTime = "00:00:00",
|
||||
isNextTimeAos = true,
|
||||
nextPass = getDefaultPass(),
|
||||
appVersionName = appVersionName,
|
||||
appVersionName = settingsRepo.appVersionName,
|
||||
positionSettings = defaultPosSettings,
|
||||
dataSettings = defaultDataSettings,
|
||||
otherSettings = settingsRepo.otherSettings.value,
|
||||
@@ -297,8 +296,7 @@ class SettingsViewModel(
|
||||
container.databaseRepo,
|
||||
container.satelliteRepo,
|
||||
container.settingsRepo,
|
||||
container.provideShowToast(),
|
||||
container.provideAppVersionName()
|
||||
container.provideShowToast()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,11 @@
|
||||
<string name="pass_welcome_message">
|
||||
Make sure to set your position via GPS, Lat/Lon or QTH in Settings.
|
||||
\n\nPlease update the database at least weekly to get accurate predictions.</string>
|
||||
<string name="pass_whatsnew_title" translatable="false">What\'s new in Look4Sat</string>
|
||||
<string name="pass_whatsnew_message" translatable="false">
|
||||
• Londre7 added a remote frequency control feature (Hamlib/SDR++) by sending compatible messages via Network/BT.
|
||||
Enable it in Settings and tap the transceiver (Radar Screen).
|
||||
</string>
|
||||
|
||||
<!-- Radar screen -->
|
||||
<string name="radar_back">Back</string>
|
||||
|
||||
@@ -61,10 +61,6 @@ class MainContainer(private val context: Context) {
|
||||
val satelliteRepo = provideSatelliteRepo()
|
||||
val databaseRepo = provideDatabaseRepo()
|
||||
|
||||
fun provideAppVersionName(): String {
|
||||
return context.packageManager.getPackageInfo(context.packageName, 0).versionName ?: "4.0.0"
|
||||
}
|
||||
|
||||
fun provideAddToCalendar(): IAddToCalendar = AddToCalendar(context)
|
||||
|
||||
fun provideShowToast(): IShowToast = ShowToast(context)
|
||||
@@ -111,6 +107,7 @@ class MainContainer(private val context: Context) {
|
||||
val manager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
||||
val appPrefsFileName = "${context.packageName}_preferences"
|
||||
val appPreferences = context.getSharedPreferences(appPrefsFileName, Context.MODE_PRIVATE)
|
||||
return SettingsRepo(manager, appPreferences)
|
||||
val appVersionName = context.packageManager.getPackageInfo(context.packageName, 0).versionName ?: "4.0.4"
|
||||
return SettingsRepo(manager, appPreferences, appVersionName)
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,8 @@ import kotlinx.coroutines.flow.update
|
||||
|
||||
class SettingsRepo(
|
||||
private val locationManager: LocationManager,
|
||||
private val preferences: SharedPreferences
|
||||
private val preferences: SharedPreferences,
|
||||
override val appVersionName: String
|
||||
) : ISettingsRepo, LocationListenerCompat {
|
||||
|
||||
private val keyBluetoothRotatorAddress = "bluetoothAddress"
|
||||
@@ -76,7 +77,7 @@ class SettingsRepo(
|
||||
private val keyStationTimestamp = "stationTimestamp"
|
||||
private val keyUpdateTimestamp = "updateTimestamp"
|
||||
private val keyShouldSeeWarning = "shouldSeeWarning"
|
||||
private val keyShouldSeeWelcome = "shouldSeeWelcome"
|
||||
private val keyShouldSeeWhatsNew = "shouldSeeWhatsNew_v$appVersionName"
|
||||
private val keyUseCustomTle = "useCustomTle"
|
||||
private val keyUseCustomTransceivers = "useCustomTransceivers"
|
||||
private val keyTleUrl = "tleUrl"
|
||||
@@ -376,9 +377,9 @@ class SettingsRepo(
|
||||
_otherSettings.update { it.copy(shouldSeeWarning = false) }
|
||||
}
|
||||
|
||||
override fun setWelcomeDismissed() {
|
||||
preferences.edit { putBoolean(keyShouldSeeWelcome, false) }
|
||||
_otherSettings.update { it.copy(shouldSeeWelcome = false) }
|
||||
override fun setWhatsNewDismissed() {
|
||||
preferences.edit { putBoolean(keyShouldSeeWhatsNew, false) }
|
||||
_otherSettings.update { it.copy(shouldSeeWhatsNew = false) }
|
||||
}
|
||||
|
||||
private fun getOtherSettings(): OtherSettings = OtherSettings(
|
||||
@@ -388,7 +389,7 @@ class SettingsRepo(
|
||||
stateOfUtc = preferences.getBoolean(keyStateOfUtc, false),
|
||||
stateOfLightTheme = preferences.getBoolean(keyStateOfLightTheme, false),
|
||||
shouldSeeWarning = preferences.getBoolean(keyShouldSeeWarning, true),
|
||||
shouldSeeWelcome = preferences.getBoolean(keyShouldSeeWelcome, true)
|
||||
shouldSeeWhatsNew = preferences.getBoolean(keyShouldSeeWhatsNew, true)
|
||||
)
|
||||
//endregion
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ data class OtherSettings(
|
||||
val stateOfUtc: Boolean,
|
||||
val stateOfLightTheme: Boolean,
|
||||
val shouldSeeWarning: Boolean,
|
||||
val shouldSeeWelcome: Boolean
|
||||
val shouldSeeWhatsNew: Boolean
|
||||
)
|
||||
|
||||
data class DataSourcesSettings(
|
||||
|
||||
@@ -27,6 +27,8 @@ import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
interface ISettingsRepo {
|
||||
|
||||
val appVersionName: String
|
||||
|
||||
//region # Satellites selection settings
|
||||
val selectedIds: StateFlow<List<Int>>
|
||||
val selectedTypes: StateFlow<List<String>>
|
||||
@@ -70,7 +72,6 @@ interface ISettingsRepo {
|
||||
fun setFrequencyPort(value: String)
|
||||
fun setFrequencyState(value: Boolean)
|
||||
fun setFrequencyFormat(value: String)
|
||||
|
||||
//endregion
|
||||
|
||||
//region # Other settings
|
||||
@@ -81,7 +82,7 @@ interface ISettingsRepo {
|
||||
fun setStateOfUtc(value: Boolean)
|
||||
fun setStateOfLightTheme(value: Boolean)
|
||||
fun setWarningDismissed()
|
||||
fun setWelcomeDismissed()
|
||||
fun setWhatsNewDismissed()
|
||||
//endregion
|
||||
|
||||
//region # Transceivers settings
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
Added fixes for Chinese translation, by Mubi-Baihua #194
|
||||
Bumped R4UAB source priority for Sat names consistency
|
||||
Added What's New dialog to announce changes and features
|
||||
Added remote frequency control feature, by londre7 #195
|
||||
Updated the Chinese translation, by wty2019wty #196
|
||||
@@ -1,2 +1,3 @@
|
||||
Added fixes for Chinese translation, by Mubi-Baihua #194
|
||||
Bumped R4UAB source priority for Sat names consistency
|
||||
Added What's New dialog to announce changes and features
|
||||
Added remote frequency control feature, by londre7 #195
|
||||
Updated the Chinese translation, by wty2019wty #196
|
||||
@@ -5,9 +5,6 @@ pluginManagement {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
|
||||
Reference in new issue
Block a user