Various fixes

This commit is contained in:
Ilya Laktyushin
2021-03-09 12:00:10 +04:00
parent 4a7d5ccb67
commit b4f89a7e6c
53 changed files with 4761 additions and 4566 deletions

View File

@@ -700,7 +700,7 @@ public func installedStickerPacksController(context: AccountContext, mode: Insta
})
let selectedCount = Int32(state.selectedPackIds?.count ?? 0)
toolbarItem = ItemListToolbarItem(actions: [.init(title: presentationData.strings.StickerPacks_ActionDelete, isEnabled: selectedCount > 0, action: {
toolbarItem = StickersToolbarItem(selectedCount: selectedCount, actions: [.init(title: presentationData.strings.StickerPacks_ActionDelete, isEnabled: selectedCount > 0, action: {
let actionSheet = ActionSheetController(presentationData: presentationData)
var items: [ActionSheetItem] = []
items.append(ActionSheetButtonItem(title: presentationData.strings.StickerPacks_DeleteStickerPacksConfirmation(selectedCount), color: .destructive, action: { [weak actionSheet] in
@@ -986,3 +986,20 @@ public func installedStickerPacksController(context: AccountContext, mode: Insta
return controller
}
private class StickersToolbarItem: ItemListToolbarItem {
private let selectedCount: Int32
init(selectedCount: Int32, actions: [Action]) {
self.selectedCount = selectedCount
super.init(actions: actions)
}
override func isEqual(to: ItemListToolbarItem) -> Bool {
if let other = to as? StickersToolbarItem {
return self.selectedCount == other.selectedCount
} else {
return false
}
}
}