mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 19:30:29 +00:00
Display Clear Cache suggestion in all cases
This commit is contained in:
parent
9c9233396d
commit
24bbcd9662
@ -3008,7 +3008,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if let banAuthor = actions.banAuthor {
|
if let banAuthor = actions.banAuthor {
|
||||||
strongSelf.presentBanMessageOptions(accountPeerId: strongSelf.context.account.peerId, author: banAuthor, messageIds: messageIds, options: actions.options)
|
strongSelf.presentBanMessageOptions(accountPeerId: strongSelf.context.account.peerId, author: banAuthor, messageIds: messageIds, options: actions.options)
|
||||||
} else {
|
} else {
|
||||||
strongSelf.presentDeleteMessageOptions(messageIds: messageIds, options: actions.options, contextController: nil, completion: { _ in })
|
if actions.options.intersection([.deleteLocally, .deleteGlobally]).isEmpty {
|
||||||
|
strongSelf.presentClearCacheSuggestion()
|
||||||
|
} else {
|
||||||
|
strongSelf.presentDeleteMessageOptions(messageIds: messageIds, options: actions.options, contextController: nil, completion: { _ in })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
@ -3051,14 +3055,19 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
let _ = deleteMessagesInteractively(postbox: strongSelf.context.account.postbox, messageIds: Array(messageIds), type: .forEveryone, deleteAllInGroup: true).start()
|
let _ = deleteMessagesInteractively(postbox: strongSelf.context.account.postbox, messageIds: Array(messageIds), type: .forEveryone, deleteAllInGroup: true).start()
|
||||||
completion(.dismissWithoutContent)
|
completion(.dismissWithoutContent)
|
||||||
} else {
|
} else {
|
||||||
var isScheduled = false
|
if actions.options.intersection([.deleteLocally, .deleteGlobally]).isEmpty {
|
||||||
for id in messageIds {
|
strongSelf.presentClearCacheSuggestion()
|
||||||
if Namespaces.Message.allScheduled.contains(id.namespace) {
|
completion(.default)
|
||||||
isScheduled = true
|
} else {
|
||||||
break
|
var isScheduled = false
|
||||||
|
for id in messageIds {
|
||||||
|
if Namespaces.Message.allScheduled.contains(id.namespace) {
|
||||||
|
isScheduled = true
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
strongSelf.presentDeleteMessageOptions(messageIds: messageIds, options: isScheduled ? [.deleteLocally] : actions.options, contextController: contextController, completion: completion)
|
||||||
}
|
}
|
||||||
strongSelf.presentDeleteMessageOptions(messageIds: messageIds, options: isScheduled ? [.deleteLocally] : actions.options, contextController: contextController, completion: completion)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8044,7 +8053,6 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
let _ = (self.context.account.postbox.loadedPeerWithId(peerId)
|
let _ = (self.context.account.postbox.loadedPeerWithId(peerId)
|
||||||
|> mapToSignal { peer -> Signal<(Peer, UIImage?), NoError> in
|
|> mapToSignal { peer -> Signal<(Peer, UIImage?), NoError> in
|
||||||
let avatarImage = peerAvatarImage(account: self.context.account, peer: peer, authorOfMessage: nil, representation: peer.smallProfileImage, round: false) ?? .single(nil)
|
let avatarImage = peerAvatarImage(account: self.context.account, peer: peer, authorOfMessage: nil, representation: peer.smallProfileImage, round: false) ?? .single(nil)
|
||||||
|
|
||||||
return avatarImage
|
return avatarImage
|
||||||
|> map { avatarImage in
|
|> map { avatarImage in
|
||||||
return (peer, avatarImage)
|
return (peer, avatarImage)
|
||||||
|
|||||||
@ -684,7 +684,11 @@ func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState:
|
|||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
if !data.messageActions.options.intersection([.deleteLocally, .deleteGlobally]).isEmpty && !isAction {
|
var clearCacheAsDelete = false
|
||||||
|
if let peer = message.peers[message.id.peerId] as? TelegramChannel {
|
||||||
|
clearCacheAsDelete = true
|
||||||
|
}
|
||||||
|
if (!data.messageActions.options.intersection([.deleteLocally, .deleteGlobally]).isEmpty || clearCacheAsDelete) && !isAction {
|
||||||
let title = message.flags.isSending ? chatPresentationInterfaceState.strings.Conversation_ContextMenuCancelSending : chatPresentationInterfaceState.strings.Conversation_ContextMenuDelete
|
let title = message.flags.isSending ? chatPresentationInterfaceState.strings.Conversation_ContextMenuCancelSending : chatPresentationInterfaceState.strings.Conversation_ContextMenuDelete
|
||||||
actions.append(.action(ContextMenuActionItem(text: title, textColor: .destructive, icon: { theme in
|
actions.append(.action(ContextMenuActionItem(text: title, textColor: .destructive, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: message.flags.isSending ? "Chat/Context Menu/Clear" : "Chat/Context Menu/Delete"), color: theme.actionSheet.destructiveActionTextColor)
|
return generateTintedImage(image: UIImage(bundleImageName: message.flags.isSending ? "Chat/Context Menu/Clear" : "Chat/Context Menu/Delete"), color: theme.actionSheet.destructiveActionTextColor)
|
||||||
|
|||||||
@ -143,26 +143,24 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
|
|||||||
self.forwardButton.isEnabled = actions.options.contains(.forward)
|
self.forwardButton.isEnabled = actions.options.contains(.forward)
|
||||||
self.shareButton.isEnabled = false
|
self.shareButton.isEnabled = false
|
||||||
|
|
||||||
self.deleteButton.isEnabled = !actions.options.intersection([.deleteLocally, .deleteGlobally]).isEmpty
|
self.deleteButton.isEnabled = true
|
||||||
self.shareButton.isEnabled = !actions.options.intersection([.forward]).isEmpty
|
self.shareButton.isEnabled = !actions.options.intersection([.forward]).isEmpty
|
||||||
self.reportButton.isEnabled = !actions.options.intersection([.report]).isEmpty
|
self.reportButton.isEnabled = !actions.options.intersection([.report]).isEmpty
|
||||||
|
|
||||||
self.deleteButton.isHidden = !self.deleteButton.isEnabled
|
self.deleteButton.isHidden = false
|
||||||
self.reportButton.isHidden = !self.reportButton.isEnabled
|
self.reportButton.isHidden = !self.reportButton.isEnabled
|
||||||
} else {
|
} else {
|
||||||
self.deleteButton.isEnabled = false
|
self.deleteButton.isEnabled = false
|
||||||
self.deleteButton.isHidden = true
|
self.deleteButton.isHidden = false
|
||||||
self.reportButton.isEnabled = false
|
self.reportButton.isEnabled = false
|
||||||
self.reportButton.isHidden = true
|
self.reportButton.isHidden = true
|
||||||
self.forwardButton.isEnabled = false
|
self.forwardButton.isEnabled = false
|
||||||
self.shareButton.isEnabled = false
|
self.shareButton.isEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.deleteButton.isHidden && self.reportButton.isHidden {
|
if self.reportButton.isHidden {
|
||||||
if let peer = interfaceState.renderedPeer?.peer as? TelegramChannel, case .broadcast = peer.info {
|
if let peer = interfaceState.renderedPeer?.peer as? TelegramChannel, case .broadcast = peer.info {
|
||||||
self.reportButton.isHidden = false
|
self.reportButton.isHidden = false
|
||||||
} else {
|
|
||||||
self.deleteButton.isHidden = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class ChatScheduleTimeControllerNode: ViewControllerTracingNode, UIScrollViewDel
|
|||||||
self.contentContainerNode.addSubnode(self.cancelButton)
|
self.contentContainerNode.addSubnode(self.cancelButton)
|
||||||
self.contentContainerNode.addSubnode(self.doneButton)
|
self.contentContainerNode.addSubnode(self.doneButton)
|
||||||
if case .scheduledMessages(true) = self.mode {
|
if case .scheduledMessages(true) = self.mode {
|
||||||
self.contentContainerNode.addSubnode(self.onlineButton)
|
//self.contentContainerNode.addSubnode(self.onlineButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.cancelButton.addTarget(self, action: #selector(self.cancelButtonPressed), forControlEvents: .touchUpInside)
|
self.cancelButton.addTarget(self, action: #selector(self.cancelButtonPressed), forControlEvents: .touchUpInside)
|
||||||
@ -316,7 +316,7 @@ class ChatScheduleTimeControllerNode: ViewControllerTracingNode, UIScrollViewDel
|
|||||||
|
|
||||||
var buttonOffset: CGFloat = 0.0
|
var buttonOffset: CGFloat = 0.0
|
||||||
if case .scheduledMessages(true) = self.mode {
|
if case .scheduledMessages(true) = self.mode {
|
||||||
buttonOffset += 60.0
|
//buttonOffset += 60.0
|
||||||
}
|
}
|
||||||
|
|
||||||
let bottomInset: CGFloat = 10.0 + cleanInsets.bottom
|
let bottomInset: CGFloat = 10.0 + cleanInsets.bottom
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user