Skip to content

Commit f01fc4c

Browse files
committed
Rename chatPanelInASeparateWindow to isDetached
1 parent 5f6b437 commit f01fc4c

4 files changed

Lines changed: 15 additions & 14 deletions

File tree

Core/Sources/SuggestionWidget/ChatWindowView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct ChatTitleBar: View {
7979

8080
Spacer()
8181

82-
WithViewStore(store, observe: { $0.chatPanelInASeparateWindow }) { viewStore in
82+
WithViewStore(store, observe: { $0.isDetached }) { viewStore in
8383
TrafficLightButton(
8484
isHovering: isHovering,
8585
isActive: viewStore.state,

Core/Sources/SuggestionWidget/FeatureReducers/ChatPanelFeature.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public struct ChatPanelFeature: ReducerProtocol {
4848
public var chatTabGroup = ChatTabGroup()
4949
var colorScheme: ColorScheme = .light
5050
public internal(set) var isPanelDisplayed = false
51-
var chatPanelInASeparateWindow = false
51+
var isDetached = false
5252
var isFullScreen = false
5353
}
5454

@@ -118,17 +118,17 @@ public struct ChatPanelFeature: ReducerProtocol {
118118
return .none
119119

120120
case .toggleChatPanelDetachedButtonClicked:
121-
if state.isFullScreen, state.chatPanelInASeparateWindow {
121+
if state.isFullScreen, state.isDetached {
122122
return .run { send in
123123
await send(.attachChatPanel)
124124
}
125125
}
126126

127-
state.chatPanelInASeparateWindow.toggle()
127+
state.isDetached.toggle()
128128
return .none
129129

130130
case .detachChatPanel:
131-
state.chatPanelInASeparateWindow = true
131+
state.isDetached = true
132132
return .none
133133

134134
case .attachChatPanel:
@@ -140,7 +140,7 @@ public struct ChatPanelFeature: ReducerProtocol {
140140
}
141141
}
142142

143-
state.chatPanelInASeparateWindow = false
143+
state.isDetached = false
144144
return .none
145145

146146
case .enterFullScreen:
@@ -155,7 +155,7 @@ public struct ChatPanelFeature: ReducerProtocol {
155155

156156
case let .presentChatPanel(forceDetach):
157157
if forceDetach {
158-
state.chatPanelInASeparateWindow = true
158+
state.isDetached = true
159159
}
160160
state.isPanelDisplayed = true
161161
return .run { send in

Core/Sources/SuggestionWidget/FeatureReducers/WidgetFeature.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public struct WidgetFeature: ReducerProtocol {
6565
}(),
6666
isContentEmpty: chatPanelState.chatTabGroup.tabInfo.isEmpty
6767
&& panelState.sharedPanelState.isEmpty,
68-
isChatPanelDetached: chatPanelState.chatPanelInASeparateWindow,
68+
isChatPanelDetached: chatPanelState.isDetached,
6969
isChatOpen: chatPanelState.isPanelDisplayed
7070
)
7171
}
@@ -191,7 +191,7 @@ public struct WidgetFeature: ReducerProtocol {
191191
Reduce { state, action in
192192
switch action {
193193
case .chatPanel(.presentChatPanel):
194-
let isDetached = state.chatPanelState.chatPanelInASeparateWindow
194+
let isDetached = state.chatPanelState.isDetached
195195
return .run { _ in
196196
await windowsController?.updateWindowLocation(
197197
animated: false,
@@ -206,7 +206,7 @@ public struct WidgetFeature: ReducerProtocol {
206206
}
207207

208208
case .chatPanel(.toggleChatPanelDetachedButtonClicked):
209-
let isDetached = state.chatPanelState.chatPanelInASeparateWindow
209+
let isDetached = state.chatPanelState.isDetached
210210
return .run { _ in
211211
await windowsController?.updateWindowLocation(
212212
animated: !isDetached,

Core/Sources/SuggestionWidget/WidgetWindowsController.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ actor WidgetWindowsController: NSObject {
9696
let previousActiveApplication = xcodeInspector.previousActiveApplication
9797
await MainActor.run {
9898
let state = store.withState { $0 }
99-
let isChatPanelDetached = state.chatPanelState.chatPanelInASeparateWindow
99+
let isChatPanelDetached = state.chatPanelState.isDetached
100100
let hasChat = !state.chatPanelState.chatTabGroup.tabInfo.isEmpty
101101

102102
if let activeApp, activeApp.isXcode {
@@ -166,7 +166,7 @@ actor WidgetWindowsController: NSObject {
166166
@Sendable @MainActor
167167
func update() async {
168168
let state = store.withState { $0 }
169-
let isChatPanelDetached = state.chatPanelState.chatPanelInASeparateWindow
169+
let isChatPanelDetached = state.chatPanelState.isDetached
170170
guard let widgetLocation = await generateWidgetLocation() else { return }
171171
await updatePanelState(widgetLocation)
172172

@@ -295,14 +295,15 @@ private extension WidgetWindowsController {
295295
/// so the transition looks better.
296296
func hideWidgetForTransitions() async {
297297
let newDocumentURL = await xcodeInspector.safe.realtimeActiveDocumentURL
298-
let documentURL = await MainActor.run { store.withState { $0.focusingDocumentURL } }
298+
let documentURL = await MainActor
299+
.run { store.withState { $0.focusingDocumentURL } }
299300
if documentURL != newDocumentURL {
300301
await send(.panel(.removeDisplayedContent))
301302
await hidePanelWindows()
302303
}
303304
await send(.updateFocusingDocumentURL)
304305
}
305-
306+
306307
func removeContent() async {
307308
await send(.panel(.removeDisplayedContent))
308309
}

0 commit comments

Comments
 (0)