mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Multiple chat removal undo
This commit is contained in:
@@ -1208,6 +1208,21 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
||||
return
|
||||
}
|
||||
|
||||
strongSelf.chatListDisplayNode.chatListNode.updateState({ state in
|
||||
var state = state
|
||||
for peerId in peerIds {
|
||||
state.pendingRemovalPeerIds.insert(peerId)
|
||||
}
|
||||
return state
|
||||
})
|
||||
|
||||
let text = strongSelf.presentationData.strings.ChatList_DeletedChats(Int32(peerIds.count))
|
||||
|
||||
strongSelf.present(UndoOverlayController(presentationData: strongSelf.context.sharedContext.currentPresentationData.with { $0 }, content: .removedChat(text: text), elevatedLayout: false, animateInAsReplacement: true, action: { shouldCommit in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
if shouldCommit {
|
||||
let context = strongSelf.context
|
||||
let presentationData = strongSelf.presentationData
|
||||
let progressSignal = Signal<Never, NoError> { subscriber in
|
||||
@@ -1234,9 +1249,21 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
||||
}
|
||||
}
|
||||
let _ = (signal
|
||||
|> deliverOnMainQueue).start(completed: {
|
||||
self?.donePressed()
|
||||
|> deliverOnMainQueue).start()
|
||||
} else {
|
||||
strongSelf.chatListDisplayNode.chatListNode.setCurrentRemovingPeerId(peerIds.first!)
|
||||
strongSelf.chatListDisplayNode.chatListNode.updateState({ state in
|
||||
var state = state
|
||||
for peerId in peerIds {
|
||||
state.pendingRemovalPeerIds.remove(peerId)
|
||||
}
|
||||
return state
|
||||
})
|
||||
self?.chatListDisplayNode.chatListNode.setCurrentRemovingPeerId(peerIds.first!)
|
||||
}
|
||||
}), in: .current)
|
||||
|
||||
strongSelf.donePressed()
|
||||
}))
|
||||
|
||||
actionSheet.setItemGroups([
|
||||
|
||||
Reference in New Issue
Block a user