Fix settings changes requiring an app restart (#539)

## Description
- Ensures settings changes take effect immediately instead of requiring
an app restart
- Add conditional & catch when checking for app updates

### Related issues
Fixes issues introduced in #538
This commit is contained in:
Ray 2025-12-22 15:28:21 -05:00 committed by GitHub
parent eb4e9b93be
commit af54e777dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,6 +13,7 @@ import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.RectangleShape
@ -189,17 +190,31 @@ class MainActivity : AppCompatActivity() {
is SetupDestination.AppContent -> {
val current = key.current
ProvideLocalClock {
if (UpdateChecker.ACTIVE && appPreferences.autoCheckForUpdates) {
LaunchedEffect(Unit) {
try {
updateChecker.maybeShowUpdateToast(
appPreferences.updateUrl,
)
} catch (ex: Exception) {
Timber.w(
ex,
"Exception during update check",
)
}
}
}
val appPreferences by userPreferencesDataStore.data.collectAsState(
appPreferences,
)
val preferences =
remember(appPreferences, current) {
UserPreferences(
appPreferences,
current.userDto.configuration
?: DefaultUserConfiguration,
)
ProvideLocalClock {
LaunchedEffect(Unit) {
updateChecker.maybeShowUpdateToast(
appPreferences.updateUrl,
)
}
ApplicationContent(
user = current.user,