mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-20 10:11:10 +00:00
Various improvements
This commit is contained in:
parent
183db2a8e4
commit
484c350538
@ -1265,7 +1265,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
|
||||
}, addDoNotTranslateLanguage: { _ in
|
||||
}, hideTranslationPanel: {
|
||||
}, openPremiumGift: {
|
||||
}, openSuggestPost: { _ in
|
||||
}, openSuggestPost: { _, _ in
|
||||
}, openPremiumRequiredForMessaging: {
|
||||
}, openStarsPurchase: { _ in
|
||||
}, openMessagePayment: {
|
||||
|
@ -62,6 +62,13 @@ public enum ChatTranslationDisplayType {
|
||||
}
|
||||
|
||||
public final class ChatPanelInterfaceInteraction {
|
||||
public enum OpenSuggestPostMode {
|
||||
case `default`
|
||||
case editMessage
|
||||
case editTime
|
||||
case editPrice
|
||||
}
|
||||
|
||||
public let setupReplyMessage: (MessageId?, @escaping (ContainedViewLayoutTransition, @escaping () -> Void) -> Void) -> Void
|
||||
public let setupEditMessage: (MessageId?, @escaping (ContainedViewLayoutTransition) -> Void) -> Void
|
||||
public let beginMessageSelection: ([MessageId], @escaping (ContainedViewLayoutTransition) -> Void) -> Void
|
||||
@ -168,7 +175,7 @@ public final class ChatPanelInterfaceInteraction {
|
||||
public let addDoNotTranslateLanguage: (String) -> Void
|
||||
public let hideTranslationPanel: () -> Void
|
||||
public let openPremiumGift: () -> Void
|
||||
public let openSuggestPost: (Message?) -> Void
|
||||
public let openSuggestPost: (Message?, OpenSuggestPostMode) -> Void
|
||||
public let openPremiumRequiredForMessaging: () -> Void
|
||||
public let openStarsPurchase: (Int64?) -> Void
|
||||
public let openMessagePayment: () -> Void
|
||||
@ -291,7 +298,7 @@ public final class ChatPanelInterfaceInteraction {
|
||||
addDoNotTranslateLanguage: @escaping (String) -> Void,
|
||||
hideTranslationPanel: @escaping () -> Void,
|
||||
openPremiumGift: @escaping () -> Void,
|
||||
openSuggestPost: @escaping (Message?) -> Void,
|
||||
openSuggestPost: @escaping (Message?, OpenSuggestPostMode) -> Void,
|
||||
openPremiumRequiredForMessaging: @escaping () -> Void,
|
||||
openStarsPurchase: @escaping (Int64?) -> Void,
|
||||
openMessagePayment: @escaping () -> Void,
|
||||
@ -544,7 +551,7 @@ public final class ChatPanelInterfaceInteraction {
|
||||
}, addDoNotTranslateLanguage: { _ in
|
||||
}, hideTranslationPanel: {
|
||||
}, openPremiumGift: {
|
||||
}, openSuggestPost: { _ in
|
||||
}, openSuggestPost: { _, _ in
|
||||
}, openPremiumRequiredForMessaging: {
|
||||
}, openStarsPurchase: { _ in
|
||||
}, openMessagePayment: {
|
||||
|
@ -107,6 +107,7 @@ func _internal_reinstateNoPaidMessagesException(account: Account, scopePeerId: P
|
||||
}
|
||||
var flags: Int32 = 0
|
||||
flags |= (1 << 2)
|
||||
flags |= (1 << 1)
|
||||
return account.network.request(Api.functions.account.toggleNoPaidMessagesException(flags: flags, parentPeer: scopeInputPeer, userId: inputUser))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .single(.boolFalse)
|
||||
|
@ -165,7 +165,7 @@ public final class ChatRecentActionsController: TelegramBaseController {
|
||||
}, addDoNotTranslateLanguage: { _ in
|
||||
}, hideTranslationPanel: {
|
||||
}, openPremiumGift: {
|
||||
}, openSuggestPost: { _ in
|
||||
}, openSuggestPost: { _, _ in
|
||||
}, openPremiumRequiredForMessaging: {
|
||||
}, openStarsPurchase: { _ in
|
||||
}, openMessagePayment: {
|
||||
|
@ -430,7 +430,7 @@ final class PeerInfoSelectionPanelNode: ASDisplayNode {
|
||||
}, addDoNotTranslateLanguage: { _ in
|
||||
}, hideTranslationPanel: {
|
||||
}, openPremiumGift: {
|
||||
}, openSuggestPost: { _ in
|
||||
}, openSuggestPost: { _, _ in
|
||||
}, openPremiumRequiredForMessaging: {
|
||||
}, openStarsPurchase: { _ in
|
||||
}, openMessagePayment: {
|
||||
|
@ -818,7 +818,7 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
||||
}, addDoNotTranslateLanguage: { _ in
|
||||
}, hideTranslationPanel: {
|
||||
}, openPremiumGift: {
|
||||
}, openSuggestPost: { _ in
|
||||
}, openSuggestPost: { _, _ in
|
||||
}, openPremiumRequiredForMessaging: {
|
||||
}, openStarsPurchase: { _ in
|
||||
}, openMessagePayment: {
|
||||
|
@ -4141,7 +4141,7 @@ extension ChatControllerImpl {
|
||||
})
|
||||
self.push(controller)
|
||||
}
|
||||
}, openSuggestPost: { [weak self] message in
|
||||
}, openSuggestPost: { [weak self] message, mode in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
@ -4198,6 +4198,13 @@ extension ChatControllerImpl {
|
||||
}
|
||||
return updated
|
||||
})
|
||||
|
||||
switch mode {
|
||||
case .default, .editMessage:
|
||||
break
|
||||
case .editTime, .editPrice:
|
||||
self.presentSuggestPostOptions()
|
||||
}
|
||||
} else {
|
||||
self.updateChatPresentationInterfaceState(interactive: true, { state in
|
||||
var state = state
|
||||
@ -4212,8 +4219,8 @@ extension ChatControllerImpl {
|
||||
}
|
||||
return state
|
||||
})
|
||||
self.presentSuggestPostOptions()
|
||||
}
|
||||
self.presentSuggestPostOptions()
|
||||
}, openPremiumRequiredForMessaging: { [weak self] in
|
||||
guard let self else {
|
||||
return
|
||||
|
@ -2374,7 +2374,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
]), in: .window(.root))
|
||||
}
|
||||
case 2:
|
||||
strongSelf.interfaceInteraction?.openSuggestPost(message)
|
||||
strongSelf.interfaceInteraction?.openSuggestPost(message, .default)
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
@ -819,8 +819,10 @@ extension ChatControllerImpl {
|
||||
if let channel = peerView.peers[peerView.peerId] as? TelegramChannel {
|
||||
if channel.isMonoForum {
|
||||
if let linkedMonoforumId = channel.linkedMonoforumId, let mainChannel = peerView.peers[linkedMonoforumId] as? TelegramChannel, mainChannel.hasPermission(.manageDirect) {
|
||||
} else if let sendPaidMessageStarsValue = cachedData.sendPaidMessageStars, sendPaidMessageStarsValue == .zero {
|
||||
sendPaidMessageStars = nil
|
||||
} else {
|
||||
sendPaidMessageStars = cachedData.sendPaidMessageStars
|
||||
sendPaidMessageStars = channel.sendPaidMessageStars
|
||||
}
|
||||
} else {
|
||||
if channel.flags.contains(.isCreator) || channel.adminRights != nil {
|
||||
|
@ -1521,13 +1521,37 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
|
||||
|
||||
if canSuggestPost {
|
||||
//TODO:localize
|
||||
actions.append(.action(ContextMenuActionItem(text: "Suggest a Post", icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Customize"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { c, _ in
|
||||
c?.dismiss(completion: {
|
||||
interfaceInteraction.openSuggestPost(message)
|
||||
})
|
||||
})))
|
||||
if message.attributes.contains(where: { $0 is SuggestedPostMessageAttribute }) {
|
||||
actions.append(.action(ContextMenuActionItem(text: "Edit Message", icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { c, _ in
|
||||
c?.dismiss(completion: {
|
||||
interfaceInteraction.openSuggestPost(message, .editMessage)
|
||||
})
|
||||
})))
|
||||
actions.append(.action(ContextMenuActionItem(text: "Edit Time", icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Calendar"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { c, _ in
|
||||
c?.dismiss(completion: {
|
||||
interfaceInteraction.openSuggestPost(message, .editTime)
|
||||
})
|
||||
})))
|
||||
actions.append(.action(ContextMenuActionItem(text: "Edit Price", icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/PriceTag"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { c, _ in
|
||||
c?.dismiss(completion: {
|
||||
interfaceInteraction.openSuggestPost(message, .editPrice)
|
||||
})
|
||||
})))
|
||||
} else {
|
||||
actions.append(.action(ContextMenuActionItem(text: "Suggest a Post", icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Customize"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { c, _ in
|
||||
c?.dismiss(completion: {
|
||||
interfaceInteraction.openSuggestPost(message, .default)
|
||||
})
|
||||
})))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4773,7 +4773,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate, Ch
|
||||
case .gift:
|
||||
self.interfaceInteraction?.openPremiumGift()
|
||||
case .suggestPost:
|
||||
self.interfaceInteraction?.openSuggestPost(nil)
|
||||
self.interfaceInteraction?.openSuggestPost(nil, .default)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user