Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address updater feedback #3690

Merged
merged 11 commits into from
Jan 2, 2025
Merged

Address updater feedback #3690

merged 11 commits into from
Jan 2, 2025

Conversation

quanganhdo
Copy link
Member

@quanganhdo quanganhdo commented Dec 31, 2024

Task/Issue URL: https://app.asana.com/0/1201048563534612/1209026627874986/f
Tech Design URL:
CC:

Description:

Addresses some updater feedback:

  • "Install Now" menu item does nothing
  • Incorrect Release Notes screen state

Also adds more logging to help track down the edge cases (non-producible on my machine, but some internal users kept running into them)

Optional E2E tests:

  • Run PIR E2E tests
    Check this to run the Personal Information Removal end to end tests. If updating CCF, or any PIR related code, tick this.

Steps to test this PR:

  1. Download this test build: https://staticcdn.duckduckgo.com/macos-desktop-browser/a81f9679-e41d-404d-81a6-fd4a461d82f7/testbuilds/5ab32a1/duckduckgo-1.120.0.333.dmg
  2. Try different scenarios; use this as reference: https://app.asana.com/0/1199230911884351/1208882660080993/f
  3. Run this Terminal command: log show --info --predicate 'subsystem == "Updates"' --style compact --last 24h > ~/Downloads/updater.log
  4. Give the log file a quick skim; all major update steps should be there.

Definition of Done:


Internal references:

Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation

@quanganhdo quanganhdo changed the base branch from main to anh/fixes/frozen-about December 31, 2024 04:17
@quanganhdo quanganhdo changed the base branch from anh/fixes/frozen-about to main December 31, 2024 04:18
@quanganhdo quanganhdo changed the base branch from main to anh/fixes/frozen-about December 31, 2024 04:18
Comment on lines +153 to +156
self.init(status: updateController.updateProgress.toStatus,
currentVersion: currentVersion,
lastUpdate: lastUpdate)
lastUpdate: lastUpdate,
automaticUpdate: updateController.areAutomaticUpdatesEnabled)
Copy link
Member Author

@quanganhdo quanganhdo Dec 31, 2024

Choose a reason for hiding this comment

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

This happens when Release Notes screen is displayed but the appcast hasn't been loaded yet. We get both incorrect status (updateReady), wrong button text (Restart to Update / Update DuckDuckGo), and the button doesn't even work.

For more details: https://app.asana.com/0/0/1209058536716904/f

@@ -198,7 +199,7 @@ private extension UpdateCycleProgress {
case .downloadDidStart, .downloading: return .updateDownloading
case .extractionDidStart, .extracting, .readyToInstallAndRelaunch, .installationDidStart, .installing: return .updatePreparing
case .updaterError: return .updateError
case .updateCycleNotStarted, .updateCycleDone: return .updateReady
case .updateCycleNotStarted, .updateCycleDone: return .loaded
Copy link
Member Author

Choose a reason for hiding this comment

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

These should've been defaulted to loaded as we only want updateReady if we truly have a pending update.

Comment on lines +80 to +82
guard let updateController = Application.appDelegate.updateController else {
return
}
Copy link
Member Author

@quanganhdo quanganhdo Dec 31, 2024

Choose a reason for hiding this comment

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

Just to satisfy the compiler as AppDelegate.updateController is implicitly unwrapped already.

Comment on lines +289 to +292
func updater(_ updater: SPUUpdater, willInstallUpdateOnQuit item: SUAppcastItem, immediateInstallationBlock immediateInstallHandler: @escaping () -> Void) -> Bool {
Logger.updates.log("Updater will install update on quit: \(item.displayVersionString, privacy: .public)(\(item.versionString, privacy: .public))")
userDriver?.configureResumeBlock(immediateInstallHandler)
return true
Copy link
Member Author

Choose a reason for hiding this comment

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

This delegate method isn't called in my testing scenarios, but when it does in prod, let's make sure we use the immediateInstallHandler to set up our resume block for Install Now.

reply(.dismiss)
}

onSkipping = { reply(.skip) }
onDismiss = { reply(.dismiss) }
Copy link
Member Author

Choose a reason for hiding this comment

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

Skip can ignore the update, which we don't want.

Comment on lines +220 to +252
if !applicationTerminated {
Logger.updates.log("Updater re-sent a quit event")
retryTerminatingApplication()
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Not strictly necessary, but there seems to be no harm in doing this.

Base automatically changed from anh/fixes/frozen-about to main December 31, 2024 11:04
case .downloadDidStart, .downloading: return .updateDownloading
case .extractionDidStart, .extracting, .readyToInstallAndRelaunch, .installationDidStart, .installing: return .updatePreparing
case .updaterError: return .updateError
case .updateCycleNotStarted, .updateCycleDone: return .updateReady
case .updateCycleDone: return .loaded
Copy link
Member Author

Choose a reason for hiding this comment

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

updateReady should never be returned here unless we're truly ready to proceed with an update.

@quanganhdo quanganhdo changed the base branch from main to release/1.120.0 January 1, 2025 16:09
Copy link
Collaborator

@jotaemepereira jotaemepereira left a comment

Choose a reason for hiding this comment

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

@quanganhdo I went through the different scenarios on: https://app.asana.com/0/1199230911884351/1208882660080993/f, and everything work as expected. Let’s merge this into the release branch 👍🏼

@jotaemepereira jotaemepereira merged commit 90087ad into release/1.120.0 Jan 2, 2025
31 checks passed
@jotaemepereira jotaemepereira deleted the anh/fixes/updater branch January 2, 2025 13:34
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.

2 participants