Skip to content

Commit 296dbbb

Browse files
azooz2003-bitclaude
andcommitted
Address CodeRabbit (df968da): use injected hostBundle + localize readiness-timeout error
- ensureSparkleInstallationCache uses the injected hostBundle.bundleIdentifier instead of Bundle.main (consistency with the hostBundle param already used for SPUUpdater; the Sparkle install cache is keyed by the host app's bundle id). - The 'Updater is still starting' NSError description is now String(localized: update.error.notReady) with en + ja in Localizable.xcstrings (was hardcoded English). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent df968da commit 296dbbb

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

Packages/CmuxUpdater/Sources/CmuxUpdater/UpdateController.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public final class UpdateController {
2323
private let clock: any UpdateClock
2424
private let defaults: UserDefaults
2525
private let fileManager: FileManager
26+
private let hostBundle: Bundle
2627
private let backgroundProbeInterval: TimeInterval
2728

2829
/// Host actions the updater delegates upward (retry, relaunch prep). Forwarded to the driver.
@@ -76,6 +77,7 @@ public final class UpdateController {
7677
self.clock = clock
7778
self.defaults = defaults
7879
self.fileManager = fileManager
80+
self.hostBundle = hostBundle
7981
self.backgroundProbeInterval = settings.scheduledCheckInterval
8082
settings.apply(to: defaults)
8183

@@ -279,7 +281,7 @@ public final class UpdateController {
279281
error: NSError(
280282
domain: "cmux.update",
281283
code: 1,
282-
userInfo: [NSLocalizedDescriptionKey: "Updater is still starting. Try again in a moment."]
284+
userInfo: [NSLocalizedDescriptionKey: String(localized: "update.error.notReady", defaultValue: "Updater is still starting. Try again in a moment.")]
283285
),
284286
retry: { [weak self] in self?.checkForUpdates() },
285287
dismiss: { [weak self] in self?.model.setState(.idle) }
@@ -381,7 +383,7 @@ public final class UpdateController {
381383
}
382384

383385
private func ensureSparkleInstallationCache() {
384-
guard let bundleIdentifier = Bundle.main.bundleIdentifier else { return }
386+
guard let bundleIdentifier = hostBundle.bundleIdentifier else { return }
385387
guard let cachesURL = fileManager.urls(for: .cachesDirectory, in: .userDomainMask).first else { return }
386388

387389
let baseURL = cachesURL

Resources/Localizable.xcstrings

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134765,6 +134765,23 @@
134765134765
}
134766134766
}
134767134767
},
134768+
"update.error.notReady": {
134769+
"extractionState": "manual",
134770+
"localizations": {
134771+
"en": {
134772+
"stringUnit": {
134773+
"state": "translated",
134774+
"value": "Updater is still starting. Try again in a moment."
134775+
}
134776+
},
134777+
"ja": {
134778+
"stringUnit": {
134779+
"state": "translated",
134780+
"value": "アップデーターを準備中です。しばらくしてからもう一度お試しください。"
134781+
}
134782+
}
134783+
}
134784+
},
134768134785
"update.error.permissionError.message": {
134769134786
"extractionState": "manual",
134770134787
"localizations": {

0 commit comments

Comments
 (0)