Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ sealed interface TweaksAction {

data object OnClearDownloadsDismiss : TweaksAction

data object OnHelpClick : TweaksAction

data object OnFeedbackClick : TweaksAction

data object OnFeedbackDismiss : TweaksAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import zed.rainxch.core.domain.model.ProxyConfig
import zed.rainxch.core.domain.model.ProxyScope
import zed.rainxch.core.domain.model.TranslationProvider
import zed.rainxch.core.domain.network.ProxyTestOutcome
import zed.rainxch.core.domain.logging.GitHubStoreLogger
import zed.rainxch.core.domain.network.ProxyTester
import zed.rainxch.core.domain.repository.DeviceIdentityRepository
import zed.rainxch.core.domain.repository.ProxyRepository
Expand All @@ -28,7 +29,6 @@ import zed.rainxch.core.domain.repository.TelemetryRepository
import zed.rainxch.core.domain.repository.TweaksRepository
import zed.rainxch.core.domain.system.InstallerStatusProvider
import zed.rainxch.core.domain.system.UpdateScheduleManager
import zed.rainxch.core.domain.utils.BrowserHelper
import zed.rainxch.tweaks.presentation.model.ProxyScopeFormState
import zed.rainxch.githubstore.core.presentation.res.Res
import zed.rainxch.githubstore.core.presentation.res.failed_to_save_proxy_settings
Expand All @@ -44,7 +44,6 @@ import zed.rainxch.profile.domain.repository.ProfileRepository
import zed.rainxch.tweaks.presentation.model.ProxyType

class TweaksViewModel(
private val browserHelper: BrowserHelper,
private val tweaksRepository: TweaksRepository,
private val profileRepository: ProfileRepository,
private val installerStatusProvider: InstallerStatusProvider,
Expand All @@ -54,6 +53,7 @@ class TweaksViewModel(
private val seenReposRepository: SeenReposRepository,
private val deviceIdentityRepository: DeviceIdentityRepository,
private val telemetryRepository: TelemetryRepository,
private val logger: GitHubStoreLogger,
) : ViewModel() {
private var hasLoadedInitialData = false
private var cacheSizeJob: Job? = null
Expand Down Expand Up @@ -315,7 +315,7 @@ class TweaksViewModel(
)
}
}.onFailure { error ->
println("TweaksViewModel: failed to persist installer attribution: ${error.message}")
logger.error("TweaksViewModel: failed to persist installer attribution", error)
_state.update {
it.copy(installerAttributionCustomError = "write_failed")
}
Expand All @@ -327,7 +327,7 @@ class TweaksViewModel(
viewModelScope.launch {
tweaksRepository.getInstallerAttribution()
.catch { e ->
println("TweaksViewModel: installer attribution flow error: ${e.message}")
logger.error("TweaksViewModel: installer attribution flow error", e)
}
.collect { attribution ->
_state.update { current ->
Expand Down Expand Up @@ -678,7 +678,7 @@ class TweaksViewModel(
}.onSuccess {
_state.update { it.copy(installerAttributionCustomError = null) }
}.onFailure { error ->
println("TweaksViewModel: failed to persist installer attribution: ${error.message}")
logger.error("TweaksViewModel: failed to persist installer attribution", error)
_state.update { it.copy(installerAttributionCustomError = "write_failed") }
}
}
Expand Down Expand Up @@ -768,12 +768,6 @@ class TweaksViewModel(
_state.update { it.copy(isClearDownloadsDialogVisible = false) }
}

TweaksAction.OnHelpClick -> {
browserHelper.openUrl(
url = "https://github.com/OpenHub-Store/GitHub-Store/issues",
)
}

TweaksAction.OnMirrorPickerClick -> {
// Handled in composable
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package zed.rainxch.tweaks.presentation.components.sections

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
Expand All @@ -25,6 +28,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -113,18 +117,18 @@ private fun AboutItem(
horizontalArrangement = Arrangement.spacedBy(12.dp),
verticalAlignment = Alignment.CenterVertically,
) {
IconButton(
shapes = IconButtonDefaults.shapes(),
onClick = { },
colors =
IconButtonDefaults.iconButtonColors(
containerColor = MaterialTheme.colorScheme.secondaryContainer,
contentColor = MaterialTheme.colorScheme.onSecondaryContainer,
),
Box(
modifier =
Modifier
.size(40.dp)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.secondaryContainer),
contentAlignment = Alignment.Center,
) {
Icon(
imageVector = icon,
contentDescription = null,
tint = MaterialTheme.colorScheme.onSecondaryContainer,
modifier = Modifier.size(24.dp),
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package zed.rainxch.tweaks.presentation

import co.touchlab.kermit.Logger
import kotlin.system.exitProcess

/**
Expand Down Expand Up @@ -29,18 +30,17 @@ actual fun restartAppAfterLanguageChange() {
.inheritIO()
.start()
} else {
System.err.println(
"restartAppAfterLanguageChange: ProcessHandle has no command; exiting without relaunch",
)
Logger.w {
"restartAppAfterLanguageChange: ProcessHandle has no command; exiting without relaunch"
}
}
} catch (t: Throwable) {
// Swallow: we'd rather exit cleanly than leave the user in a
// limbo where the app is stuck with the old locale because
// the relaunch errored out. stderr so packaging regressions
// are still noticeable in logs without adding a logging dep.
System.err.println(
"restartAppAfterLanguageChange: relaunch failed (${t.javaClass.simpleName}: ${t.message}), falling back to plain exit",
)
// the relaunch errored out.
Logger.w(t) {
"restartAppAfterLanguageChange: relaunch failed, falling back to plain exit"
}
}
exitProcess(0)
}