Skip to content

Commit 7d5406d

Browse files
committed
Merge branch 'hotfix/0.32.3'
2 parents 52ae306 + ba84f84 commit 7d5406d

File tree

7 files changed

+60
-12
lines changed

7 files changed

+60
-12
lines changed

Core/Sources/ChatGPTChatTab/ChatPanel.swift

+35-6
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ struct ChatPanelMessages: View {
4545
@State var isScrollToBottomButtonDisplayed = true
4646
@State var isPinnedToBottom = true
4747
@Namespace var bottomID
48+
@Namespace var topID
4849
@Namespace var scrollSpace
4950
@State var scrollOffset: Double = 0
5051
@State var listHeight: Double = 0
52+
@State var didScrollToBottomOnAppearOnce = false
53+
@State var isBottomHidden = true
5154
@Environment(\.isEnabled) var isEnabled
5255

5356
var body: some View {
@@ -56,6 +59,7 @@ struct ChatPanelMessages: View {
5659
List {
5760
Group {
5861
Spacer(minLength: 12)
62+
.id(topID)
5963

6064
Instruction(chat: chat)
6165

@@ -71,10 +75,14 @@ struct ChatPanelMessages: View {
7175
Spacer(minLength: 12)
7276
.id(bottomID)
7377
.onAppear {
74-
proxy.scrollTo(bottomID, anchor: .bottom)
78+
isBottomHidden = false
79+
if !didScrollToBottomOnAppearOnce {
80+
proxy.scrollTo(bottomID, anchor: .bottom)
81+
didScrollToBottomOnAppearOnce = true
82+
}
7583
}
76-
.task {
77-
proxy.scrollTo(bottomID, anchor: .bottom)
84+
.onDisappear {
85+
isBottomHidden = true
7886
}
7987
.background(GeometryReader { geo in
8088
let offset = geo.frame(in: .named(scrollSpace)).minY
@@ -129,10 +137,20 @@ struct ChatPanelMessages: View {
129137
scrollToBottomButton(proxy: proxy)
130138
}
131139
.background {
132-
PinToBottomHandler(chat: chat, pinnedToBottom: $isPinnedToBottom) {
140+
PinToBottomHandler(
141+
chat: chat,
142+
isBottomHidden: isBottomHidden,
143+
pinnedToBottom: $isPinnedToBottom
144+
) {
133145
proxy.scrollTo(bottomID, anchor: .bottom)
134146
}
135147
}
148+
.onAppear {
149+
proxy.scrollTo(bottomID, anchor: .bottom)
150+
}
151+
.task {
152+
proxy.scrollTo(bottomID, anchor: .bottom)
153+
}
136154
}
137155
}
138156
.onAppear {
@@ -199,6 +217,7 @@ struct ChatPanelMessages: View {
199217

200218
struct PinToBottomHandler: View {
201219
let chat: StoreOf<Chat>
220+
let isBottomHidden: Bool
202221
@Binding var pinnedToBottom: Bool
203222
let scrollToBottom: () -> Void
204223

@@ -222,7 +241,9 @@ struct ChatPanelMessages: View {
222241
Task {
223242
pinnedToBottom = true
224243
await Task.yield()
225-
scrollToBottom()
244+
withAnimation(.easeInOut(duration: 0.1)) {
245+
scrollToBottom()
246+
}
226247
}
227248
}
228249
}
@@ -233,10 +254,18 @@ struct ChatPanelMessages: View {
233254
}
234255
Task {
235256
await Task.yield()
236-
scrollToBottom()
257+
withAnimation(.easeInOut(duration: 0.1)) {
258+
scrollToBottom()
259+
}
237260
}
238261
}
239262
}
263+
.onChange(of: isBottomHidden) { value in
264+
// This is important to prevent it from jumping to the top!
265+
if value, pinnedToBottom {
266+
scrollToBottom()
267+
}
268+
}
240269
}
241270
}
242271
}

Core/Sources/Service/Service.swift

+8
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ public final class Service {
8686
}.store(in: &cancellable)
8787
}
8888
}
89+
90+
@MainActor
91+
public func prepareForExit() async {
92+
#if canImport(ProService)
93+
proService.prepareForExit()
94+
#endif
95+
await scheduledCleaner.closeAllChildProcesses()
96+
}
8997
}
9098

9199
public extension Service {

ExtensionService/AppDelegate.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
4848
}
4949
}
5050
}
51-
51+
5252
@objc func quit() {
5353
Task { @MainActor in
54-
await service.scheduledCleaner.closeAllChildProcesses()
54+
await service.prepareForExit()
5555
exit(0)
5656
}
5757
}

Pro

Submodule Pro updated from a5c9fda to efce3f6

Tool/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/ActiveDocumentChatContextCollector.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ public final class ActiveDocumentChatContextCollector: ChatContextCollector {
5555

5656
var functionPrompt = """
5757
ONLY call it when one of the following conditions are satisfied:
58-
- the user explicitly ask you about specific line of code, \
59-
but the line was NOT in the focused range \(contextLineRange).
58+
- the user explicitly ask you about specific line of code, that is NOT in the focused range \(contextLineRange).
6059
"""
6160

6261
if let annotations = context.focusedContext?.otherLineAnnotations,

Version.xcconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
APP_VERSION = 0.32.3
2-
APP_BUILD = 366
2+
APP_BUILD = 367
33

appcast.xml

+12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
<channel>
44
<title>Copilot for Xcode</title>
55

6+
<item>
7+
<title>0.32.3</title>
8+
<pubDate>Wed, 01 May 2024 15:35:26 +0800</pubDate>
9+
<sparkle:version>367</sparkle:version>
10+
<sparkle:shortVersionString>0.32.3</sparkle:shortVersionString>
11+
<sparkle:minimumSystemVersion>12.0</sparkle:minimumSystemVersion>
12+
<sparkle:releaseNotesLink>
13+
https://github.com/intitni/CopilotForXcode/releases/tag/0.32.3
14+
</sparkle:releaseNotesLink>
15+
<enclosure url="https://github.com/intitni/CopilotForXcode/releases/download/0.32.3/Copilot.for.Xcode.app.zip" length="41425304" type="application/octet-stream" sparkle:edSignature="6lv4UNZaPTQDUvdjnfFhzThKc3fxhK9KOvyZMjzUfMZ0Jyg75vSNfY1plBrWLAKbvRLuiS9emANLEGlXd+whAA=="/>
16+
</item>
17+
618
<item>
719
<title>0.32.3</title>
820
<pubDate>Mon, 29 Apr 2024 22:44:05 +0800</pubDate>

0 commit comments

Comments
 (0)