mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Merge commit 'e4a94cd32cfed887d1f17ca92a7eeebf5a0a7aae' into beta
This commit is contained in:
commit
75224f271d
@ -1054,13 +1054,15 @@ public class TextNode: ASDisplayNode {
|
||||
context.setShadow(offset: CGSize(width: 0.0, height: 1.0), blur: 0.0, color: textShadowColor.cgColor)
|
||||
}
|
||||
|
||||
// if let (textStrokeColor, textStrokeWidth) = layout.textStroke {
|
||||
// context.setBlendMode(.normal)
|
||||
// context.setLineCap(.round)
|
||||
// context.setLineJoin(.round)
|
||||
// context.setStrokeColor(textStrokeColor.cgColor)
|
||||
// context.setLineWidth(textStrokeWidth)
|
||||
// }
|
||||
if let (textStrokeColor, textStrokeWidth) = layout.textStroke {
|
||||
context.setBlendMode(.normal)
|
||||
context.setLineCap(.round)
|
||||
context.setLineJoin(.round)
|
||||
context.setStrokeColor(textStrokeColor.cgColor)
|
||||
context.setFillColor(textStrokeColor.cgColor)
|
||||
context.setLineWidth(textStrokeWidth)
|
||||
context.setTextDrawingMode(.fillStroke)
|
||||
}
|
||||
|
||||
let textMatrix = context.textMatrix
|
||||
let textPosition = context.textPosition
|
||||
|
@ -80,6 +80,7 @@ class LocationPinAnnotationView: MKAnnotationView {
|
||||
let smallIconNode: TransformImageNode
|
||||
let dotNode: ASImageNode
|
||||
var avatarNode: AvatarNode?
|
||||
var strokeLabelNode: ImmediateTextNode?
|
||||
var labelNode: ImmediateTextNode?
|
||||
|
||||
var appeared = false
|
||||
@ -236,14 +237,26 @@ class LocationPinAnnotationView: MKAnnotationView {
|
||||
self.dotNode.alpha = 1.0
|
||||
self.dotNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
|
||||
|
||||
if let annotation = self.annotation as? LocationPinAnnotation, let venue = annotation.location?.venue {
|
||||
var textColor = UIColor.black
|
||||
var strokeTextColor = UIColor.white
|
||||
if #available(iOS 13.0, *) {
|
||||
if self.traitCollection.userInterfaceStyle == .dark {
|
||||
textColor = .white
|
||||
strokeTextColor = .black
|
||||
}
|
||||
}
|
||||
let strokeLabelNode = ImmediateTextNode()
|
||||
strokeLabelNode.displaysAsynchronously = false
|
||||
strokeLabelNode.isUserInteractionEnabled = false
|
||||
strokeLabelNode.attributedText = NSAttributedString(string: venue.title, font: Font.medium(10), textColor: strokeTextColor)
|
||||
strokeLabelNode.maximumNumberOfLines = 2
|
||||
strokeLabelNode.textAlignment = .center
|
||||
strokeLabelNode.truncationType = .end
|
||||
strokeLabelNode.textStroke = (strokeTextColor, 2.0 - UIScreenPixel)
|
||||
self.strokeLabelNode = strokeLabelNode
|
||||
self.addSubnode(strokeLabelNode)
|
||||
|
||||
let labelNode = ImmediateTextNode()
|
||||
labelNode.displaysAsynchronously = false
|
||||
labelNode.isUserInteractionEnabled = false
|
||||
@ -251,7 +264,6 @@ class LocationPinAnnotationView: MKAnnotationView {
|
||||
labelNode.maximumNumberOfLines = 2
|
||||
labelNode.textAlignment = .center
|
||||
labelNode.truncationType = .end
|
||||
labelNode.textStroke = (UIColor.white, 1.0)
|
||||
self.labelNode = labelNode
|
||||
self.addSubnode(labelNode)
|
||||
|
||||
@ -260,8 +272,16 @@ class LocationPinAnnotationView: MKAnnotationView {
|
||||
labelNode.bounds = CGRect(origin: CGPoint(), size: size)
|
||||
labelNode.position = CGPoint(x: 0.0, y: 10.0 + floor(size.height / 2.0))
|
||||
|
||||
var strokeSize = strokeLabelNode.updateLayout(CGSize(width: 120.0, height: CGFloat.greatestFiniteMagnitude))
|
||||
strokeSize.height += 2.0
|
||||
strokeLabelNode.bounds = CGRect(origin: CGPoint(), size: strokeSize)
|
||||
strokeLabelNode.position = CGPoint(x: 0.0, y: 10.0 + floor(strokeSize.height / 2.0))
|
||||
|
||||
strokeLabelNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3)
|
||||
labelNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3)
|
||||
} else {
|
||||
self.strokeLabelNode?.removeFromSupernode()
|
||||
self.strokeLabelNode = nil
|
||||
self.labelNode?.removeFromSupernode()
|
||||
self.labelNode = nil
|
||||
}
|
||||
@ -313,6 +333,13 @@ class LocationPinAnnotationView: MKAnnotationView {
|
||||
labelNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { _ in
|
||||
labelNode.removeFromSupernode()
|
||||
})
|
||||
|
||||
if let strokeLabelNode = self.strokeLabelNode {
|
||||
self.strokeLabelNode = nil
|
||||
strokeLabelNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { _ in
|
||||
strokeLabelNode.removeFromSupernode()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -321,6 +348,13 @@ class LocationPinAnnotationView: MKAnnotationView {
|
||||
self.dotNode.alpha = selected ? 1.0 : 0.0
|
||||
self.smallNode.alpha = 1.0
|
||||
|
||||
if !selected {
|
||||
self.labelNode?.removeFromSupernode()
|
||||
self.labelNode = nil
|
||||
self.strokeLabelNode?.removeFromSupernode()
|
||||
self.strokeLabelNode = nil
|
||||
}
|
||||
|
||||
self.layoutSubviews()
|
||||
}
|
||||
}
|
||||
@ -346,13 +380,20 @@ class LocationPinAnnotationView: MKAnnotationView {
|
||||
|
||||
if let labelNode = self.labelNode {
|
||||
var textColor = UIColor.black
|
||||
var strokeTextColor = UIColor.white
|
||||
if #available(iOS 13.0, *) {
|
||||
if self.traitCollection.userInterfaceStyle == .dark {
|
||||
textColor = .white
|
||||
strokeTextColor = .black
|
||||
}
|
||||
}
|
||||
labelNode.attributedText = NSAttributedString(string: labelNode.attributedText?.string ?? "", font: Font.medium(10), textColor: textColor)
|
||||
let _ = labelNode.updateLayout(CGSize(width: 120.0, height: CGFloat.greatestFiniteMagnitude))
|
||||
|
||||
if let strokeLabelNode = self.strokeLabelNode {
|
||||
strokeLabelNode.attributedText = NSAttributedString(string: labelNode.attributedText?.string ?? "", font: Font.bold(10), textColor: strokeTextColor)
|
||||
let _ = strokeLabelNode.updateLayout(CGSize(width: 120.0, height: CGFloat.greatestFiniteMagnitude))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,11 @@ final class ThemeAccentColorController: ViewController {
|
||||
}
|
||||
}
|
||||
|
||||
self.navigationItem.titleView = self.segmentedTitleView
|
||||
if case let .builtin(theme) = themeReference, theme != .dayClassic {
|
||||
self.navigationItem.titleView = self.segmentedTitleView
|
||||
} else {
|
||||
self.title = self.presentationData.strings.Wallpaper_Title
|
||||
}
|
||||
self.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: UIView())
|
||||
}
|
||||
|
||||
|
@ -680,6 +680,8 @@ final class WallpaperColorPanelNode: ASDisplayNode {
|
||||
@objc private func addPressed() {
|
||||
self.colorSelected?()
|
||||
|
||||
self.firstColorFieldNode.setSkipEndEditingIfNeeded()
|
||||
|
||||
self.updateState({ current in
|
||||
var updated = current
|
||||
updated.selection = .second
|
||||
|
@ -311,7 +311,6 @@ public class WallpaperGalleryController: ViewController {
|
||||
self.displayNode = WallpaperGalleryControllerNode(controllerInteraction: controllerInteraction, pageGap: 0.0)
|
||||
self.displayNodeDidLoad()
|
||||
|
||||
self.galleryNode.statusBar = self.statusBar
|
||||
self.galleryNode.navigationBar = self.navigationBar
|
||||
self.galleryNode.dismiss = { [weak self] in
|
||||
self?.presentingViewController?.dismiss(animated: false, completion: nil)
|
||||
@ -608,8 +607,6 @@ public class WallpaperGalleryController: ViewController {
|
||||
currentWallpaper = wallpaper
|
||||
}
|
||||
|
||||
//let chatPresentationData = ChatPresentationData(theme: ChatPresentationThemeData(theme: self.presentationData.theme, wallpaper: currentWallpaper), fontSize: self.presentationData.fontSize, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameDisplayOrder: self.presentationData.nameDisplayOrder, disableAnimations: false, largeEmoji: false)
|
||||
|
||||
var topMessageText: String
|
||||
var bottomMessageText: String
|
||||
switch self.source {
|
||||
|
@ -240,7 +240,6 @@ final class WallpaperGalleryItemNode: GalleryItemNode {
|
||||
fetchSignal = .complete()
|
||||
statusSignal = .single(.Local)
|
||||
subtitleSignal = .single(nil)
|
||||
actionSignal = .single(defaultAction)
|
||||
colorSignal = chatServiceBackgroundColor(wallpaper: wallpaper, mediaBox: self.context.account.postbox.mediaBox)
|
||||
isBlurrable = false
|
||||
case let .file(file):
|
||||
|
@ -230,7 +230,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
||||
return
|
||||
}
|
||||
strongSelf.backgroundWallpaperNode.setMaskMode(strongSelf.backgroundMaskMode, mediaBox: item.context.account.postbox.mediaBox)
|
||||
strongSelf.backgroundNode.setMaskMode(isExtractedToContextPreview)
|
||||
strongSelf.backgroundNode.setMaskMode(strongSelf.backgroundMaskMode)
|
||||
if !isExtractedToContextPreview, let (rect, size) = strongSelf.absoluteRect {
|
||||
strongSelf.updateAbsoluteRect(rect, within: size)
|
||||
}
|
||||
@ -1640,7 +1640,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
||||
} else {
|
||||
backgroundType = .incoming(mergeType)
|
||||
}
|
||||
strongSelf.backgroundNode.setType(type: backgroundType, highlighted: strongSelf.highlightedState, graphics: graphics, maskMode: strongSelf.contextSourceNode.isExtractedToContextPreview, transition: transition)
|
||||
strongSelf.backgroundNode.setType(type: backgroundType, highlighted: strongSelf.highlightedState, graphics: graphics, maskMode: strongSelf.backgroundMaskMode, transition: transition)
|
||||
strongSelf.backgroundWallpaperNode.setType(type: backgroundType, theme: item.presentationData.theme, mediaBox: item.context.account.postbox.mediaBox, essentialGraphics: graphics, maskMode: strongSelf.backgroundMaskMode)
|
||||
|
||||
strongSelf.backgroundType = backgroundType
|
||||
@ -2862,6 +2862,8 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
|
||||
}
|
||||
|
||||
private var backgroundMaskMode: Bool {
|
||||
return self.contextSourceNode.isExtractedToContextPreview || (self.item?.presentationData.theme.wallpaper.hasWallpaper ?? false)
|
||||
let hasWallpaper = self.item?.presentationData.theme.wallpaper.hasWallpaper ?? false
|
||||
let isPreview = self.item?.presentationData.isPreview ?? false
|
||||
return self.contextSourceNode.isExtractedToContextPreview || hasWallpaper || isPreview
|
||||
}
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ public func gradientImage(_ colors: [UIColor]) -> Signal<(TransformImageArgument
|
||||
return .single({ arguments in
|
||||
let context = DrawingContext(size: arguments.drawingSize, clear: true)
|
||||
|
||||
context.withFlippedContext { c in
|
||||
context.withContext { c in
|
||||
let gradientColors = colors.map { $0.cgColor } as CFArray
|
||||
let delta: CGFloat = 1.0 / (CGFloat(colors.count) - 1.0)
|
||||
|
||||
@ -1001,25 +1001,32 @@ public func themeIconImage(account: Account, accountManager: AccountManager, the
|
||||
let backgroundColor: UIColor
|
||||
let incomingColor: UIColor
|
||||
let outgoingColor: (UIColor, UIColor)
|
||||
var accentColor = accentColor
|
||||
switch theme {
|
||||
case .dayClassic:
|
||||
backgroundColor = UIColor(rgb: 0xd6e2ee)
|
||||
incomingColor = UIColor(rgb: 0xffffff)
|
||||
outgoingColor = (UIColor(rgb: 0xe1ffc7), UIColor(rgb: 0xe1ffc7))
|
||||
case .day:
|
||||
backgroundColor = UIColor(rgb: 0xffffff)
|
||||
incomingColor = UIColor(rgb: 0xd5dde6)
|
||||
outgoingColor = bubbleColors ?? (UIColor(rgb: 0x007aff), UIColor(rgb: 0x007aff))
|
||||
case .night:
|
||||
backgroundColor = UIColor(rgb: 0x000000)
|
||||
incomingColor = UIColor(rgb: 0x1f1f1f)
|
||||
outgoingColor = bubbleColors ?? (UIColor(rgb: 0x313131), UIColor(rgb: 0x313131))
|
||||
case .nightAccent:
|
||||
let accentColor = accentColor ?? UIColor(rgb: 0x007aff)
|
||||
backgroundColor = accentColor.withMultiplied(hue: 1.024, saturation: 0.573, brightness: 0.18)
|
||||
incomingColor = accentColor.withMultiplied(hue: 1.024, saturation: 0.585, brightness: 0.25)
|
||||
let accentBubbleColor = accentColor.withMultiplied(hue: 1.019, saturation: 0.731, brightness: 0.59)
|
||||
outgoingColor = bubbleColors ?? (accentBubbleColor, accentBubbleColor)
|
||||
case .dayClassic:
|
||||
backgroundColor = UIColor(rgb: 0xd6e2ee)
|
||||
incomingColor = UIColor(rgb: 0xffffff)
|
||||
outgoingColor = (UIColor(rgb: 0xe1ffc7), UIColor(rgb: 0xe1ffc7))
|
||||
case .day:
|
||||
backgroundColor = UIColor(rgb: 0xffffff)
|
||||
incomingColor = UIColor(rgb: 0xd5dde6)
|
||||
if accentColor == nil {
|
||||
accentColor = UIColor(rgb: 0x007aff)
|
||||
}
|
||||
outgoingColor = bubbleColors ?? (accentColor!, accentColor!)
|
||||
case .night:
|
||||
backgroundColor = UIColor(rgb: 0x000000)
|
||||
incomingColor = UIColor(rgb: 0x1f1f1f)
|
||||
if accentColor == nil {
|
||||
accentColor = UIColor(rgb: 0x313131)
|
||||
}
|
||||
outgoingColor = bubbleColors ?? (accentColor!, accentColor!)
|
||||
case .nightAccent:
|
||||
let accentColor = accentColor ?? UIColor(rgb: 0x007aff)
|
||||
backgroundColor = accentColor.withMultiplied(hue: 1.024, saturation: 0.573, brightness: 0.18)
|
||||
incomingColor = accentColor.withMultiplied(hue: 1.024, saturation: 0.585, brightness: 0.25)
|
||||
let accentBubbleColor = accentColor.withMultiplied(hue: 1.019, saturation: 0.731, brightness: 0.59)
|
||||
outgoingColor = bubbleColors ?? (accentBubbleColor, accentBubbleColor)
|
||||
}
|
||||
colorsSignal = .single(((backgroundColor, nil), (incomingColor, incomingColor), outgoingColor, nil))
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user