mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
quoted message alert
This commit is contained in:
@@ -47,6 +47,9 @@ struct FramedItemView: View {
|
||||
}
|
||||
|
||||
if let qi = chatItem.quotedItem {
|
||||
let notFoundItemTitle = NSLocalizedString("Message no longer available", comment: "alert title")
|
||||
let notFoundItemMessage = NSLocalizedString("The quoted message you are trying to view has been deleted.", comment: "alert message")
|
||||
|
||||
ciQuoteView(qi)
|
||||
.onTapGesture {
|
||||
if let itemId = qi.itemId {
|
||||
@@ -65,8 +68,22 @@ struct FramedItemView: View {
|
||||
scrollModel.scrollToItem(id: itemId)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
AlertManager.shared.showAlert(
|
||||
Alert(
|
||||
title: Text(notFoundItemTitle),
|
||||
message: Text(notFoundItemMessage)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
AlertManager.shared.showAlert(
|
||||
Alert(
|
||||
title: Text(notFoundItemTitle),
|
||||
message: Text(notFoundItemMessage)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
} else if let itemForwarded = chatItem.meta.itemForwarded {
|
||||
|
||||
@@ -1947,34 +1947,16 @@ private func filtered(_ reversedChatItems: Array<ChatItem>) -> Array<ChatItem> {
|
||||
|
||||
func loadItemsAround(_ cInfo: ChatInfo, _ chatItemId: Int64) async -> [ChatItem]? {
|
||||
do {
|
||||
let im = ItemsModel.shared
|
||||
var reversedPage = Array<ChatItem>()
|
||||
var chatItemsAvailable = true
|
||||
// Load additional items until the page is +50 large after merging
|
||||
while chatItemsAvailable && filtered(reversedPage).count < loadItemsPerPage {
|
||||
let pagination: ChatPagination = .before(chatItemId: chatItemId, count: loadItemsPerPage / 2)
|
||||
var chatItems = try await apiGetChatItems(
|
||||
type: cInfo.chatType,
|
||||
id: cInfo.apiId,
|
||||
pagination: pagination,
|
||||
search: ""
|
||||
)
|
||||
if let lastItem = chatItems.last {
|
||||
let pagination: ChatPagination = .after(chatItemId: lastItem.id, count: loadItemsPerPage / 2)
|
||||
let afterItems = try await apiGetChatItems(
|
||||
type: cInfo.chatType,
|
||||
id: cInfo.apiId,
|
||||
pagination: pagination,
|
||||
search: ""
|
||||
)
|
||||
chatItems.append(contentsOf: afterItems)
|
||||
}
|
||||
let pagination: ChatPagination = .around(chatItemId: chatItemId, count: loadItemsPerPage * 2)
|
||||
var chatItems = try await apiGetChatItems(
|
||||
type: cInfo.chatType,
|
||||
id: cInfo.apiId,
|
||||
pagination: pagination,
|
||||
search: ""
|
||||
)
|
||||
|
||||
chatItemsAvailable = !chatItems.isEmpty
|
||||
reversedPage.append(contentsOf: chatItems.reversed())
|
||||
}
|
||||
|
||||
return reversedPage
|
||||
return chatItems.reversed()
|
||||
} catch let error {
|
||||
logger.error("apiGetChat error: \(responseError(error))")
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user