mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 23:51:21 +02:00
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:
parent
eb4e9b93be
commit
af54e777dc
1 changed files with 25 additions and 10 deletions
|
|
@ -13,6 +13,7 @@ import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.RectangleShape
|
import androidx.compose.ui.graphics.RectangleShape
|
||||||
|
|
@ -189,18 +190,32 @@ class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
is SetupDestination.AppContent -> {
|
is SetupDestination.AppContent -> {
|
||||||
val current = key.current
|
val current = key.current
|
||||||
val preferences =
|
|
||||||
UserPreferences(
|
|
||||||
appPreferences,
|
|
||||||
current.userDto.configuration
|
|
||||||
?: DefaultUserConfiguration,
|
|
||||||
)
|
|
||||||
ProvideLocalClock {
|
ProvideLocalClock {
|
||||||
LaunchedEffect(Unit) {
|
if (UpdateChecker.ACTIVE && appPreferences.autoCheckForUpdates) {
|
||||||
updateChecker.maybeShowUpdateToast(
|
LaunchedEffect(Unit) {
|
||||||
appPreferences.updateUrl,
|
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,
|
||||||
|
)
|
||||||
|
}
|
||||||
ApplicationContent(
|
ApplicationContent(
|
||||||
user = current.user,
|
user = current.user,
|
||||||
server = current.server,
|
server = current.server,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue