Skip to content

Commit

Permalink
Release 0.28.0
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 5, 2024
1 parent 887f789 commit 8353a90
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
17 changes: 13 additions & 4 deletions Core/Sources/SuggestionWidget/FeatureReducers/WidgetFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -281,16 +281,22 @@ public struct WidgetFeature {
return .run { send in
await send(.updateColorScheme)
let stream = AsyncStream<Void> { continuation in
userDefaultsObservers.colorSchemeChangeObserver.onChange = {
userDefaultsObservers.xcodeColorSchemeChangeObserver.onChange = {
continuation.yield()
}

userDefaultsObservers.systemColorSchemeChangeObserver.onChange = {
continuation.yield()
}

Task { @MainActor in
Timer.scheduledTimer(withTimeInterval: 60, repeats: true) { _ in
continuation.yield()
}
}

continuation.onTermination = { _ in
userDefaultsObservers.colorSchemeChangeObserver.onChange = {}

This comment has been minimized.

Copy link
@Bighead9971

Bighead9971 Nov 8, 2024

Core/Sources/SuggestionWidget/FeatureReducers/WidgetFeature.swift

userDefaultsObservers.xcodeColorSchemeChangeObserver.onChange = {}
userDefaultsObservers.systemColorSchemeChangeObserver.onChange = {}
}
}
Expand All @@ -301,17 +307,20 @@ public struct WidgetFeature {
}
}.cancellable(id: CancelID.observeUserDefaults, cancelInFlight: true)


case .updateActiveApplication:
return .none

case .updateColorScheme:
let widgetColorScheme = UserDefaults.shared.value(for: \.widgetColorScheme)
let xcodePref = UserDefaults(suiteName: "com.apple.dt.Xcode")!
.value(forKey: "IDEAppearance") as? Int ?? 0
let xcodeColorScheme: XcodeColorScheme = .init(rawValue: xcodePref) ?? .system
let systemColorScheme: ColorScheme = NSApp.effectiveAppearance.name == .darkAqua
? .dark
: .light

let scheme: ColorScheme = {
switch (widgetColorScheme, systemColorScheme) {
switch (xcodeColorScheme, systemColorScheme) {
case (.system, .dark), (.dark, _):
return .dark
case (.system, .light), (.light, _):
Expand Down
12 changes: 7 additions & 5 deletions Core/Sources/SuggestionWidget/ModuleDependency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ public final class WidgetUserDefaultsObservers {
UserDefaultPreferenceKeys().suggestionPresentationMode.key,
], context: nil
)
let colorSchemeChangeObserver = UserDefaultsObserver(
object: UserDefaults.shared, forKeyPaths: [
UserDefaultPreferenceKeys().widgetColorScheme.key,
], context: nil
let xcodeColorSchemeChangeObserver = UserDefaultsObserver(
object: UserDefaults(suiteName: "com.apple.dt.Xcode")!,
forKeyPaths: ["xcodeColorScheme"],
context: nil
)
let systemColorSchemeChangeObserver = UserDefaultsObserver(
object: UserDefaults.standard, forKeyPaths: ["AppleInterfaceStyle"], context: nil
object: UserDefaults.standard,
forKeyPaths: ["AppleInterfaceStyle"],
context: nil
)

public init() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ public class GitHubCopilotBaseService {
currentDirectoryURL: urls.supportURL
)

Logger.gitHubCopilot.info("Starting language server in \(urls.supportURL), \(environment)")
Logger.gitHubCopilot.info("Running on Xcode \(xcodeVersion), extension version \(versionNumber)")

let localServer = CopilotLocalProcessServer(executionParameters: executionParams)
localServer.notificationHandler = { _, respond in
respond(.timeout)
Expand Down
7 changes: 7 additions & 0 deletions Tool/Sources/Preferences/Types/XcodeColorScheme.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import SwiftUI

public enum XcodeColorScheme: Int, CaseIterable {
case system = 0
case light = 1
case dark = 2
}

1 comment on commit 8353a90

@Bighead9971
Copy link

Choose a reason for hiding this comment

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

Core/Sources/SuggestionWidget/FeatureReducers/WidgetFeature.swift

Please sign in to comment.