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
a4df0ea488
commit
060c2e9c37
@ -13024,8 +13024,8 @@ Sorry for the inconvenience.";
|
|||||||
"Gift.Options.Gift.Text" = "Give **%@** gifts that can be kept on the profile or converted to Stars. [What are Stars >]()";
|
"Gift.Options.Gift.Text" = "Give **%@** gifts that can be kept on the profile or converted to Stars. [What are Stars >]()";
|
||||||
"Gift.Options.Gift.Filter.AllGifts" = "All Gifts";
|
"Gift.Options.Gift.Filter.AllGifts" = "All Gifts";
|
||||||
"Gift.Options.Gift.Filter.Limited" = "Limited";
|
"Gift.Options.Gift.Filter.Limited" = "Limited";
|
||||||
"Gift.Options.Gift.Limited" = "Limited";
|
"Gift.Options.Gift.Limited" = "limited";
|
||||||
"Gift.Options.Gift.SoldOut" = "Sold Out";
|
"Gift.Options.Gift.SoldOut" = "sold out";
|
||||||
"Gift.Options.SoldOut.Text" = "Sorry, this gift is sold out.";
|
"Gift.Options.SoldOut.Text" = "Sorry, this gift is sold out.";
|
||||||
|
|
||||||
"PeerInfo.PaneGifts" = "Gifts";
|
"PeerInfo.PaneGifts" = "Gifts";
|
||||||
@ -13102,3 +13102,5 @@ Sorry for the inconvenience.";
|
|||||||
"Chat.PrivateMessageEditTimestamp.Date" = "edited %@";
|
"Chat.PrivateMessageEditTimestamp.Date" = "edited %@";
|
||||||
"Chat.PrivateMessageEditTimestamp.TodayAt" = "edited today at %@";
|
"Chat.PrivateMessageEditTimestamp.TodayAt" = "edited today at %@";
|
||||||
"Chat.PrivateMessageEditTimestamp.YesterdayAt" = "edited yesterday at %@";
|
"Chat.PrivateMessageEditTimestamp.YesterdayAt" = "edited yesterday at %@";
|
||||||
|
|
||||||
|
"Stars.Transaction.Gift.Title" = "Gift";
|
||||||
|
@ -104,6 +104,7 @@ final class BrowserInstantPageContent: UIView, BrowserContent, UIScrollViewDeleg
|
|||||||
self.preloadedResouces = preloadedResouces
|
self.preloadedResouces = preloadedResouces
|
||||||
self.originalContent = originalContent
|
self.originalContent = originalContent
|
||||||
self.url = url
|
self.url = url
|
||||||
|
self.initialAnchor = anchor
|
||||||
|
|
||||||
self.uuid = UUID()
|
self.uuid = UUID()
|
||||||
|
|
||||||
@ -268,10 +269,11 @@ final class BrowserInstantPageContent: UIView, BrowserContent, UIScrollViewDeleg
|
|||||||
private func updateWebPage(_ webPage: TelegramMediaWebpage?, anchor: String?, state: InstantPageStoredState? = nil) {
|
private func updateWebPage(_ webPage: TelegramMediaWebpage?, anchor: String?, state: InstantPageStoredState? = nil) {
|
||||||
if self.webPage != webPage {
|
if self.webPage != webPage {
|
||||||
if self.webPage != nil && self.currentLayout != nil {
|
if self.webPage != nil && self.currentLayout != nil {
|
||||||
if let snaphotView = self.scrollNode.view.snapshotView(afterScreenUpdates: false) {
|
if let snapshotView = self.scrollNode.view.snapshotView(afterScreenUpdates: false) {
|
||||||
self.scrollNode.view.superview?.insertSubview(snaphotView, aboveSubview: self.scrollNode.view)
|
snapshotView.frame = self.scrollNode.frame
|
||||||
snaphotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak snaphotView] _ in
|
self.scrollNode.view.superview?.insertSubview(snapshotView, aboveSubview: self.scrollNode.view)
|
||||||
snaphotView?.removeFromSuperview()
|
snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak snapshotView] _ in
|
||||||
|
snapshotView?.removeFromSuperview()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,7 +405,7 @@ final class BrowserInstantPageContent: UIView, BrowserContent, UIScrollViewDeleg
|
|||||||
|
|
||||||
var scrollInsets = insets
|
var scrollInsets = insets
|
||||||
scrollInsets.top = 0.0
|
scrollInsets.top = 0.0
|
||||||
if self.scrollNode.view.contentInset != insets {
|
if self.scrollNode.view.contentInset != scrollInsets {
|
||||||
self.scrollNode.view.contentInset = scrollInsets
|
self.scrollNode.view.contentInset = scrollInsets
|
||||||
self.scrollNode.view.scrollIndicatorInsets = scrollInsets
|
self.scrollNode.view.scrollIndicatorInsets = scrollInsets
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ private func peerMentionsAttributes(primaryTextColor: UIColor, peerIds: [(Int, E
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
public func plainServiceMessageString(strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, message: EngineMessage, accountPeerId: EnginePeer.Id, forChatList: Bool, forForumOverview: Bool) -> (text: String, spoilerRanges: [NSRange], customEmojiRanges: [(NSRange, ChatTextInputTextCustomEmojiAttribute)])? {
|
public func plainServiceMessageString(strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, message: EngineMessage, accountPeerId: EnginePeer.Id, forChatList: Bool, forForumOverview: Bool, forAdditionalServiceMessage: Bool = false) -> (text: String, spoilerRanges: [NSRange], customEmojiRanges: [(NSRange, ChatTextInputTextCustomEmojiAttribute)])? {
|
||||||
if let attributedString = universalServiceMessageString(presentationData: nil, strings: strings, nameDisplayOrder: nameDisplayOrder, dateTimeFormat: dateTimeFormat, message: message, accountPeerId: accountPeerId, forChatList: forChatList, forForumOverview: forForumOverview) {
|
if let attributedString = universalServiceMessageString(presentationData: nil, strings: strings, nameDisplayOrder: nameDisplayOrder, dateTimeFormat: dateTimeFormat, message: message, accountPeerId: accountPeerId, forChatList: forChatList, forForumOverview: forForumOverview, forAdditionalServiceMessage: forAdditionalServiceMessage) {
|
||||||
var ranges: [NSRange] = []
|
var ranges: [NSRange] = []
|
||||||
var customEmojiRanges: [(NSRange, ChatTextInputTextCustomEmojiAttribute)] = []
|
var customEmojiRanges: [(NSRange, ChatTextInputTextCustomEmojiAttribute)] = []
|
||||||
attributedString.enumerateAttributes(in: NSRange(location: 0, length: attributedString.length), options: [], using: { attributes, range, _ in
|
attributedString.enumerateAttributes(in: NSRange(location: 0, length: attributedString.length), options: [], using: { attributes, range, _ in
|
||||||
@ -79,7 +79,7 @@ private func peerDisplayTitles(_ peers: [Peer], strings: PresentationStrings, na
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func universalServiceMessageString(presentationData: (PresentationTheme, TelegramWallpaper)?, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, message: EngineMessage, accountPeerId: EnginePeer.Id, forChatList: Bool, forForumOverview: Bool) -> NSAttributedString? {
|
public func universalServiceMessageString(presentationData: (PresentationTheme, TelegramWallpaper)?, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, message: EngineMessage, accountPeerId: EnginePeer.Id, forChatList: Bool, forForumOverview: Bool, forAdditionalServiceMessage: Bool = false) -> NSAttributedString? {
|
||||||
var attributedString: NSAttributedString?
|
var attributedString: NSAttributedString?
|
||||||
|
|
||||||
let primaryTextColor: UIColor
|
let primaryTextColor: UIColor
|
||||||
@ -952,8 +952,11 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
|||||||
let resultTitleString = strings.Notification_ChangedToSameWallpaper(compactAuthorName)
|
let resultTitleString = strings.Notification_ChangedToSameWallpaper(compactAuthorName)
|
||||||
attributedString = addAttributesToStringWithRanges(resultTitleString._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
|
attributedString = addAttributesToStringWithRanges(resultTitleString._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
|
||||||
}
|
}
|
||||||
case let .giftCode(_, _, _, boostPeerId, _, currency, amount, _, _, _, _):
|
case let .giftCode(_, _, _, boostPeerId, _, currency, amount, _, _, text, entities):
|
||||||
if boostPeerId == nil, let currency, let amount {
|
if !forAdditionalServiceMessage, let text {
|
||||||
|
let mutableAttributedString = NSMutableAttributedString(attributedString: stringWithAppliedEntities(text, entities: entities ?? [], baseColor: primaryTextColor, linkColor: primaryTextColor, baseFont: titleFont, linkFont: titleBoldFont, boldFont: titleBoldFont, italicFont: titleFont, boldItalicFont: titleBoldFont, fixedFont: titleFont, blockQuoteFont: titleFont, underlineLinks: false, message: message._asMessage()))
|
||||||
|
attributedString = mutableAttributedString
|
||||||
|
} else if boostPeerId == nil, let currency, let amount {
|
||||||
let price = formatCurrencyAmount(amount, currency: currency)
|
let price = formatCurrencyAmount(amount, currency: currency)
|
||||||
if message.author?.id == accountPeerId {
|
if message.author?.id == accountPeerId {
|
||||||
attributedString = addAttributesToStringWithRanges(strings.Notification_PremiumGift_SentYou(price)._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
|
attributedString = addAttributesToStringWithRanges(strings.Notification_PremiumGift_SentYou(price)._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
|
||||||
@ -1051,13 +1054,11 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
|||||||
attributedString = mutableString
|
attributedString = mutableString
|
||||||
case .prizeStars:
|
case .prizeStars:
|
||||||
attributedString = NSAttributedString(string: strings.Notification_StarsPrize, font: titleFont, textColor: primaryTextColor)
|
attributedString = NSAttributedString(string: strings.Notification_StarsPrize, font: titleFont, textColor: primaryTextColor)
|
||||||
case let .starGift(gift, _, nameHidden, limitNumber, limitTotal, text, entities):
|
case let .starGift(gift, _, text, entities, _, _, _):
|
||||||
let _ = nameHidden
|
if !forAdditionalServiceMessage, let text {
|
||||||
let _ = limitNumber
|
let mutableAttributedString = NSMutableAttributedString(attributedString: stringWithAppliedEntities(text, entities: entities ?? [], baseColor: primaryTextColor, linkColor: primaryTextColor, baseFont: titleFont, linkFont: titleBoldFont, boldFont: titleBoldFont, italicFont: titleFont, boldItalicFont: titleBoldFont, fixedFont: titleFont, blockQuoteFont: titleFont, underlineLinks: false, message: message._asMessage()))
|
||||||
let _ = limitTotal
|
attributedString = mutableAttributedString
|
||||||
let _ = text
|
} else {
|
||||||
let _ = entities
|
|
||||||
|
|
||||||
let starsPrice = strings.Notification_StarsGift_Stars(Int32(gift.price))
|
let starsPrice = strings.Notification_StarsGift_Stars(Int32(gift.price))
|
||||||
var authorName = compactAuthorName
|
var authorName = compactAuthorName
|
||||||
var peerIds: [(Int, EnginePeer.Id?)] = [(0, message.author?.id)]
|
var peerIds: [(Int, EnginePeer.Id?)] = [(0, message.author?.id)]
|
||||||
@ -1072,6 +1073,7 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
|||||||
attributes[1] = boldAttributes
|
attributes[1] = boldAttributes
|
||||||
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 .unknown:
|
case .unknown:
|
||||||
attributedString = nil
|
attributedString = nil
|
||||||
}
|
}
|
||||||
|
@ -5003,14 +5003,25 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
return nil
|
return nil
|
||||||
case .longTap, .doubleTap, .secondaryTap:
|
case .longTap, .doubleTap, .secondaryTap:
|
||||||
if let item = self.item, self.backgroundNode.frame.contains(location) {
|
if let item = self.item, self.backgroundNode.frame.contains(location) {
|
||||||
// let message = item.message
|
|
||||||
|
|
||||||
if let threadInfoNode = self.threadInfoNode, self.item?.controllerInteraction.tapMessage == nil, threadInfoNode.frame.contains(location) {
|
if let threadInfoNode = self.threadInfoNode, self.item?.controllerInteraction.tapMessage == nil, threadInfoNode.frame.contains(location) {
|
||||||
return .action(InternalBubbleTapAction.Action {})
|
return .action(InternalBubbleTapAction.Action {})
|
||||||
}
|
}
|
||||||
if let replyInfoNode = self.replyInfoNode, self.item?.controllerInteraction.tapMessage == nil, replyInfoNode.frame.contains(location) {
|
if let replyInfoNode = self.replyInfoNode, self.item?.controllerInteraction.tapMessage == nil, replyInfoNode.frame.contains(location) {
|
||||||
|
if self.selectionNode != nil, let attribute = item.message.attributes.first(where: { $0 is ReplyMessageAttribute }) as? ReplyMessageAttribute {
|
||||||
|
return .action(InternalBubbleTapAction.Action({ [weak self] in
|
||||||
|
guard let self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var progress: Promise<Bool>?
|
||||||
|
if let replyInfoNode = self.replyInfoNode {
|
||||||
|
progress = replyInfoNode.makeProgress()
|
||||||
|
}
|
||||||
|
item.controllerInteraction.navigateToMessage(item.message.id, attribute.messageId, NavigateToMessageParams(timestamp: nil, quote: attribute.isQuote ? attribute.quote.flatMap { quote in NavigateToMessageParams.Quote(string: quote.text, offset: quote.offset) } : nil, progress: progress))
|
||||||
|
}, contextMenuOnLongPress: true))
|
||||||
|
} else {
|
||||||
return .openContextMenu(InternalBubbleTapAction.OpenContextMenu(tapMessage: item.content.firstMessage, selectAll: false, subFrame: self.backgroundNode.frame, disableDefaultPressAnimation: true))
|
return .openContextMenu(InternalBubbleTapAction.OpenContextMenu(tapMessage: item.content.firstMessage, selectAll: false, subFrame: self.backgroundNode.frame, disableDefaultPressAnimation: true))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var tapMessage: Message? = item.content.firstMessage
|
var tapMessage: Message? = item.content.firstMessage
|
||||||
var selectAll = true
|
var selectAll = true
|
||||||
@ -5243,6 +5254,10 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let selectionNode = self.selectionNode {
|
if let selectionNode = self.selectionNode {
|
||||||
|
// if let replyInfoNode = self.replyInfoNode, replyInfoNode.frame.contains(point) {
|
||||||
|
// return replyInfoNode.view.hitTest(self.view.convert(point, to: replyInfoNode.view), with: event)
|
||||||
|
// }
|
||||||
|
|
||||||
if let result = self.traceSelectionNodes(parent: self, point: point.offsetBy(dx: -42.0, dy: 0.0)) {
|
if let result = self.traceSelectionNodes(parent: self, point: point.offsetBy(dx: -42.0, dy: 0.0)) {
|
||||||
return result.view
|
return result.view
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ import TextNodeWithEntities
|
|||||||
import InvisibleInkDustNode
|
import InvisibleInkDustNode
|
||||||
|
|
||||||
private func attributedServiceMessageString(theme: ChatPresentationThemeData, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, message: EngineMessage, accountPeerId: EnginePeer.Id) -> NSAttributedString? {
|
private func attributedServiceMessageString(theme: ChatPresentationThemeData, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, message: EngineMessage, accountPeerId: EnginePeer.Id) -> NSAttributedString? {
|
||||||
return universalServiceMessageString(presentationData: (theme.theme, theme.wallpaper), strings: strings, nameDisplayOrder: nameDisplayOrder, dateTimeFormat: dateTimeFormat, message: message, accountPeerId: accountPeerId, forChatList: false, forForumOverview: false)
|
return universalServiceMessageString(presentationData: (theme.theme, theme.wallpaper), strings: strings, nameDisplayOrder: nameDisplayOrder, dateTimeFormat: dateTimeFormat, message: message, accountPeerId: accountPeerId, forChatList: false, forForumOverview: false, forAdditionalServiceMessage: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
public class ChatMessageGiftBubbleContentNode: ChatMessageBubbleContentNode {
|
||||||
|
@ -326,7 +326,7 @@ private final class StarsTransactionSheetContent: CombinedComponent {
|
|||||||
}
|
}
|
||||||
case let .transaction(transaction, parentPeer):
|
case let .transaction(transaction, parentPeer):
|
||||||
if let starGift = transaction.starGift {
|
if let starGift = transaction.starGift {
|
||||||
titleText = "Gift"
|
titleText = strings.Stars_Transaction_Gift_Title
|
||||||
descriptionText = ""
|
descriptionText = ""
|
||||||
count = transaction.count
|
count = transaction.count
|
||||||
transactionId = transaction.id
|
transactionId = transaction.id
|
||||||
|
@ -295,7 +295,9 @@ func openWebAppImpl(context: AccountContext, parentController: ViewController, u
|
|||||||
let _ = ApplicationSpecificNotice.setBotGameNotice(accountManager: context.sharedContext.accountManager, peerId: botPeer.id).startStandalone()
|
let _ = ApplicationSpecificNotice.setBotGameNotice(accountManager: context.sharedContext.accountManager, peerId: botPeer.id).startStandalone()
|
||||||
openWebView()
|
openWebView()
|
||||||
}, showMore: nil, openTerms: {
|
}, showMore: nil, openTerms: {
|
||||||
|
if let navigationController = parentController.navigationController as? NavigationController {
|
||||||
|
context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: presentationData.strings.WebApp_LaunchTermsConfirmation_URL, forceExternal: false, presentationData: presentationData, navigationController: navigationController, dismissInput: {})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
parentController.present(controller, in: .window(.root))
|
parentController.present(controller, in: .window(.root))
|
||||||
}
|
}
|
||||||
|
@ -2360,7 +2360,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
|
|
||||||
if let botPeer = botPeer {
|
if let botPeer = botPeer {
|
||||||
let _ = (ApplicationSpecificNotice.getBotGameNotice(accountManager: strongSelf.context.sharedContext.accountManager, peerId: botPeer.id)
|
let _ = (ApplicationSpecificNotice.getBotGameNotice(accountManager: strongSelf.context.sharedContext.accountManager, peerId: botPeer.id)
|
||||||
|> deliverOnMainQueue).startStandalone(next: { value in
|
|> deliverOnMainQueue).startStandalone(next: { [weak self] value in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2368,12 +2368,17 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
if value {
|
if value {
|
||||||
openBot()
|
openBot()
|
||||||
} else {
|
} else {
|
||||||
strongSelf.present(textAlertController(context: strongSelf.context, updatedPresentationData: strongSelf.updatedPresentationData, title: nil, text: strongSelf.presentationData.strings.Conversation_BotInteractiveUrlAlert(EnginePeer(botPeer).displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)).string, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: { }), TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {
|
let controller = webAppLaunchConfirmationController(context: strongSelf.context, updatedPresentationData: strongSelf.updatedPresentationData, peer: EnginePeer(botPeer), completion: { [weak self] _ in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let _ = ApplicationSpecificNotice.setBotGameNotice(accountManager: strongSelf.context.sharedContext.accountManager, peerId: botPeer.id).startStandalone()
|
let _ = ApplicationSpecificNotice.setBotGameNotice(accountManager: strongSelf.context.sharedContext.accountManager, peerId: botPeer.id).startStandalone()
|
||||||
openBot()
|
|
||||||
}
|
}
|
||||||
})]), in: .window(.root), with: nil)
|
openBot()
|
||||||
|
}, showMore: nil, openTerms: { [weak self] in
|
||||||
|
if let self, let navigationController = self.effectiveNavigationController {
|
||||||
|
context.sharedContext.openExternalUrl(context: context, urlContext: .generic, url: presentationData.strings.WebApp_LaunchTermsConfirmation_URL, forceExternal: false, presentationData: presentationData, navigationController: navigationController, dismissInput: {})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
strongSelf.present(controller, in: .window(.root))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import UIKit
|
|||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import Display
|
import Display
|
||||||
|
import ComponentFlow
|
||||||
import Postbox
|
import Postbox
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
import TelegramPresentationData
|
import TelegramPresentationData
|
||||||
@ -12,6 +13,7 @@ import AppBundle
|
|||||||
import AvatarNode
|
import AvatarNode
|
||||||
import CheckNode
|
import CheckNode
|
||||||
import Markdown
|
import Markdown
|
||||||
|
import EmojiStatusComponent
|
||||||
|
|
||||||
private let textFont = Font.regular(13.0)
|
private let textFont = Font.regular(13.0)
|
||||||
private let boldTextFont = Font.semibold(13.0)
|
private let boldTextFont = Font.semibold(13.0)
|
||||||
@ -21,6 +23,8 @@ private func formattedText(_ text: String, color: UIColor, linkColor: UIColor, t
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final class WebAppLaunchConfirmationAlertContentNode: AlertContentNode {
|
private final class WebAppLaunchConfirmationAlertContentNode: AlertContentNode {
|
||||||
|
private let context: AccountContext
|
||||||
|
private let presentationTheme: PresentationTheme
|
||||||
private let strings: PresentationStrings
|
private let strings: PresentationStrings
|
||||||
private let peer: EnginePeer
|
private let peer: EnginePeer
|
||||||
private let title: String
|
private let title: String
|
||||||
@ -28,6 +32,7 @@ private final class WebAppLaunchConfirmationAlertContentNode: AlertContentNode {
|
|||||||
private let showMore: Bool
|
private let showMore: Bool
|
||||||
|
|
||||||
private let titleNode: ImmediateTextNode
|
private let titleNode: ImmediateTextNode
|
||||||
|
private var titleCredibilityIconView: ComponentHostView<Empty>?
|
||||||
private let textNode: ASTextNode
|
private let textNode: ASTextNode
|
||||||
private let avatarNode: AvatarNode
|
private let avatarNode: AvatarNode
|
||||||
|
|
||||||
@ -57,7 +62,9 @@ private final class WebAppLaunchConfirmationAlertContentNode: AlertContentNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init(context: AccountContext, theme: AlertControllerTheme, ptheme: PresentationTheme, strings: PresentationStrings, peer: EnginePeer, title: String, text: String, showMore: Bool, requestWriteAccess: Bool, actions: [TextAlertAction], morePressed: @escaping () -> Void, termsPressed: @escaping () -> Void) {
|
init(context: AccountContext, theme: AlertControllerTheme, ptheme: PresentationTheme, strings: PresentationStrings, peer: EnginePeer, title: String, text: String, showMore: Bool, requestWriteAccess: Bool, actions: [TextAlertAction], morePressed: @escaping () -> Void, termsPressed: @escaping () -> Void) {
|
||||||
|
self.context = context
|
||||||
self.strings = strings
|
self.strings = strings
|
||||||
|
self.presentationTheme = ptheme
|
||||||
self.peer = peer
|
self.peer = peer
|
||||||
self.title = title
|
self.title = title
|
||||||
self.text = text
|
self.text = text
|
||||||
@ -209,7 +216,42 @@ private final class WebAppLaunchConfirmationAlertContentNode: AlertContentNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let titleSize = self.titleNode.updateLayout(CGSize(width: size.width - 32.0, height: size.height))
|
let titleSize = self.titleNode.updateLayout(CGSize(width: size.width - 32.0, height: size.height))
|
||||||
transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - titleSize.width) / 2.0), y: origin.y), size: titleSize))
|
var totalWidth = titleSize.width
|
||||||
|
|
||||||
|
if self.peer.isVerified {
|
||||||
|
let statusContent: EmojiStatusComponent.Content = .verified(fillColor: self.presentationTheme.list.itemCheckColors.fillColor, foregroundColor: self.presentationTheme.list.itemCheckColors.foregroundColor, sizeType: .large)
|
||||||
|
let titleCredibilityIconTransition: ComponentTransition = .immediate
|
||||||
|
|
||||||
|
let titleCredibilityIconView: ComponentHostView<Empty>
|
||||||
|
if let current = self.titleCredibilityIconView {
|
||||||
|
titleCredibilityIconView = current
|
||||||
|
} else {
|
||||||
|
titleCredibilityIconView = ComponentHostView<Empty>()
|
||||||
|
self.titleCredibilityIconView = titleCredibilityIconView
|
||||||
|
self.view.addSubview(titleCredibilityIconView)
|
||||||
|
}
|
||||||
|
|
||||||
|
let titleIconSize = titleCredibilityIconView.update(
|
||||||
|
transition: titleCredibilityIconTransition,
|
||||||
|
component: AnyComponent(EmojiStatusComponent(
|
||||||
|
context: self.context,
|
||||||
|
animationCache: self.context.animationCache,
|
||||||
|
animationRenderer: self.context.animationRenderer,
|
||||||
|
content: statusContent,
|
||||||
|
isVisibleForAnimations: true,
|
||||||
|
action: {
|
||||||
|
}
|
||||||
|
)),
|
||||||
|
environment: {},
|
||||||
|
containerSize: CGSize(width: 20.0, height: 20.0)
|
||||||
|
)
|
||||||
|
|
||||||
|
totalWidth += titleIconSize.width + 2.0
|
||||||
|
|
||||||
|
titleCredibilityIconTransition.setFrame(view: titleCredibilityIconView, frame: CGRect(origin: CGPoint(x:floorToScreenPixels((size.width - totalWidth) / 2.0) + titleSize.width + 2.0, y: origin.y), size: titleIconSize))
|
||||||
|
}
|
||||||
|
|
||||||
|
transition.updateFrame(node: self.titleNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - totalWidth) / 2.0), y: origin.y), size: titleSize))
|
||||||
origin.y += titleSize.height + 6.0
|
origin.y += titleSize.height + 6.0
|
||||||
|
|
||||||
var entriesHeight: CGFloat = 0.0
|
var entriesHeight: CGFloat = 0.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user