mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various improvements
This commit is contained in:
parent
103b244216
commit
8164009fdb
@ -13782,3 +13782,9 @@ Sorry for the inconvenience.";
|
|||||||
"AvatarUpload.StatusUploading" = "Your photo is uploading.";
|
"AvatarUpload.StatusUploading" = "Your photo is uploading.";
|
||||||
"AvatarUpload.StatusDone" = "Your photo is now set.";
|
"AvatarUpload.StatusDone" = "Your photo is now set.";
|
||||||
"AvatarUpload.ViewAction" = "View";
|
"AvatarUpload.ViewAction" = "View";
|
||||||
|
|
||||||
|
"Notification.StarGift.TitleShort" = "Gift";
|
||||||
|
|
||||||
|
"Notification.StarsGift.SentSomeone" = "Someone sent you a gift";
|
||||||
|
|
||||||
|
"Notification.StarsGift.UpgradeChannel" = "A gift was turned into a unique collectible";
|
||||||
|
@ -1086,7 +1086,9 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
|||||||
authorName = strings.Notification_StarsGift_UnknownUser
|
authorName = strings.Notification_StarsGift_UnknownUser
|
||||||
peerIds = []
|
peerIds = []
|
||||||
}
|
}
|
||||||
if message.id.peerId == accountPeerId {
|
if message.id.peerId.isTelegramNotifications && senderId == nil {
|
||||||
|
attributedString = NSAttributedString(string: strings.Notification_StarsGift_SentSomeone, font: titleFont, textColor: primaryTextColor)
|
||||||
|
} else if message.id.peerId == accountPeerId {
|
||||||
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Self_Bought(starsPrice)._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
|
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Self_Bought(starsPrice)._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
|
||||||
} else if message.author?.id == accountPeerId {
|
} else if message.author?.id == accountPeerId {
|
||||||
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_SentYou(starsPrice)._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
|
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_SentYou(starsPrice)._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
|
||||||
@ -1111,15 +1113,17 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
|||||||
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Sent(authorName, starsPrice)._tuple, body: bodyAttributes, argumentAttributes: attributes)
|
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Sent(authorName, starsPrice)._tuple, body: bodyAttributes, argumentAttributes: attributes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case let .starGiftUnique(gift, isUpgrade, _, _, _, _, _, _, _, _):
|
case let .starGiftUnique(gift, isUpgrade, _, _, _, _, _, _, senderId, _):
|
||||||
if case let .unique(gift) = gift {
|
if case let .unique(gift) = gift {
|
||||||
if !forAdditionalServiceMessage && !"".isEmpty {
|
if !forAdditionalServiceMessage && !"".isEmpty {
|
||||||
attributedString = NSAttributedString(string: "\(gift.title) #\(gift.number)", font: titleFont, textColor: primaryTextColor)
|
attributedString = NSAttributedString(string: "\(gift.title) #\(gift.number)", font: titleFont, textColor: primaryTextColor)
|
||||||
} else if let messagePeer = message.peers[message.id.peerId] {
|
} else if let messagePeer = message.peers[message.id.peerId] {
|
||||||
let peerName = EnginePeer(messagePeer).compactDisplayTitle
|
var peerName = EnginePeer(messagePeer).compactDisplayTitle
|
||||||
let peerIds: [(Int, EnginePeer.Id?)] = [(0, messagePeer.id)]
|
var peerIds: [(Int, EnginePeer.Id?)] = [(0, messagePeer.id)]
|
||||||
if isUpgrade {
|
if isUpgrade {
|
||||||
if message.id.peerId == accountPeerId {
|
if message.id.peerId.isTelegramNotifications {
|
||||||
|
attributedString = NSAttributedString(string: strings.Notification_StarsGift_UpgradeChannel, font: titleFont, textColor: primaryTextColor)
|
||||||
|
} else if message.id.peerId == accountPeerId {
|
||||||
attributedString = NSAttributedString(string: strings.Notification_StarsGift_UpgradeSelf, font: titleFont, textColor: primaryTextColor)
|
attributedString = NSAttributedString(string: strings.Notification_StarsGift_UpgradeSelf, font: titleFont, textColor: primaryTextColor)
|
||||||
} else if message.author?.id == accountPeerId {
|
} else if message.author?.id == accountPeerId {
|
||||||
let attributes = peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: peerIds)
|
let attributes = peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: peerIds)
|
||||||
@ -1129,8 +1133,15 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
|||||||
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Upgrade(peerName)._tuple, body: bodyAttributes, argumentAttributes: attributes)
|
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Upgrade(peerName)._tuple, body: bodyAttributes, argumentAttributes: attributes)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if message.author?.id == accountPeerId {
|
if message.id.peerId.isTelegramNotifications && senderId == nil {
|
||||||
|
attributedString = NSAttributedString(string: strings.Notification_StarsGift_SentSomeone, font: titleFont, textColor: primaryTextColor)
|
||||||
|
} else if message.author?.id == accountPeerId {
|
||||||
attributedString = NSAttributedString(string: strings.Notification_StarsGift_TransferYou, font: titleFont, textColor: primaryTextColor)
|
attributedString = NSAttributedString(string: strings.Notification_StarsGift_TransferYou, font: titleFont, textColor: primaryTextColor)
|
||||||
|
} else if let senderId, let peer = message.peers[senderId] {
|
||||||
|
peerName = EnginePeer(peer).compactDisplayTitle
|
||||||
|
peerIds = [(0, senderId)]
|
||||||
|
let attributes = peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: peerIds)
|
||||||
|
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Transfer(peerName)._tuple, body: bodyAttributes, argumentAttributes: attributes)
|
||||||
} else {
|
} else {
|
||||||
let attributes = peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: peerIds)
|
let attributes = peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: peerIds)
|
||||||
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Transfer(peerName)._tuple, body: bodyAttributes, argumentAttributes: attributes)
|
attributedString = addAttributesToStringWithRanges(strings.Notification_StarsGift_Transfer(peerName)._tuple, body: bodyAttributes, argumentAttributes: attributes)
|
||||||
|
@ -359,6 +359,7 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, isSecondary: Bool, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics, force: Bool) -> CGFloat {
|
private func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, isSecondary: Bool, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics, force: Bool) -> CGFloat {
|
||||||
|
let isFirstTime = self.layoutData == nil
|
||||||
self.layoutData = (width, leftInset, rightInset, bottomInset, additionalSideInsets, maxHeight, isSecondary, metrics)
|
self.layoutData = (width, leftInset, rightInset, bottomInset, additionalSideInsets, maxHeight, isSecondary, metrics)
|
||||||
|
|
||||||
if self.presentationInterfaceState != interfaceState || force {
|
if self.presentationInterfaceState != interfaceState || force {
|
||||||
@ -416,6 +417,11 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
|
|||||||
|
|
||||||
if let peer = interfaceState.renderedPeer?.peer as? TelegramChannel {
|
if let peer = interfaceState.renderedPeer?.peer as? TelegramChannel {
|
||||||
if case .broadcast = peer.info, interfaceState.starGiftsAvailable {
|
if case .broadcast = peer.info, interfaceState.starGiftsAvailable {
|
||||||
|
if self.giftButton.isHidden && !isFirstTime {
|
||||||
|
self.giftButton.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||||
|
self.giftButton.layer.animateScale(from: 0.01, to: 1.0, duration: 0.2)
|
||||||
|
}
|
||||||
|
|
||||||
self.giftButton.isHidden = false
|
self.giftButton.isHidden = false
|
||||||
self.helpButton.isHidden = true
|
self.helpButton.isHidden = true
|
||||||
|
|
||||||
|
@ -570,7 +570,11 @@ public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
} else {
|
} else {
|
||||||
authorName = item.message.author.flatMap { EnginePeer($0) }?.compactDisplayTitle ?? ""
|
authorName = item.message.author.flatMap { EnginePeer($0) }?.compactDisplayTitle ?? ""
|
||||||
}
|
}
|
||||||
|
if item.message.id.peerId.isTelegramNotifications {
|
||||||
|
title = item.presentationData.strings.Notification_StarGift_TitleShort
|
||||||
|
} else {
|
||||||
title = isStoryEntity ? uniqueGift.title : item.presentationData.strings.Notification_StarGift_Title(authorName).string
|
title = isStoryEntity ? uniqueGift.title : item.presentationData.strings.Notification_StarGift_Title(authorName).string
|
||||||
|
}
|
||||||
text = isStoryEntity ? "**Collectible #\(uniqueGift.number)**" : "**\(uniqueGift.title) #\(uniqueGift.number)**"
|
text = isStoryEntity ? "**Collectible #\(uniqueGift.number)**" : "**\(uniqueGift.title) #\(uniqueGift.number)**"
|
||||||
ribbonTitle = isStoryEntity ? "" : item.presentationData.strings.Notification_StarGift_Gift
|
ribbonTitle = isStoryEntity ? "" : item.presentationData.strings.Notification_StarGift_Gift
|
||||||
buttonTitle = isStoryEntity ? "" : item.presentationData.strings.Notification_StarGift_View
|
buttonTitle = isStoryEntity ? "" : item.presentationData.strings.Notification_StarGift_View
|
||||||
|
Loading…
x
Reference in New Issue
Block a user