Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(ios): preserve natural bounce at chat bottom

leepokaifbb3a74779fe
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationList.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationList.swift
index fabe2429..24e001bb 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationList.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationList.swift
@@ -207,16 +207,16 @@ private struct ConversationCollection: UIViewRepresentable {
// MARK: scrolling
+ func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
+ lastOffset = scrollView.contentOffset.y
+ }
+
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let y = scrollView.contentOffset.y
defer { lastOffset = y }
// Only the reader's own scrolling changes following; layout never does.
guard scrollView.isTracking || scrollView.isDecelerating else { return }
- if y < lastOffset - 0.5 {
- setFollowing(false)
- } else if y > lastOffset, view.endOffset - y < ConversationCollectionView.nearEnd {
- setFollowing(true)
- }
+ setFollowing(view.followingAfterScroll(from: lastOffset))
if !view.following, y + scrollView.adjustedContentInset.top < scrollView.bounds.height / 2 {
parent?.nearTop?()
}
@@ -278,7 +278,7 @@ private final class ConversationLayout: UICollectionViewCompositionalLayout {
/// Holds the end in place: while following, every layout pass (a reply growing, a row going
/// in, the keyboard) ends at the bottom, unless the reader has the list in hand.
-private final class ConversationCollectionView: UICollectionView {
+class ConversationCollectionView: UICollectionView {
static let nearEnd: CGFloat = 32
var following = true
/// An animated scroll down is under way; layout leaves it alone.
@@ -290,14 +290,23 @@ private final class ConversationCollectionView: UICollectionView {
override func layoutSubviews() {
super.layoutSubviews()
- if following, !isTracking, !isDecelerating, !scrollingToEnd { pinToEnd() }
+ if following { pinToEnd() }
}
func pinToEnd() {
+ // Every caller must yield to UIKit until the drag and its rubber-band return finish.
+ guard !scrollingToEnd, !isTracking, !isDragging, !isDecelerating else { return }
let end = endOffset
if abs(contentOffset.y - end) > 0.5 { contentOffset.y = end }
}
+ func followingAfterScroll(from previousOffset: CGFloat) -> Bool {
+ // Returning from overscroll moves upward too, but is not reading older messages.
+ if endOffset - contentOffset.y < Self.nearEnd { return true }
+ if contentOffset.y < previousOffset - 0.5 { return false }
+ return following
+ }
+
func scrollToEnd(animated: Bool) {
guard animated, abs(contentOffset.y - endOffset) > 1 else { return pinToEnd() }
scrollingToEnd = true
diff --git a/apps/ios/Kit/Tests/CodyncUITests/ConversationScrollTests.swift b/apps/ios/Kit/Tests/CodyncUITests/ConversationScrollTests.swift
new file mode 100644
index 00000000..61ca0995
--- /dev/null
+++ b/apps/ios/Kit/Tests/CodyncUITests/ConversationScrollTests.swift
@@ -0,0 +1,54 @@
+import Testing
+import UIKit
+@testable import CodyncUI
+
+@MainActor @Test(arguments: ["tracking", "dragging", "decelerating"])
+func bottomPinningPreservesNativeOverscrollDuringInteraction(_ phase: String) {
+ let view = InteractingConversationView(frame: CGRect(x: 0, y: 0, width: 320, height: 600),
+ collectionViewLayout: TallConversationLayout())
+ view.layoutIfNeeded()
+ view.phase = phase
+ let overscroll = view.endOffset + 80
+ view.contentOffset.y = overscroll
+ view.pinToEnd()
+ #expect(view.contentOffset.y == overscroll)
+ view.setNeedsLayout()
+ view.layoutIfNeeded()
+ #expect(view.contentOffset.y == overscroll)
+ view.phase = nil
+ view.pinToEnd()
+ #expect(view.contentOffset.y == view.endOffset)
+}
+
+@MainActor @Test func bottomBounceKeepsFollowingUntilTheReaderLeavesTheEnd() {
+ let view = ConversationCollectionView(frame: CGRect(x: 0, y: 0, width: 320, height: 600),
+ collectionViewLayout: TallConversationLayout())
+ view.layoutIfNeeded()
+ let end = view.endOffset
+ var previous = end
+ for offset in [end + 80, end + 40, end + 10, end] {
+ view.contentOffset.y = offset
+ view.following = view.followingAfterScroll(from: previous)
+ #expect(view.following)
+ previous = offset
+ }
+ view.contentOffset.y = end - 100
+ view.following = view.followingAfterScroll(from: previous)
+ #expect(!view.following)
+ view.contentOffset.y = end - 80
+ #expect(!view.followingAfterScroll(from: end - 100))
+ view.contentOffset.y = end
+ #expect(view.followingAfterScroll(from: end - 80))
+}
+
+@MainActor private final class InteractingConversationView: ConversationCollectionView {
+ var phase: String?
+ override var isTracking: Bool { phase == "tracking" }
+ override var isDragging: Bool { phase == "dragging" }
+ override var isDecelerating: Bool { phase == "decelerating" }
+}
+
+@MainActor private final class TallConversationLayout: UICollectionViewLayout {
+ override var collectionViewContentSize: CGSize { CGSize(width: 320, height: 5_000) }
+ override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { [] }
+}
diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.md
index 44a5cd01..eba39f56 100644
--- a/apps/ios/WhatsNew.md
+++ b/apps/ios/WhatsNew.md
@@ -5,6 +5,16 @@ listing what iPhone users notice. tools/asc-submit.py reads the released version
a version without one gets a generic "Bug fixes and improvements" line. Delete old sections.
-->
+## 2.11.1
+
+### zh-Hant
+
+- 對話捲到底後繼續拖動時保留自然回彈,不再突然跳回底部或閃現跳至最新訊息按鈕。
+
+### en-US
+
+- Chats bounce naturally when dragged past the bottom, without snapping back or flashing the jump-to-latest button.
+
## 2.10.0
### zh-Hant
diff --git a/docs/design/ui-conventions.md b/docs/design/ui-conventions.md
index 670c5dcb..6b0b5ad7 100644
--- a/docs/design/ui-conventions.md
+++ b/docs/design/ui-conventions.md
@@ -6,6 +6,8 @@ The bot list and conversation use the system `NavigationStack` toolbar. `Toolbar
The conversation keeps the native glass buttons over the chat with a soft top scroll-edge effect, so messages blur out under the header instead of running sharp behind it. Root error dialogs use an in-place, full-screen scrim so presenting them does not change the underlying glass controls' appearance.
+iPhone conversation scrolling leaves dragging, deceleration, and bottom rubber-band return to UIKit. Passive bottom-following must not move the offset during those gestures, and returning from bottom overscroll does not count as reading history or show Jump to latest. Desktop keeps browser scrolling; the terminal uses line-based scrolling, so neither shares this UIKit-specific behavior.
+
Do not wrap those toolbar controls in `IconButtonStyle`, hand-sized rounded backgrounds or another glass effect. The account avatar is toolbar content, with the system supplying the enclosing surface. This is the explicit exception to the custom-chrome rule below.
Connecting and reconnecting are background work. `BotStore` gives initial offline reports 1 second to recover and holds drops from online (including relay "computer offline" reports) for 5 seconds. "No access" shows immediately. Automatic read acknowledgements never open an error dialog and visible conversations are acknowledged again after reconnecting. An action taken during a reconnect (back in the foreground, a new network, a drop still inside its grace) waits for the link, up to 20 seconds, instead of failing; while one waits, headers read `Connecting…` and the conversation's connection label shows a spinner. Calls that are safe to repeat (send, stop, approvals, pin, hide, mark as read, delete) are tried again when the link drops under them. Tapping while the header says Offline because the computer can't be reached starts a fresh connection attempt and waits for it, instead of failing until the backoff gets there; a computer the relay reports as off fails at once, since the relay says when it is back. A permission card shows a spinner on the chosen option, dims the others and takes no second answer until the computer has it. The desktop app's `BotStore` (link handling in `apps/desktop/src/renderer/store/bot-sync.ts`) applies the same graces and 20-second wait. The TUI follows the same rule over loopback: a command the host can't be reached for is retried for up to 20 seconds behind its "Reconnecting…" indicator (the `hello` probe that explains an unreachable host still answers at once), and its permission cards spin on the chosen option. The "Something went wrong" dialog is left for a computer that is off, a refused device, the computer's own answers, and reconnects that outlast the wait. Background work (cloud refresh, device registration, automatic access requests) logs connection, busy-cloud and stale-token failures instead of showing them. The iOS app disconnects only in `.background`, not `.inactive`. Connection status lives only in headers and their menus. The roster header shows a small summary (`1 connected`, `1/2 connected`, `2 offline`, or `Connecting…`). Its computer menu supports multiple selections, Show only, All computers, reconnect, and management. At least one available computer stays selected; if saved exclusions would hide every computer, the list falls back to all. Filters persist on the device. Bots sort pinned first, then by recency. On iPhone, when more than one computer is shown, each computer gets a light heading (badge, name, connection, and "No bots yet" when empty) above its own bots; with one computer the list stays flat. Tapping a heading folds that computer's bots away (chevron; saved on the device). Long-press a heading to lift the whole section and drag it up or down; the other sections slide out of its way and the order is saved on the device on release (`AccountStore.move`; VoiceOver: Move up / Move down). The desktop app shows a flat roster. There are no connection banners. The compact desktop rail uses a computer icon for the same menu. Conversation headers show a small connection label, with the computer name available in the header menu or help text. Pull-to-refresh remains available on iPhone. Computer setup and access requests live under Manage computers.