From 895218b97802669c10d22028d22b9da8a8c1f01a Mon Sep 17 00:00:00 2001 From: Avently <7953703+avently@users.noreply.github.com> Date: Wed, 22 Jan 2025 23:28:30 -0800 Subject: [PATCH] wait until items loaded --- apps/ios/Shared/Views/Chat/ChatView.swift | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/apps/ios/Shared/Views/Chat/ChatView.swift b/apps/ios/Shared/Views/Chat/ChatView.swift index 182dbc4c83..e39d93d37a 100644 --- a/apps/ios/Shared/Views/Chat/ChatView.swift +++ b/apps/ios/Shared/Views/Chat/ChatView.swift @@ -657,8 +657,12 @@ struct ChatView: View { } .onTapGesture { if let index = model.items.lastIndex(where: { $0.hasUnread() }) { - // scroll to the top unread item - scrollModel.scrollToRow(row: index) + if !loadingMoreItems { + // scroll to the top unread item + scrollModel.scrollToRow(row: index) + } else { + AlertManager.shared.showAlertMsg(title: "Wait", message: "Wait until items loaded") + } } } .contextMenu { @@ -679,17 +683,26 @@ struct ChatView: View { .foregroundColor(theme.colors.primary) } .onTapGesture { - scrollModel.scrollToBottom() + if !loadingMoreItems { + scrollModel.scrollToBottom() + } else { + AlertManager.shared.showAlertMsg(title: "Wait", message: "Wait until items loaded") + } } } else if !model.isNearBottom { circleButton { Image(systemName: "chevron.down") .foregroundColor(theme.colors.primary) } - .onTapGesture { scrollModel.scrollToBottom() } + .onTapGesture { + if !loadingMoreItems { + scrollModel.scrollToBottom() + } else { + AlertManager.shared.showAlertMsg(title: "Wait", message: "Wait until items loaded") + } + } } } - .disabled(loadingMoreItems) .padding() .frame(maxWidth: .infinity, alignment: .trailing) }