mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-08 19:10:53 +00:00
Various fixes
This commit is contained in:
parent
a4a45806dc
commit
8a20ee072d
@ -353,7 +353,10 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
let textFixedFont = Font.regular(fontSize)
|
||||
let textBlockQuoteFont = Font.regular(fontSize)
|
||||
|
||||
let incoming = message.effectivelyIncoming(context.account.peerId)
|
||||
var incoming = message.effectivelyIncoming(context.account.peerId)
|
||||
if case .forwardedMessages = associatedData.subject {
|
||||
incoming = false
|
||||
}
|
||||
|
||||
var horizontalInsets = UIEdgeInsets(top: 0.0, left: 10.0, bottom: 0.0, right: 10.0)
|
||||
if displayLine {
|
||||
@ -517,7 +520,7 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
if !skipStandardStatus {
|
||||
if message.effectivelyIncoming(context.account.peerId) {
|
||||
if incoming {
|
||||
if isImage {
|
||||
imageStatusType = .ImageIncoming
|
||||
} else {
|
||||
@ -609,7 +612,7 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
let automaticDownload = shouldDownloadMediaAutomatically(settings: automaticDownloadSettings, peerType: associatedData.automaticDownloadPeerType, networkType: associatedData.automaticDownloadNetworkType, authorPeerId: message.author?.id, contactsPeerIds: associatedData.contactsPeerIds, media: file)
|
||||
|
||||
let statusType: ChatMessageDateAndStatusType
|
||||
if message.effectivelyIncoming(context.account.peerId) {
|
||||
if incoming {
|
||||
statusType = .BubbleIncoming
|
||||
} else {
|
||||
if message.flags.contains(.Failed) {
|
||||
@ -633,7 +636,7 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
forcedIsEdited: false,
|
||||
file: file,
|
||||
automaticDownload: automaticDownload,
|
||||
incoming: message.effectivelyIncoming(context.account.peerId),
|
||||
incoming: incoming,
|
||||
isRecentActions: false,
|
||||
forcedResourceStatus: associatedData.forcedResourceStatus,
|
||||
dateAndStatusType: statusType,
|
||||
|
@ -88,10 +88,15 @@ class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
var selectedContact: TelegramMediaContact?
|
||||
for media in item.message.media {
|
||||
if let media = media as? TelegramMediaContact {
|
||||
selectedContact = media
|
||||
selectedContact = media;
|
||||
}
|
||||
}
|
||||
|
||||
var incoming = item.message.effectivelyIncoming(item.context.account.peerId)
|
||||
if case .forwardedMessages = item.associatedData.subject {
|
||||
incoming = false
|
||||
}
|
||||
|
||||
var titleString: NSAttributedString?
|
||||
var textString: NSAttributedString?
|
||||
var updatedContactInfo: String?
|
||||
@ -149,8 +154,8 @@ class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
|
||||
updatedContactInfo = info
|
||||
|
||||
titleString = NSAttributedString(string: displayName, font: titleFont, textColor: item.message.effectivelyIncoming(item.context.account.peerId) ? item.presentationData.theme.theme.chat.message.incoming.accentTextColor : item.presentationData.theme.theme.chat.message.outgoing.accentTextColor)
|
||||
textString = NSAttributedString(string: info, font: textFont, textColor: item.message.effectivelyIncoming(item.context.account.peerId) ? item.presentationData.theme.theme.chat.message.incoming.primaryTextColor : item.presentationData.theme.theme.chat.message.outgoing.primaryTextColor)
|
||||
titleString = NSAttributedString(string: displayName, font: titleFont, textColor: incoming ? item.presentationData.theme.theme.chat.message.incoming.accentTextColor : item.presentationData.theme.theme.chat.message.outgoing.accentTextColor)
|
||||
textString = NSAttributedString(string: info, font: textFont, textColor: incoming ? item.presentationData.theme.theme.chat.message.incoming.primaryTextColor : item.presentationData.theme.theme.chat.message.outgoing.primaryTextColor)
|
||||
} else {
|
||||
updatedContactInfo = nil
|
||||
}
|
||||
@ -193,7 +198,7 @@ class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
let statusType: ChatMessageDateAndStatusType?
|
||||
switch position {
|
||||
case .linear(_, .None), .linear(_, .Neighbour(true, _, _)):
|
||||
if item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||
if incoming {
|
||||
statusType = .BubbleIncoming
|
||||
} else {
|
||||
if item.message.flags.contains(.Failed) {
|
||||
@ -242,7 +247,7 @@ class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
let titleColor: UIColor
|
||||
let titleHighlightedColor: UIColor
|
||||
let avatarPlaceholderColor: UIColor
|
||||
if item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||
if incoming {
|
||||
buttonImage = PresentationResourcesChat.chatMessageAttachedContentButtonIncoming(item.presentationData.theme.theme)!
|
||||
buttonHighlightedImage = PresentationResourcesChat.chatMessageAttachedContentHighlightedButtonIncoming(item.presentationData.theme.theme)!
|
||||
titleColor = item.presentationData.theme.theme.chat.message.incoming.accentTextColor
|
||||
|
@ -102,7 +102,10 @@ class ChatMessageFileBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
}
|
||||
}
|
||||
|
||||
let incoming = item.message.effectivelyIncoming(item.context.account.peerId)
|
||||
var incoming = item.message.effectivelyIncoming(item.context.account.peerId)
|
||||
if case .forwardedMessages = item.associatedData.subject {
|
||||
incoming = false
|
||||
}
|
||||
let statusType: ChatMessageDateAndStatusType?
|
||||
switch preparePosition {
|
||||
case .linear(_, .None), .linear(_, .Neighbour(true, _, _)):
|
||||
@ -135,7 +138,7 @@ class ChatMessageFileBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
forcedIsEdited: item.isItemEdited,
|
||||
file: selectedFile!,
|
||||
automaticDownload: automaticDownload,
|
||||
incoming: item.message.effectivelyIncoming(item.context.account.peerId),
|
||||
incoming: incoming,
|
||||
isRecentActions: item.associatedData.isRecentActions,
|
||||
forcedResourceStatus: item.associatedData.forcedResourceStatus,
|
||||
dateAndStatusType: statusType,
|
||||
|
@ -88,6 +88,11 @@ class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
}
|
||||
}
|
||||
|
||||
var incoming = item.message.effectivelyIncoming(item.context.account.peerId)
|
||||
if case .forwardedMessages = item.associatedData.subject {
|
||||
incoming = false
|
||||
}
|
||||
|
||||
let bubbleInsets: UIEdgeInsets
|
||||
if case .color = item.presentationData.theme.wallpaper {
|
||||
bubbleInsets = UIEdgeInsets()
|
||||
@ -106,12 +111,12 @@ class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
imageSize = CGSize(width: fitWidth, height: floor(fitWidth * 0.5))
|
||||
|
||||
if let venue = selectedMedia.venue {
|
||||
titleString = NSAttributedString(string: venue.title, font: titleFont, textColor: item.message.effectivelyIncoming(item.context.account.peerId) ? item.presentationData.theme.theme.chat.message.incoming.primaryTextColor : item.presentationData.theme.theme.chat.message.outgoing.primaryTextColor)
|
||||
titleString = NSAttributedString(string: venue.title, font: titleFont, textColor: incoming ? item.presentationData.theme.theme.chat.message.incoming.primaryTextColor : item.presentationData.theme.theme.chat.message.outgoing.primaryTextColor)
|
||||
if let address = venue.address, !address.isEmpty {
|
||||
textString = NSAttributedString(string: address, font: textFont, textColor: item.message.effectivelyIncoming(item.context.account.peerId) ? item.presentationData.theme.theme.chat.message.incoming.secondaryTextColor : item.presentationData.theme.theme.chat.message.outgoing.secondaryTextColor)
|
||||
textString = NSAttributedString(string: address, font: textFont, textColor: incoming ? item.presentationData.theme.theme.chat.message.incoming.secondaryTextColor : item.presentationData.theme.theme.chat.message.outgoing.secondaryTextColor)
|
||||
}
|
||||
} else {
|
||||
textString = NSAttributedString(string: " ", font: textFont, textColor: item.message.effectivelyIncoming(item.context.account.peerId) ? item.presentationData.theme.theme.chat.message.incoming.secondaryTextColor : item.presentationData.theme.theme.chat.message.outgoing.secondaryTextColor)
|
||||
textString = NSAttributedString(string: " ", font: textFont, textColor: incoming ? item.presentationData.theme.theme.chat.message.incoming.secondaryTextColor : item.presentationData.theme.theme.chat.message.outgoing.secondaryTextColor)
|
||||
}
|
||||
} else {
|
||||
let fitWidth: CGFloat = min(constrainedSize.width, layoutConstants.image.maxDimensions.width)
|
||||
@ -120,7 +125,7 @@ class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
}
|
||||
|
||||
if selectedMedia.liveBroadcastingTimeout != nil {
|
||||
titleString = NSAttributedString(string: item.presentationData.strings.Message_LiveLocation, font: liveTitleFont, textColor: item.message.effectivelyIncoming(item.context.account.peerId) ? item.presentationData.theme.theme.chat.message.incoming.primaryTextColor : item.presentationData.theme.theme.chat.message.outgoing.primaryTextColor)
|
||||
titleString = NSAttributedString(string: item.presentationData.strings.Message_LiveLocation, font: liveTitleFont, textColor: incoming ? item.presentationData.theme.theme.chat.message.incoming.primaryTextColor : item.presentationData.theme.theme.chat.message.outgoing.primaryTextColor)
|
||||
}
|
||||
} else {
|
||||
imageSize = CGSize(width: 75.0, height: 75.0)
|
||||
@ -211,7 +216,7 @@ class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
switch position {
|
||||
case .linear(_, .None), .linear(_, .Neighbour(true, _, _)):
|
||||
if selectedMedia?.venue != nil || activeLiveBroadcastingTimeout != nil {
|
||||
if item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||
if incoming {
|
||||
statusType = .BubbleIncoming
|
||||
} else {
|
||||
if item.message.flags.contains(.Failed) {
|
||||
@ -223,7 +228,7 @@ class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||
if incoming {
|
||||
statusType = .ImageIncoming
|
||||
} else {
|
||||
if item.message.flags.contains(.Failed) {
|
||||
@ -283,7 +288,7 @@ class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
}
|
||||
|
||||
return (contentWidth, { boundingWidth in
|
||||
let arguments = TransformImageArguments(corners: imageCorners, imageSize: imageSize, boundingSize: imageSize, intrinsicInsets: UIEdgeInsets(), emptyColor: item.message.effectivelyIncoming(item.context.account.peerId) ? item.presentationData.theme.theme.chat.message.incoming.mediaPlaceholderColor : item.presentationData.theme.theme.chat.message.outgoing.mediaPlaceholderColor)
|
||||
let arguments = TransformImageArguments(corners: imageCorners, imageSize: imageSize, boundingSize: imageSize, intrinsicInsets: UIEdgeInsets(), emptyColor: incoming ? item.presentationData.theme.theme.chat.message.incoming.mediaPlaceholderColor : item.presentationData.theme.theme.chat.message.outgoing.mediaPlaceholderColor)
|
||||
|
||||
let imageLayoutSize = CGSize(width: imageSize.width + bubbleInsets.left + bubbleInsets.right, height: imageSize.height + bubbleInsets.top + bubbleInsets.bottom)
|
||||
|
||||
@ -379,8 +384,8 @@ class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
let timerSize = CGSize(width: 28.0, height: 28.0)
|
||||
strongSelf.liveTimerNode?.frame = CGRect(origin: CGPoint(x: floor(imageFrame.maxX - 10.0 - timerSize.width), y: floor(imageFrame.maxY + 11.0)), size: timerSize)
|
||||
|
||||
let timerForegroundColor: UIColor = item.message.effectivelyIncoming(item.context.account.peerId) ? item.presentationData.theme.theme.chat.message.incoming.accentControlColor : item.presentationData.theme.theme.chat.message.outgoing.accentControlColor
|
||||
let timerTextColor: UIColor = item.message.effectivelyIncoming(item.context.account.peerId) ? item.presentationData.theme.theme.chat.message.incoming.secondaryTextColor : item.presentationData.theme.theme.chat.message.outgoing.secondaryTextColor
|
||||
let timerForegroundColor: UIColor = incoming ? item.presentationData.theme.theme.chat.message.incoming.accentControlColor : item.presentationData.theme.theme.chat.message.outgoing.accentControlColor
|
||||
let timerTextColor: UIColor = incoming ? item.presentationData.theme.theme.chat.message.incoming.secondaryTextColor : item.presentationData.theme.theme.chat.message.outgoing.secondaryTextColor
|
||||
strongSelf.liveTimerNode?.update(backgroundColor: timerForegroundColor.withAlphaComponent(0.4), foregroundColor: timerForegroundColor, textColor: timerTextColor, beginTimestamp: Double(item.message.timestamp), timeout: Double(activeLiveBroadcastingTimeout), strings: item.presentationData.strings)
|
||||
|
||||
if strongSelf.liveTextNode == nil {
|
||||
|
@ -962,7 +962,8 @@ public func resolveUrlImpl(context: AccountContext, peerId: PeerId?, url: String
|
||||
for scheme in schemes {
|
||||
let basePrefix = scheme + basePath + "/"
|
||||
var url = url
|
||||
if (url.lowercased().hasPrefix(scheme) && (url.lowercased().hasSuffix(".\(basePath)") || url.lowercased().contains(".\(basePath)/"))) {
|
||||
let lowercasedUrl = url.lowercased()
|
||||
if (lowercasedUrl.hasPrefix(scheme) && (lowercasedUrl.hasSuffix(".\(basePath)") || lowercasedUrl.contains(".\(basePath)/") || lowercasedUrl.contains(".\(basePath)?"))) {
|
||||
url = basePrefix + String(url[scheme.endIndex...]).replacingOccurrences(of: ".\(basePath)/", with: "").replacingOccurrences(of: ".\(basePath)", with: "")
|
||||
}
|
||||
if url.lowercased().hasPrefix(basePrefix) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user