Skip to content

Commit 446f79f

Browse files
committed
Add logs
1 parent a29ceb8 commit 446f79f

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

Core/Sources/HostApp/DebugView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ final class DebugSettings: ObservableObject {
3434

3535
struct DebugSettingsView: View {
3636
@StateObject var settings = DebugSettings()
37+
@Environment(\.updateChecker) var updateChecker
3738

3839
var body: some View {
3940
ScrollView {
@@ -134,6 +135,10 @@ struct DebugSettingsView: View {
134135
) {
135136
Text("Use Cloudflare domain name for license check")
136137
}
138+
139+
Button("Reset update cycle") {
140+
updateChecker.resetUpdateCycle()
141+
}
137142
}
138143
}
139144
.frame(maxWidth: .infinity)

Core/Sources/Service/Service.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Combine
44
import Dependencies
55
import Foundation
66
import GitHubCopilotService
7+
import Logger
78
import SuggestionService
89
import Toast
910
import Workspace
@@ -103,6 +104,7 @@ public final class Service {
103104

104105
@MainActor
105106
public func prepareForExit() async {
107+
Logger.service.info("Prepare for exit.")
106108
#if canImport(ProService)
107109
proService.prepareForExit()
108110
#endif

Core/Sources/UpdateChecker/UpdateChecker.swift

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public final class UpdateChecker {
4040
public func checkForUpdates() {
4141
updater.checkForUpdates()
4242
}
43+
44+
public func resetUpdateCycle() {
45+
updater.resetUpdateCycleAfterShortDelay()
46+
}
4347

4448
public var automaticallyChecksForUpdates: Bool {
4549
get { updater.automaticallyChecksForUpdates }
@@ -60,18 +64,31 @@ class UpdaterDelegate: NSObject, SPUUpdaterDelegate {
6064
}
6165

6266
func updater(_ updater: SPUUpdater, mayPerform updateCheck: SPUUpdateCheck) throws {
63-
if !shouldAutomaticallyCheckForUpdate, updateCheck == .updatesInBackground {
64-
throw CancellationError()
65-
}
67+
// Not sure how it works
68+
// if !shouldAutomaticallyCheckForUpdate, updateCheck == .updatesInBackground {
69+
// throw CancellationError()
70+
// }
6671
}
67-
68-
func updater(_ updater: SPUUpdater, shouldPostponeRelaunchForUpdate item: SUAppcastItem, untilInvokingBlock installHandler: @escaping () -> Void) -> Bool {
72+
73+
func updater(
74+
_ updater: SPUUpdater,
75+
shouldPostponeRelaunchForUpdate item: SUAppcastItem,
76+
untilInvokingBlock installHandler: @escaping () -> Void
77+
) -> Bool {
6978
if let updateCheckerDelegate {
7079
updateCheckerDelegate.prepareForRelaunch(finish: installHandler)
7180
return true
7281
}
7382
return false
7483
}
84+
85+
func updater(_ updater: SPUUpdater, willScheduleUpdateCheckAfterDelay delay: TimeInterval) {
86+
Logger.updateChecker.info("Will schedule update check after delay: \(delay)")
87+
}
88+
89+
func updaterWillNotScheduleUpdateCheck(_ updater: SPUUpdater) {
90+
Logger.updateChecker.info("Will not schedule update check")
91+
}
7592

7693
func allowedChannels(for updater: SPUUpdater) -> Set<String> {
7794
if UserDefaults.shared.value(for: \.installBetaBuilds) {

0 commit comments

Comments
 (0)