mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Various fixes
This commit is contained in:
@@ -643,79 +643,12 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
|
||||
}
|
||||
|
||||
if data.canEdit && !isPinnedMessages {
|
||||
var mediaReference: AnyMediaReference?
|
||||
for media in message.media {
|
||||
if let image = media as? TelegramMediaImage, let _ = largestImageRepresentation(image.representations) {
|
||||
mediaReference = ImageMediaReference.standalone(media: image).abstract
|
||||
break
|
||||
} else if let file = media as? TelegramMediaFile {
|
||||
mediaReference = FileMediaReference.standalone(media: file).abstract
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_MessageDialogEdit, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { c, f in
|
||||
if let _ = mediaReference?.media as? TelegramMediaImage {
|
||||
var updatedItems: [ContextMenuItem] = []
|
||||
updatedItems.append(.action(ContextMenuActionItem(text: message.text.isEmpty ? chatPresentationInterfaceState.strings.Conversation_AddCaption : chatPresentationInterfaceState.strings.Conversation_EditCaption, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Caption"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { _, f in
|
||||
interfaceInteraction.setupEditMessage(messages[0].id, { transition in
|
||||
f(.custom(transition))
|
||||
})
|
||||
})))
|
||||
updatedItems.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_EditThisPhoto, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Draw"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { _, f in
|
||||
controllerInteraction.editMessageMedia(messages[0].id, true)
|
||||
f(.dismissWithoutContent)
|
||||
})))
|
||||
updatedItems.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ReplacePhoto, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Replace"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { _, f in
|
||||
controllerInteraction.editMessageMedia(messages[0].id, false)
|
||||
f(.dismissWithoutContent)
|
||||
})))
|
||||
|
||||
updatedItems.append(.separator)
|
||||
updatedItems.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.ChatList_Context_Back, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Back"), color: theme.contextMenu.primaryColor)
|
||||
}, action: { c, _ in
|
||||
c.setItems(contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState: chatPresentationInterfaceState, context: context, messages: messages, controllerInteraction: controllerInteraction, selectAll: selectAll, interfaceInteraction: interfaceInteraction))
|
||||
})))
|
||||
|
||||
c.setItems(.single(updatedItems))
|
||||
} else if let _ = mediaReference?.media as? TelegramMediaFile {
|
||||
var updatedItems: [ContextMenuItem] = []
|
||||
updatedItems.append(.action(ContextMenuActionItem(text: message.text.isEmpty ? chatPresentationInterfaceState.strings.Conversation_AddCaption : chatPresentationInterfaceState.strings.Conversation_EditCaption, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Caption"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { _, f in
|
||||
interfaceInteraction.setupEditMessage(messages[0].id, { transition in
|
||||
f(.custom(transition))
|
||||
})
|
||||
})))
|
||||
updatedItems.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ReplaceFile, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Replace"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { _, f in
|
||||
controllerInteraction.editMessageMedia(messages[0].id, false)
|
||||
f(.dismissWithoutContent)
|
||||
})))
|
||||
|
||||
updatedItems.append(.separator)
|
||||
updatedItems.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.ChatList_Context_Back, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Back"), color: theme.contextMenu.primaryColor)
|
||||
}, action: { c, _ in
|
||||
c.setItems(contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState: chatPresentationInterfaceState, context: context, messages: messages, controllerInteraction: controllerInteraction, selectAll: selectAll, interfaceInteraction: interfaceInteraction))
|
||||
})))
|
||||
|
||||
c.setItems(.single(updatedItems))
|
||||
} else {
|
||||
interfaceInteraction.setupEditMessage(messages[0].id, { transition in
|
||||
f(.custom(transition))
|
||||
})
|
||||
}
|
||||
interfaceInteraction.setupEditMessage(messages[0].id, { transition in
|
||||
f(.custom(transition))
|
||||
})
|
||||
})))
|
||||
}
|
||||
|
||||
@@ -830,7 +763,7 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
var warnAboutPrivate = false
|
||||
if case let .peer = chatPresentationInterfaceState.chatLocation {
|
||||
if case .peer = chatPresentationInterfaceState.chatLocation {
|
||||
if channel.addressName == nil {
|
||||
warnAboutPrivate = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user