cheogram-aapl
created pr with
cheogram-aapl/jump-to-unread.1
commented
lgtm
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-aapl:jump-to-unread | git am -3checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-aapl:jump-to-unread [rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-aapl:jump-to-unreadadd comment to patch request:
ssh pr.pico.sh comment cheogram-aapl:jump-to-unread "lgtm!"
Patchset
cheogram-aapl/jump-to-unread.1
→ Update to the latest ExyteChat (fork)
Stephen Paul Weber
Open at the first unread message and mark read only what is visible
2026-11-16T20:04:24ZStephen Paul Weber
Use canReplace
2026-11-16T20:05:22ZStephen Paul Weber
Add temporary XYZZY probes around newer-page fetches
2026-11-16T20:05:22ZStephen Paul Weber
2026-11-16T20:05:22Z
Update to the latest ExyteChat (fork)
Stephen Paul Weber
2026-11-16T20:04:24ZDiff stat
3 files changed, 74 insertions(+), 71 deletions(-)
Semantic diff summary
0 added,
0 modified,
0 signature changed,
0 removed
across 0 analyzed files
(3 files skipped: unsupported file type)
+6
-7
App/App.swift
#
| ... | ... | @@ -360,15 +360,15 @@ class ChatViewModel { | |
| 360 | 360 | attachment.mime.hasPrefix("audio/") | |
| 361 | 361 | } | |
| 362 | 362 | ||
| 363 | - | let (styledText, text) = if let moderationReason = message.moderationReason() { | |
| 364 | - | ({ | |
| 363 | + | let styledText = if let moderationReason = message.moderationReason() { | |
| 364 | + | { | |
| 365 | 365 | var s = AttributedString(moderationReason) | |
| 366 | 366 | s.font = Font.body.italic() | |
| 367 | 367 | s.foregroundColor = .gray | |
| 368 | - | return (s, moderationReason) | |
| 369 | - | })() | |
| 368 | + | return s | |
| 369 | + | }() | |
| 370 | 370 | } else { | |
| 371 | - | (AttributedString(html: message.body()), message.body().toPlainText()) | |
| 371 | + | AttributedString(html: message.body()) | |
| 372 | 372 | } | |
| 373 | 373 | ||
| 374 | 374 | let replyMessage: ReplyMessage? = if let replyTo = message.replyToMessage { |
| ... | ... | @@ -382,8 +382,7 @@ class ChatViewModel { | |
| 382 | 382 | user: await user(chat, message.senderId, message.senderMemberStub()), | |
| 383 | 383 | status: Self.mapStatus(message.status), | |
| 384 | 384 | createdAt: parseDate(date: message.timeSent)!, | |
| 385 | - | text: text, | |
| 386 | - | styledText: styledText, | |
| 385 | + | attributedText: styledText, | |
| 387 | 386 | attachments: otherAttachments.map { | |
| 388 | 387 | Attachment( | |
| 389 | 388 | id: $0.hashes.first?.toUri() ?? UUID().uuidString, |
+61
-57
App/ChatDetailView.swift
#
| ... | ... | @@ -79,7 +79,7 @@ struct ChatDetailView: View { | |
| 79 | 79 | @State var moderationMessage: ChatMessage? = nil | |
| 80 | 80 | @ScaledMetric(relativeTo: .largeTitle) var profileAvatarSize: CGFloat = 160 | |
| 81 | 81 | ||
| 82 | - | var body: some View { | |
| 82 | + | private var chatList: some View { | |
| 83 | 83 | ChatView(messages: viewModel.messages) { toSend in | |
| 84 | 84 | Task { | |
| 85 | 85 | let builder = |
| ... | ... | @@ -148,48 +148,6 @@ struct ChatDetailView: View { | |
| 148 | 148 | } | |
| 149 | 149 | self.viewModel.chat?.sendMessage(message: builder) | |
| 150 | 150 | } | |
| 151 | - | } lhsAccessoryViewBuilder: { | |
| 152 | - | AnyView( | |
| 153 | - | Button { | |
| 154 | - | self.currentThread = UUID().uuidString | |
| 155 | - | } label: { | |
| 156 | - | if let currentThread { | |
| 157 | - | WebImage( | |
| 158 | - | url: URL( | |
| 159 | - | string: Borogove.Identicon.svg( | |
| 160 | - | source: currentThread | |
| 161 | - | ).removingPercentEncoding! | |
| 162 | - | ) | |
| 163 | - | ) | |
| 164 | - | .resizable() | |
| 165 | - | .scaledToFit() | |
| 166 | - | .frame(width: 20, height: 20) | |
| 167 | - | .padding( | |
| 168 | - | EdgeInsets( | |
| 169 | - | top: 12, | |
| 170 | - | leading: 6, | |
| 171 | - | bottom: 14, | |
| 172 | - | trailing: 12 | |
| 173 | - | ) | |
| 174 | - | ) | |
| 175 | - | } else { | |
| 176 | - | Label("thread", systemImage: "number") | |
| 177 | - | .scaledToFit() | |
| 178 | - | .foregroundStyle(Color.primary) | |
| 179 | - | .labelStyle(.iconOnly) | |
| 180 | - | .frame(width: 24, height: 24) | |
| 181 | - | .padding( | |
| 182 | - | EdgeInsets( | |
| 183 | - | top: 12, | |
| 184 | - | leading: 0, | |
| 185 | - | bottom: 12, | |
| 186 | - | trailing: 12 | |
| 187 | - | ) | |
| 188 | - | ) | |
| 189 | - | } | |
| 190 | - | } | |
| 191 | - | .opacity(0.5) | |
| 192 | - | ) | |
| 193 | 151 | } messageMenuAction: { | |
| 194 | 152 | ( | |
| 195 | 153 | selectedMenuAction: MessageMenuAction, |
| ... | ... | @@ -235,14 +193,57 @@ struct ChatDetailView: View { | |
| 235 | 193 | requestModerationReason = true | |
| 236 | 194 | } | |
| 237 | 195 | } | |
| 238 | - | } messageMenuActionFilter: { (action: MessageMenuAction, message: Message) in | |
| 196 | + | } | |
| 197 | + | .lhsAccessoryViewBuilder { | |
| 198 | + | Button { | |
| 199 | + | self.currentThread = UUID().uuidString | |
| 200 | + | } label: { | |
| 201 | + | if let currentThread { | |
| 202 | + | WebImage( | |
| 203 | + | url: URL( | |
| 204 | + | string: Borogove.Identicon.svg( | |
| 205 | + | source: currentThread | |
| 206 | + | ).removingPercentEncoding! | |
| 207 | + | ) | |
| 208 | + | ) | |
| 209 | + | .resizable() | |
| 210 | + | .scaledToFit() | |
| 211 | + | .frame(width: 20, height: 20) | |
| 212 | + | .padding( | |
| 213 | + | EdgeInsets( | |
| 214 | + | top: 12, | |
| 215 | + | leading: 6, | |
| 216 | + | bottom: 14, | |
| 217 | + | trailing: 12 | |
| 218 | + | ) | |
| 219 | + | ) | |
| 220 | + | } else { | |
| 221 | + | Label("thread", systemImage: "number") | |
| 222 | + | .scaledToFit() | |
| 223 | + | .foregroundStyle(Color.primary) | |
| 224 | + | .labelStyle(.iconOnly) | |
| 225 | + | .frame(width: 24, height: 24) | |
| 226 | + | .padding( | |
| 227 | + | EdgeInsets( | |
| 228 | + | top: 12, | |
| 229 | + | leading: 0, | |
| 230 | + | bottom: 12, | |
| 231 | + | trailing: 12 | |
| 232 | + | ) | |
| 233 | + | ) | |
| 234 | + | } | |
| 235 | + | } | |
| 236 | + | .opacity(0.5) | |
| 237 | + | } | |
| 238 | + | .messageMenuActionFilter { (action: MessageMenuAction, message: Message) in | |
| 239 | 239 | switch action { | |
| 240 | 240 | case .moderate: | |
| 241 | 241 | return viewModel.chat!.canModerate() | |
| 242 | 242 | default: | |
| 243 | 243 | return true; | |
| 244 | 244 | } | |
| 245 | - | }.tapAvatarClosure { user, messageId in | |
| 245 | + | } | |
| 246 | + | .tapAvatarClosure { user, messageId in | |
| 246 | 247 | currentThread = viewModel.messageData[messageId]?.threadId | |
| 247 | 248 | Task { | |
| 248 | 249 | showProfile = await viewModel.chat!.getMemberDetails(memberIds: [user.id])[0] |
| ... | ... | @@ -270,10 +271,8 @@ struct ChatDetailView: View { | |
| 270 | 271 | } | |
| 271 | 272 | } | |
| 272 | 273 | .linkPreviewsDisabled() | |
| 273 | - | .enableLoadMore(pageSize: 10) { before in | |
| 274 | - | Task { | |
| 275 | - | await viewModel.loadMessagesBefore(message: before) | |
| 276 | - | } | |
| 274 | + | .enableLoadMoreOlderMessages { | |
| 275 | + | viewModel.loadMessagesBefore(message: viewModel.messages.first) | |
| 277 | 276 | }.setRecorderSettings( | |
| 278 | 277 | RecorderSettings( | |
| 279 | 278 | audioFormatID: kAudioFormatOpus, |
| ... | ... | @@ -400,14 +399,19 @@ struct ChatDetailView: View { | |
| 400 | 399 | } | |
| 401 | 400 | moderationMessage = nil | |
| 402 | 401 | } | |
| 403 | - | }.onChange(of: viewModel.chat?.chatId) { _, chatId in | |
| 404 | - | currentThread = nil | |
| 405 | - | }.onChange(of: viewModel.messages) { _, _ in | |
| 406 | - | if let lastM = viewModel.messages.last, | |
| 407 | - | let last = viewModel.messageData[lastM.id] | |
| 408 | - | { | |
| 409 | - | viewModel.chat?.markReadUpTo(message: last) | |
| 410 | - | } | |
| 411 | 402 | } | |
| 412 | 403 | } | |
| 404 | + | ||
| 405 | + | var body: some View { | |
| 406 | + | chatList | |
| 407 | + | .onChange(of: viewModel.chat?.chatId) { _, chatId in | |
| 408 | + | currentThread = nil | |
| 409 | + | }.onChange(of: viewModel.messages) { _, _ in | |
| 410 | + | if let lastM = viewModel.messages.last, | |
| 411 | + | let last = viewModel.messageData[lastM.id] | |
| 412 | + | { | |
| 413 | + | viewModel.chat?.markReadUpTo(message: last) | |
| 414 | + | } | |
| 415 | + | } | |
| 416 | + | } | |
| 413 | 417 | } |