mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Add manual account deletion
This commit is contained in:
parent
ecc9279281
commit
25a09c5451
27 changed files with 1383 additions and 81 deletions
|
|
@ -12,7 +12,7 @@ import ContextUI
|
|||
import AccountContext
|
||||
|
||||
public enum HorizontalPeerItemMode {
|
||||
case list
|
||||
case list(compact: Bool)
|
||||
case actionSheet
|
||||
}
|
||||
|
||||
|
|
@ -25,13 +25,13 @@ public final class HorizontalPeerItem: ListViewItem {
|
|||
let context: AccountContext
|
||||
public let peer: EnginePeer
|
||||
let action: (EnginePeer) -> Void
|
||||
let contextAction: (EnginePeer, ASDisplayNode, ContextGesture?) -> Void
|
||||
let contextAction: ((EnginePeer, ASDisplayNode, ContextGesture?) -> Void)?
|
||||
let isPeerSelected: (EnginePeer.Id) -> Bool
|
||||
let customWidth: CGFloat?
|
||||
let presence: EnginePeer.Presence?
|
||||
let unreadBadge: (Int32, Bool)?
|
||||
|
||||
public init(theme: PresentationTheme, strings: PresentationStrings, mode: HorizontalPeerItemMode, context: AccountContext, peer: EnginePeer, presence: EnginePeer.Presence?, unreadBadge: (Int32, Bool)?, action: @escaping (EnginePeer) -> Void, contextAction: @escaping (EnginePeer, ASDisplayNode, ContextGesture?) -> Void, isPeerSelected: @escaping (EnginePeer.Id) -> Bool, customWidth: CGFloat?) {
|
||||
public init(theme: PresentationTheme, strings: PresentationStrings, mode: HorizontalPeerItemMode, context: AccountContext, peer: EnginePeer, presence: EnginePeer.Presence?, unreadBadge: (Int32, Bool)?, action: @escaping (EnginePeer) -> Void, contextAction: ((EnginePeer, ASDisplayNode, ContextGesture?) -> Void)?, isPeerSelected: @escaping (EnginePeer.Id) -> Bool, customWidth: CGFloat?) {
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
self.mode = mode
|
||||
|
|
@ -111,11 +111,6 @@ public final class HorizontalPeerItemNode: ListViewItemNode {
|
|||
item.action(item.peer)
|
||||
}
|
||||
}
|
||||
self.peerNode.contextAction = { [weak self] node, gesture in
|
||||
if let item = self?.item {
|
||||
item.contextAction(item.peer, node, gesture)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override public func didLoad() {
|
||||
|
|
@ -186,10 +181,25 @@ public final class HorizontalPeerItemNode: ListViewItemNode {
|
|||
if let strongSelf = self {
|
||||
strongSelf.item = item
|
||||
strongSelf.peerNode.theme = itemTheme
|
||||
if case let .list(compact) = item.mode {
|
||||
strongSelf.peerNode.compact = compact
|
||||
} else {
|
||||
strongSelf.peerNode.compact = false
|
||||
}
|
||||
strongSelf.peerNode.setup(context: item.context, theme: item.theme, strings: item.strings, peer: EngineRenderedPeer(peer: item.peer), numberOfLines: 1, synchronousLoad: synchronousLoads)
|
||||
strongSelf.peerNode.frame = CGRect(origin: CGPoint(), size: itemLayout.size)
|
||||
strongSelf.peerNode.updateSelection(selected: item.isPeerSelected(item.peer.id), animated: false)
|
||||
|
||||
if let contextAction = item.contextAction {
|
||||
strongSelf.peerNode.contextAction = { [weak item] node, gesture in
|
||||
if let item = item {
|
||||
contextAction(item.peer, node, gesture)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
strongSelf.peerNode.contextAction = nil
|
||||
}
|
||||
|
||||
let badgeBackgroundWidth: CGFloat
|
||||
if let currentBadgeBackgroundImage = currentBadgeBackgroundImage {
|
||||
strongSelf.badgeBackgroundNode.image = currentBadgeBackgroundImage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue