Skip to content

Conversation

@aanorbel
Copy link
Member

No description provided.

@aanorbel aanorbel force-pushed the feat/win-sparkle-updates branch from 434dcb1 to be280d9 Compare September 18, 2025 02:02
@aanorbel aanorbel force-pushed the feat/win-sparkle-updates branch from be280d9 to f9f9754 Compare September 18, 2025 02:09
@aanorbel aanorbel force-pushed the feat/win-sparkle-updates branch from 977d281 to 1e00199 Compare September 18, 2025 14:15

// Set shutdown callback for update installation (Windows and macOS)
when (updateManager) {
is org.ooni.probe.shared.WinSparkleUpdateManager -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have the package here, can't we import it?

Item(
text = getUpdateMenuText(updateSystemState, updateSystemError),
enabled = updateSystemState != UpdateState.CHECKING_FOR_UPDATES,
onClick = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This item clicks could be separate methods, to avoid growing the main method too much.

Separator()
Item(
stringResource(Res.string.Desktop_Quit),
onClick = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one too could be a method.

/**
* Sets up the update manager with basic error handling
*/
private suspend fun setupUpdateManager(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this update methods could probably also go into a separate file.

Comment on lines +223 to +224
versionCode = 200 // Always increment by 10. See fdroid flavor below
versionName = "5.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't want to merge this, just use if for tests.

copyright = "© ${LocalDate.now().year} OONI. All rights reserved."
vendor = "Open Observatory of Network Interference (OONI)"
// licenseFile.set(project.file("LICENSE.txt"))
// licenseFile = rootProject.file("LICENSE")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why commented out?

Comment on lines 108 to 117
fun getMenuText(): String =
when {
_error.value != null -> "Retry Update Check (Error: ${_error.value?.code})"
_state.value == UpdateState.CHECKING_FOR_UPDATES -> "Checking for Updates..."
_state.value == UpdateState.UPDATE_AVAILABLE -> "Update Available!"
_state.value == UpdateState.NO_UPDATE_AVAILABLE -> "Check for Updates (Up to date)"
_state.value == UpdateState.INITIALIZING -> "Initializing Updates..."
_state.value == UpdateState.ERROR -> "Update System Error - Retry"
else -> "Check for Updates..."
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to localize all these messages, either here, or in the UI code. Could be in a separate ticket.

Comment on lines 123 to 125
} catch (e: Exception) {
Logger.e("Error during update manager cleanup: $e")
throw e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we handling it here, if we're re-throwing the exception to be caught the same way by the caller? Either not handle it, and add a @Throws annotation, or handle it here and not re-throw it.

onClick = { showWindow() },
)
// Only show update UI on Windows platforms
if ((dependencies.platformInfo.platform as? Platform.Desktop)?.os in listOf(DesktopOS.Windows)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a method inside the UpdateController, to avoid having this logic here.

// Show retry option when there are errors
if (updateError != null) {
Item(
"Retry Update Check",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another string to localize. And I thought this came also from getMenuText().

@aanorbel aanorbel merged commit 927b048 into main Sep 29, 2025
8 checks passed
@aanorbel aanorbel deleted the feat/win-sparkle-updates branch September 29, 2025 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants