mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix story reactions
This commit is contained in:
parent
1a80c230c4
commit
0882817bed
@ -7004,7 +7004,8 @@ public final class EmojiPagerContentComponent: Component {
|
|||||||
topicTitle: String? = nil,
|
topicTitle: String? = nil,
|
||||||
topicColor: Int32? = nil,
|
topicColor: Int32? = nil,
|
||||||
hasSearch: Bool = true,
|
hasSearch: Bool = true,
|
||||||
forceHasPremium: Bool = false
|
forceHasPremium: Bool = false,
|
||||||
|
premiumIfSavedMessages: Bool = true
|
||||||
) -> Signal<EmojiPagerContentComponent, NoError> {
|
) -> Signal<EmojiPagerContentComponent, NoError> {
|
||||||
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: context.currentAppConfiguration.with { $0 })
|
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: context.currentAppConfiguration.with { $0 })
|
||||||
let isPremiumDisabled = premiumConfiguration.isPremiumDisabled
|
let isPremiumDisabled = premiumConfiguration.isPremiumDisabled
|
||||||
@ -7071,7 +7072,7 @@ public final class EmojiPagerContentComponent: Component {
|
|||||||
|
|
||||||
let emojiItems: Signal<EmojiPagerContentComponent, NoError> = combineLatest(
|
let emojiItems: Signal<EmojiPagerContentComponent, NoError> = combineLatest(
|
||||||
context.account.postbox.itemCollectionsView(orderedItemListCollectionIds: orderedItemListCollectionIds, namespaces: [Namespaces.ItemCollection.CloudEmojiPacks], aroundIndex: nil, count: 10000000),
|
context.account.postbox.itemCollectionsView(orderedItemListCollectionIds: orderedItemListCollectionIds, namespaces: [Namespaces.ItemCollection.CloudEmojiPacks], aroundIndex: nil, count: 10000000),
|
||||||
forceHasPremium ? .single(true) : hasPremium(context: context, chatPeerId: chatPeerId, premiumIfSavedMessages: true),
|
forceHasPremium ? .single(true) : hasPremium(context: context, chatPeerId: chatPeerId, premiumIfSavedMessages: premiumIfSavedMessages),
|
||||||
context.account.viewTracker.featuredEmojiPacks(),
|
context.account.viewTracker.featuredEmojiPacks(),
|
||||||
availableReactions,
|
availableReactions,
|
||||||
searchCategories,
|
searchCategories,
|
||||||
|
@ -1897,11 +1897,17 @@ public final class MediaEditorScreen: ViewController {
|
|||||||
self.controller?.present(tooltipController, in: .current)
|
self.controller?.present(tooltipController, in: .current)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private weak var muteTooltip: ViewController?
|
||||||
func presentMutedTooltip() {
|
func presentMutedTooltip() {
|
||||||
guard let sourceView = self.componentHost.findTaggedView(tag: muteButtonTag) else {
|
guard let sourceView = self.componentHost.findTaggedView(tag: muteButtonTag) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let muteTooltip = self.muteTooltip {
|
||||||
|
muteTooltip.dismiss()
|
||||||
|
self.muteTooltip = nil
|
||||||
|
}
|
||||||
|
|
||||||
let isMuted = self.mediaEditor?.values.videoIsMuted ?? false
|
let isMuted = self.mediaEditor?.values.videoIsMuted ?? false
|
||||||
|
|
||||||
let parentFrame = self.view.convert(self.bounds, to: nil)
|
let parentFrame = self.view.convert(self.bounds, to: nil)
|
||||||
@ -1911,6 +1917,7 @@ public final class MediaEditorScreen: ViewController {
|
|||||||
let tooltipController = TooltipScreen(account: self.context.account, sharedContext: self.context.sharedContext, text: isMuted ? "The story will have no sound." : "The story will have sound." , location: .point(location, .top), displayDuration: .default, inset: 16.0, shouldDismissOnTouch: { _ in
|
let tooltipController = TooltipScreen(account: self.context.account, sharedContext: self.context.sharedContext, text: isMuted ? "The story will have no sound." : "The story will have sound." , location: .point(location, .top), displayDuration: .default, inset: 16.0, shouldDismissOnTouch: { _ in
|
||||||
return .ignore
|
return .ignore
|
||||||
})
|
})
|
||||||
|
self.muteTooltip = tooltipController
|
||||||
self.controller?.present(tooltipController, in: .current)
|
self.controller?.present(tooltipController, in: .current)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1820,7 +1820,8 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
areUnicodeEmojiEnabled: false,
|
areUnicodeEmojiEnabled: false,
|
||||||
areCustomEmojiEnabled: true,
|
areCustomEmojiEnabled: true,
|
||||||
chatPeerId: component.context.account.peerId,
|
chatPeerId: component.context.account.peerId,
|
||||||
selectedItems: Set()
|
selectedItems: Set(),
|
||||||
|
premiumIfSavedMessages: false
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
isExpandedUpdated: { [weak self] transition in
|
isExpandedUpdated: { [weak self] transition in
|
||||||
@ -1896,43 +1897,63 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
self.state?.updated(transition: Transition(animation: .curve(duration: 0.25, curve: .easeInOut)))
|
self.state?.updated(transition: Transition(animation: .curve(duration: 0.25, curve: .easeInOut)))
|
||||||
|
|
||||||
if let centerAnimation = reaction.centerAnimation {
|
if let centerAnimation = reaction.centerAnimation {
|
||||||
/*let file = centerAnimation
|
let file = centerAnimation
|
||||||
|
|
||||||
var text = "."
|
var text = ""
|
||||||
loop: for attribute in file.attributes {
|
var messageAttributes: [MessageAttribute] = []
|
||||||
switch attribute {
|
var inlineStickers: [MediaId : Media] = [:]
|
||||||
case let .CustomEmoji(_, _, displayText, _):
|
switch reaction.value {
|
||||||
text = displayText
|
case let .builtin(textValue):
|
||||||
break loop
|
text = textValue
|
||||||
default:
|
case .custom:
|
||||||
break
|
loop: for attribute in file.attributes {
|
||||||
|
switch attribute {
|
||||||
|
case let .CustomEmoji(_, _, displayText, _):
|
||||||
|
text = displayText
|
||||||
|
messageAttributes = [
|
||||||
|
TextEntitiesMessageAttribute(entities: [MessageTextEntity(range: 0 ..< 1, type: .CustomEmoji(stickerPack: nil, fileId: centerAnimation.fileId.id))])
|
||||||
|
]
|
||||||
|
inlineStickers = [centerAnimation.fileId: centerAnimation]
|
||||||
|
break loop
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
|
||||||
let message: EnqueueMessage = .message(
|
let message: EnqueueMessage = .message(
|
||||||
text: "",
|
text: text,
|
||||||
attributes: [
|
attributes: messageAttributes,
|
||||||
//TextEntitiesMessageAttribute(entities: [MessageTextEntity(range: 0 ..< 1, type: .CustomEmoji(stickerPack: nil, fileId: centerAnimation.fileId.id))])
|
inlineStickers: inlineStickers,
|
||||||
],
|
mediaReference: nil,
|
||||||
inlineStickers: [:],//[centerAnimation.fileId: centerAnimation],
|
|
||||||
mediaReference: AnyMediaReference.standalone(media: reaction.activateAnimation),
|
|
||||||
replyToMessageId: nil,
|
replyToMessageId: nil,
|
||||||
replyToStoryId: StoryId(peerId: component.slice.peer.id, id: component.slice.item.storyItem.id),
|
replyToStoryId: StoryId(peerId: component.slice.peer.id, id: component.slice.item.storyItem.id),
|
||||||
localGroupingKey: nil,
|
localGroupingKey: nil,
|
||||||
correlationId: nil,
|
correlationId: nil,
|
||||||
bubbleUpEmojiOrStickersets: []
|
bubbleUpEmojiOrStickersets: []
|
||||||
)
|
)
|
||||||
let _ = enqueueMessages(account: component.context.account, peerId: component.slice.peer.id, messages: [message]).start()
|
|
||||||
|
|
||||||
|
let context = component.context
|
||||||
let presentationData = component.context.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: component.theme)
|
let presentationData = component.context.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: component.theme)
|
||||||
component.presentController(UndoOverlayController(
|
let presentController = component.presentController
|
||||||
presentationData: presentationData,
|
let controller = component.controller
|
||||||
content: .sticker(context: component.context, file: centerAnimation, loop: false, title: nil, text: "Reaction Sent.", undoText: "View in Chat", customAction: {
|
let peer = component.slice.peer
|
||||||
}),
|
|
||||||
elevatedLayout: false,
|
let _ = (enqueueMessages(account: context.account, peerId: peer.id, messages: [message])
|
||||||
animateInAsReplacement: false,
|
|> deliverOnMainQueue).start(next: { messageIds in
|
||||||
action: { _ in return false }
|
presentController(UndoOverlayController(
|
||||||
))
|
presentationData: presentationData,
|
||||||
|
content: .sticker(context: context, file: centerAnimation, loop: false, title: nil, text: "Reaction Sent.", undoText: "View in Chat", customAction: {
|
||||||
|
if let messageId = messageIds.first, let messageId, let navigationController = controller()?.navigationController as? NavigationController {
|
||||||
|
context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(peer), subject: .message(id: .id(messageId), highlight: false, timecode: nil)))
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
elevatedLayout: false,
|
||||||
|
animateInAsReplacement: false,
|
||||||
|
action: { _ in return false }
|
||||||
|
))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,8 @@ final class StoryItemSetViewListComponent: Component {
|
|||||||
self.visibleItems[item.peer.id] = visibleItem
|
self.visibleItems[item.peer.id] = visibleItem
|
||||||
}
|
}
|
||||||
|
|
||||||
let dateText = humanReadableStringForTimestamp(strings: component.strings, dateTimeFormat: PresentationDateTimeFormat(), timestamp: item.timestamp, alwaysShowTime: true, allowYesterday: true, format: HumanReadableStringFormat(
|
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||||
|
let dateText = humanReadableStringForTimestamp(strings: component.strings, dateTimeFormat: presentationData.dateTimeFormat, timestamp: item.timestamp, alwaysShowTime: true, allowYesterday: true, format: HumanReadableStringFormat(
|
||||||
dateFormatString: { value in
|
dateFormatString: { value in
|
||||||
return PresentationStrings.FormattedString(string: component.strings.Chat_MessageSeenTimestamp_Date(value).string, ranges: [])
|
return PresentationStrings.FormattedString(string: component.strings.Chat_MessageSeenTimestamp_Date(value).string, ranges: [])
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user