mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-06 05:02:54 +00:00
Update dice
This commit is contained in:
@@ -5475,6 +5475,7 @@ Any member of this group will be able to see messages in the channel.";
|
||||
"MuteFor.Forever" = "Mute Forever";
|
||||
|
||||
"Conversation.Dice" = "Send a 🎲 emoji to any chat to get a random number from Telegram.";
|
||||
"Conversation.Darts" = "Send a single dart 🎯 emoji to try your luck.";
|
||||
|
||||
"ForwardedDices_1" = "Forwarded dice";
|
||||
"ForwardedDices_2" = "2 forwarded dices";
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1008,9 +1008,20 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
||||
return .optionalAction({
|
||||
let _ = item.controllerInteraction.openMessage(item.message, .default)
|
||||
})
|
||||
} else if let _ = self.telegramDice {
|
||||
} else if let dice = self.telegramDice {
|
||||
return .optionalAction({
|
||||
item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, item.presentationData.strings.Conversation_Dice, self, self.imageNode.frame.offsetBy(dx: 0.0, dy: self.imageNode.frame.height / 3.0))
|
||||
var text: String?
|
||||
switch dice.emoji {
|
||||
case "🎲":
|
||||
text = item.presentationData.strings.Conversation_Dice
|
||||
case "🎯":
|
||||
text = item.presentationData.strings.Conversation_Darts
|
||||
default:
|
||||
break
|
||||
}
|
||||
if let text = text {
|
||||
item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, text, self, self.imageNode.frame.offsetBy(dx: 0.0, dy: self.imageNode.frame.height / 3.0))
|
||||
}
|
||||
})
|
||||
} else if let _ = self.emojiFile {
|
||||
if let animationNode = self.animationNode as? AnimatedStickerNode {
|
||||
|
||||
@@ -146,8 +146,6 @@ final class ManagedDiceAnimationNode: ManagedAnimationNode, GenericAnimatedStick
|
||||
return .single(ManagedAnimationItem(source: .resource(context.account.postbox.mediaBox, file.resource), frames: ManagedAnimationFrameRange(startFrame: 0, endFrame: frameCount), duration: duration))
|
||||
}
|
||||
} else {
|
||||
self.setState(.rolling)
|
||||
|
||||
let dimensions = file.dimensions ?? PixelDimensions(width: 512, height: 512)
|
||||
let fittedSize = dimensions.cgSize.aspectFilled(CGSize(width: 384.0, height: 384.0))
|
||||
|
||||
@@ -159,6 +157,7 @@ final class ManagedDiceAnimationNode: ManagedAnimationNode, GenericAnimatedStick
|
||||
return data.complete
|
||||
}).start(next: { next in
|
||||
subscriber.putNext(ManagedAnimationItem(source: .resource(context.account.postbox.mediaBox, file.resource), frames: ManagedAnimationFrameRange(startFrame: 0, endFrame: frameCount), duration: duration))
|
||||
subscriber.putCompletion()
|
||||
})
|
||||
|
||||
return ActionDisposable {
|
||||
@@ -166,7 +165,12 @@ final class ManagedDiceAnimationNode: ManagedAnimationNode, GenericAnimatedStick
|
||||
resourceDisposable.dispose()
|
||||
}
|
||||
}
|
||||
return animationItem
|
||||
|
||||
if let item = rollingAnimationItem(emoji: self.dice.emoji) {
|
||||
return .single(item) |> then(animationItem)
|
||||
} else {
|
||||
return animationItem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user