Multiple chat removal undo

This commit is contained in:
Ali
2019-11-05 22:16:49 +04:00
parent c19ca52e6a
commit 2707476621

View File

@@ -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([