diff --git a/submodules/TelegramPresentationData/Sources/ChatMessageBubbleImages.swift b/submodules/TelegramPresentationData/Sources/ChatMessageBubbleImages.swift new file mode 100644 index 0000000000..deb72cd8ab --- /dev/null +++ b/submodules/TelegramPresentationData/Sources/ChatMessageBubbleImages.swift @@ -0,0 +1,188 @@ +import Foundation +import UIKit +import Display + +public enum MessageBubbleImageNeighbors { + case none + case top(side: Bool) + case bottom + case both + case side +} + +public func messageSingleBubbleLikeImage(fillColor: UIColor, strokeColor: UIColor) -> UIImage { + let diameter: CGFloat = 36.0 + return generateImage(CGSize(width: 36.0, height: diameter), contextGenerator: { size, context in + context.clear(CGRect(origin: CGPoint(), size: size)) + + let lineWidth: CGFloat = 0.5 + + context.setFillColor(strokeColor.cgColor) + context.fillEllipse(in: CGRect(origin: CGPoint(), size: size)) + context.setFillColor(fillColor.cgColor) + context.fillEllipse(in: CGRect(origin: CGPoint(x: lineWidth, y: lineWidth), size: CGSize(width: size.width - lineWidth * 2.0, height: size.height - lineWidth * 2.0))) + })!.stretchableImage(withLeftCapWidth: Int(diameter / 2.0), topCapHeight: Int(diameter / 2.0)) +} + +public func messageBubbleImage(incoming: Bool, fillColor: UIColor, strokeColor: UIColor, neighbors: MessageBubbleImageNeighbors) -> UIImage { + let diameter: CGFloat = 36.0 + let corner: CGFloat = 7.0 + return generateImage(CGSize(width: 42.0, height: diameter), contextGenerator: { size, context in + context.clear(CGRect(origin: CGPoint(), size: size)) + + let additionalOffset: CGFloat + switch neighbors { + case .none, .bottom: + additionalOffset = 0.0 + case .both, .side, .top: + additionalOffset = 6.0 + } + + context.translateBy(x: size.width / 2.0, y: size.height / 2.0) + context.scaleBy(x: incoming ? 1.0 : -1.0, y: -1.0) + context.translateBy(x: -size.width / 2.0 + 0.5 + additionalOffset, y: -size.height / 2.0 + 0.5) + + let lineWidth: CGFloat = 1.0 + + context.setFillColor(fillColor.cgColor) + context.setLineWidth(lineWidth) + context.setStrokeColor(strokeColor.cgColor) + + switch neighbors { + case .none: + let _ = try? drawSvgPath(context, path: "M6,17.5 C6,7.83289181 13.8350169,0 23.5,0 C33.1671082,0 41,7.83501688 41,17.5 C41,27.1671082 33.1649831,35 23.5,35 C19.2941198,35 15.4354328,33.5169337 12.4179496,31.0453367 C9.05531719,34.9894816 -2.41102995e-08,35 0,35 C5.972003,31.5499861 6,26.8616169 6,26.8616169 L6,17.5 L6,17.5 ") + context.strokePath() + let _ = try? drawSvgPath(context, path: "M6,17.5 C6,7.83289181 13.8350169,0 23.5,0 C33.1671082,0 41,7.83501688 41,17.5 C41,27.1671082 33.1649831,35 23.5,35 C19.2941198,35 15.4354328,33.5169337 12.4179496,31.0453367 C9.05531719,34.9894816 -2.41102995e-08,35 0,35 C5.972003,31.5499861 6,26.8616169 6,26.8616169 L6,17.5 L6,17.5 ") + context.fillPath() + case .side: + context.strokeEllipse(in: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: 35.0, height: 35.0))) + context.strokePath() + context.fillEllipse(in: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: 35.0, height: 35.0))) + case let .top(side): + if side { + let _ = try? drawSvgPath(context, path: "M17.5,0 L17.5,0 C27.1649831,-1.7754286e-15 35,7.83501688 35,17.5 L35,29 C35,32.3137085 32.3137085,35 29,35 L6,35 C2.6862915,35 4.05812251e-16,32.3137085 0,29 L0,17.5 C-1.18361906e-15,7.83501688 7.83501688,1.7754286e-15 17.5,0 ") + context.strokePath() + let _ = try? drawSvgPath(context, path: "M17.5,0 L17.5,0 C27.1649831,-1.7754286e-15 35,7.83501688 35,17.5 L35,29 C35,32.3137085 32.3137085,35 29,35 L6,35 C2.6862915,35 4.05812251e-16,32.3137085 0,29 L0,17.5 C-1.18361906e-15,7.83501688 7.83501688,1.7754286e-15 17.5,0 ") + context.fillPath() + } else { + let _ = try? drawSvgPath(context, path: "M35,17.5 C35,7.83501688 27.1671082,0 17.5,0 L17.5,0 C7.83501688,0 0,7.83289181 0,17.5 L0,29.0031815 C0,32.3151329 2.6882755,35 5.99681848,35 L17.5,35 C27.1649831,35 35,27.1671082 35,17.5 L35,17.5 L35,17.5 ") + context.strokePath() + let _ = try? drawSvgPath(context, path: "M35,17.5 C35,7.83501688 27.1671082,0 17.5,0 L17.5,0 C7.83501688,0 0,7.83289181 0,17.5 L0,29.0031815 C0,32.3151329 2.6882755,35 5.99681848,35 L17.5,35 C27.1649831,35 35,27.1671082 35,17.5 L35,17.5 L35,17.5 ") + context.fillPath() + } + case .bottom: + let _ = try? drawSvgPath(context, path: "M6,17.5 L6,5.99681848 C6,2.6882755 8.68486709,0 11.9968185,0 L23.5,0 C33.1671082,0 41,7.83501688 41,17.5 C41,27.1671082 33.1649831,35 23.5,35 C19.2941198,35 15.4354328,33.5169337 12.4179496,31.0453367 C9.05531719,34.9894816 -2.41103066e-08,35 0,35 C5.972003,31.5499861 6,26.8616169 6,26.8616169 L6,17.5 L6,17.5 ") + context.strokePath() + let _ = try? drawSvgPath(context, path: "M6,17.5 L6,5.99681848 C6,2.6882755 8.68486709,0 11.9968185,0 L23.5,0 C33.1671082,0 41,7.83501688 41,17.5 C41,27.1671082 33.1649831,35 23.5,35 C19.2941198,35 15.4354328,33.5169337 12.4179496,31.0453367 C9.05531719,34.9894816 -2.41103066e-08,35 0,35 C5.972003,31.5499861 6,26.8616169 6,26.8616169 L6,17.5 L6,17.5 ") + context.fillPath() + case .both: + let _ = try? drawSvgPath(context, path: "M35,17.5 C35,7.83501688 27.1671082,0 17.5,0 L5.99681848,0 C2.68486709,0 0,2.6882755 0,5.99681848 L0,29.0031815 C0,32.3151329 2.6882755,35 5.99681848,35 L17.5,35 C27.1649831,35 35,27.1671082 35,17.5 L35,17.5 L35,17.5 ") + context.strokePath() + let _ = try? drawSvgPath(context, path: "M35,17.5 C35,7.83501688 27.1671082,0 17.5,0 L5.99681848,0 C2.68486709,0 0,2.6882755 0,5.99681848 L0,29.0031815 C0,32.3151329 2.6882755,35 5.99681848,35 L17.5,35 C27.1649831,35 35,27.1671082 35,17.5 L35,17.5 L35,17.5 ") + context.fillPath() + } + })!.stretchableImage(withLeftCapWidth: incoming ? Int(corner + diameter / 2.0) : Int(diameter / 2.0), topCapHeight: Int(diameter / 2.0)) +} + +public enum MessageBubbleActionButtonPosition { + case middle + case bottomLeft + case bottomRight + case bottomSingle +} + +public func messageBubbleActionButtonImage(color: UIColor, strokeColor: UIColor, position: MessageBubbleActionButtonPosition) -> UIImage { + let largeRadius: CGFloat = 17.0 + let smallRadius: CGFloat = 6.0 + let size: CGSize + if case .middle = position { + size = CGSize(width: smallRadius + smallRadius, height: smallRadius + smallRadius) + } else { + size = CGSize(width: 35.0, height: 35.0) + } + return generateImage(size, contextGenerator: { size, context in + context.clear(CGRect(origin: CGPoint(), size: size)) + context.translateBy(x: size.width / 2.0, y: size.height / 2.0) + if case .bottomRight = position { + context.scaleBy(x: -1.0, y: -1.0) + } else { + context.scaleBy(x: 1.0, y: -1.0) + } + context.translateBy(x: -size.width / 2.0, y: -size.height / 2.0) + context.setBlendMode(.copy) + var effectiveStrokeColor: UIColor? + var strokeAlpha: CGFloat = 0.0 + strokeColor.getRed(nil, green: nil, blue: nil, alpha: &strokeAlpha) + if !strokeAlpha.isZero { + effectiveStrokeColor = strokeColor + } + context.setFillColor(color.cgColor) + let lineWidth: CGFloat = 1.0 + let halfLineWidth = lineWidth / 2.0 + if let effectiveStrokeColor = effectiveStrokeColor { + context.setStrokeColor(effectiveStrokeColor.cgColor) + context.setLineWidth(lineWidth) + } + switch position { + case .middle: + context.fillEllipse(in: CGRect(origin: CGPoint(), size: size)) + if effectiveStrokeColor != nil { + context.setBlendMode(.normal) + context.strokeEllipse(in: CGRect(origin: CGPoint(x: halfLineWidth, y: halfLineWidth), size: CGSize(width: size.width - lineWidth, height: size.height - lineWidth))) + context.setBlendMode(.copy) + } + case .bottomLeft, .bottomRight: + context.fillEllipse(in: CGRect(origin: CGPoint(), size: size)) + context.fillEllipse(in: CGRect(origin: CGPoint(), size: CGSize(width: smallRadius + smallRadius, height: smallRadius + smallRadius))) + context.fillEllipse(in: CGRect(origin: CGPoint(x: size.width - smallRadius - smallRadius, y: 0.0), size: CGSize(width: smallRadius + smallRadius, height: smallRadius + smallRadius))) + context.fill(CGRect(origin: CGPoint(x: smallRadius, y: 0.0), size: CGSize(width: size.width - smallRadius - smallRadius, height: smallRadius + smallRadius))) + context.fillEllipse(in: CGRect(origin: CGPoint(), size: size)) + context.fillEllipse(in: CGRect(origin: CGPoint(), size: CGSize(width: smallRadius + smallRadius, height: smallRadius + smallRadius))) + context.fillEllipse(in: CGRect(origin: CGPoint(x: size.width - smallRadius - smallRadius, y: 0.0), size: CGSize(width: smallRadius + smallRadius, height: smallRadius + smallRadius))) + context.fill(CGRect(origin: CGPoint(x: smallRadius, y: 0.0), size: CGSize(width: size.width - smallRadius - smallRadius, height: smallRadius + smallRadius))) + context.fill(CGRect(origin: CGPoint(x: 0.0, y: smallRadius), size: CGSize(width: size.width, height: size.height - largeRadius - smallRadius))) + context.fillEllipse(in: CGRect(origin: CGPoint(x: size.width - smallRadius - smallRadius, y: size.height - smallRadius - smallRadius), size: CGSize(width: smallRadius + smallRadius, height: smallRadius + smallRadius))) + context.fill(CGRect(origin: CGPoint(x: largeRadius, y: size.height - largeRadius - largeRadius), size: CGSize(width: size.width - smallRadius - largeRadius, height: largeRadius + largeRadius))) + context.fill(CGRect(origin: CGPoint(x: size.width - smallRadius, y: size.height - largeRadius), size: CGSize(width: smallRadius, height: largeRadius - smallRadius))) + if effectiveStrokeColor != nil { + context.setBlendMode(.normal) + context.beginPath() + context.move(to: CGPoint(x: halfLineWidth, y: smallRadius + halfLineWidth)) + context.addArc(tangent1End: CGPoint(x: halfLineWidth, y: halfLineWidth), tangent2End: CGPoint(x: halfLineWidth + smallRadius, y: halfLineWidth), radius: smallRadius) + context.addLine(to: CGPoint(x: size.width - smallRadius, y: halfLineWidth)) + context.addArc(tangent1End: CGPoint(x: size.width - halfLineWidth, y: halfLineWidth), tangent2End: CGPoint(x: size.width - halfLineWidth, y: halfLineWidth + smallRadius), radius: smallRadius) + context.addLine(to: CGPoint(x: size.width - halfLineWidth, y: size.height - halfLineWidth - smallRadius)) + context.addArc(tangent1End: CGPoint(x: size.width - halfLineWidth, y: size.height - halfLineWidth), tangent2End: CGPoint(x: size.width - halfLineWidth - smallRadius, y: size.height - halfLineWidth), radius: smallRadius) + context.addLine(to: CGPoint(x: halfLineWidth + largeRadius, y: size.height - halfLineWidth)) + context.addArc(tangent1End: CGPoint(x: halfLineWidth, y: size.height - halfLineWidth), tangent2End: CGPoint(x: halfLineWidth, y: size.height - halfLineWidth - largeRadius), radius: largeRadius) + + context.closePath() + context.strokePath() + context.setBlendMode(.copy) + } + case .bottomSingle: + context.fillEllipse(in: CGRect(origin: CGPoint(), size: size)) + context.fillEllipse(in: CGRect(origin: CGPoint(), size: CGSize(width: smallRadius + smallRadius, height: smallRadius + smallRadius))) + context.fillEllipse(in: CGRect(origin: CGPoint(x: size.width - smallRadius - smallRadius, y: 0.0), size: CGSize(width: smallRadius + smallRadius, height: smallRadius + smallRadius))) + context.fill(CGRect(origin: CGPoint(x: smallRadius, y: 0.0), size: CGSize(width: size.width - smallRadius - smallRadius, height: smallRadius + smallRadius))) + context.fill(CGRect(origin: CGPoint(x: 0.0, y: smallRadius), size: CGSize(width: size.width, height: size.height - largeRadius - smallRadius))) + + if effectiveStrokeColor != nil { + context.setBlendMode(.normal) + context.beginPath() + context.move(to: CGPoint(x: halfLineWidth, y: smallRadius + halfLineWidth)) + context.addArc(tangent1End: CGPoint(x: halfLineWidth, y: halfLineWidth), tangent2End: CGPoint(x: halfLineWidth + smallRadius, y: halfLineWidth), radius: smallRadius) + context.addLine(to: CGPoint(x: size.width - smallRadius, y: halfLineWidth)) + context.addArc(tangent1End: CGPoint(x: size.width - halfLineWidth, y: halfLineWidth), tangent2End: CGPoint(x: size.width - halfLineWidth, y: halfLineWidth + smallRadius), radius: smallRadius) + context.addLine(to: CGPoint(x: size.width - halfLineWidth, y: size.height - halfLineWidth - largeRadius)) + context.addArc(tangent1End: CGPoint(x: size.width - halfLineWidth, y: size.height - halfLineWidth), tangent2End: CGPoint(x: size.width - halfLineWidth - largeRadius, y: size.height - halfLineWidth), radius: largeRadius) + context.addLine(to: CGPoint(x: halfLineWidth + largeRadius, y: size.height - halfLineWidth)) + context.addArc(tangent1End: CGPoint(x: halfLineWidth, y: size.height - halfLineWidth), tangent2End: CGPoint(x: halfLineWidth, y: size.height - halfLineWidth - largeRadius), radius: largeRadius) + + context.closePath() + context.strokePath() + context.setBlendMode(.copy) + } + } + })!.stretchableImage(withLeftCapWidth: Int(size.width / 2.0), topCapHeight: Int(size.height / 2.0)) +} diff --git a/submodules/TelegramPresentationData/Sources/FrameworkSpecific.swift b/submodules/TelegramPresentationData/Sources/FrameworkSpecific.swift new file mode 100644 index 0000000000..8ca13d7d92 --- /dev/null +++ b/submodules/TelegramPresentationData/Sources/FrameworkSpecific.swift @@ -0,0 +1,13 @@ +import Foundation +import UIKit + +private class FrameworkBundleClass: NSObject { +} + +let frameworkBundle: Bundle = Bundle(for: FrameworkBundleClass.self) + +extension UIImage { + convenience init?(bundleImageName: String) { + self.init(named: bundleImageName, in: frameworkBundle, compatibleWith: nil) + } +} diff --git a/submodules/TelegramUI/TelegramUI/PresentationThemeEssentialGraphics.swift b/submodules/TelegramPresentationData/Sources/PresentationThemeEssentialGraphics.swift similarity index 99% rename from submodules/TelegramUI/TelegramUI/PresentationThemeEssentialGraphics.swift rename to submodules/TelegramPresentationData/Sources/PresentationThemeEssentialGraphics.swift index e0c3fadda5..ae6edcffc1 100644 --- a/submodules/TelegramUI/TelegramUI/PresentationThemeEssentialGraphics.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationThemeEssentialGraphics.swift @@ -2,7 +2,6 @@ import Foundation import UIKit import Display import TelegramCore -import TelegramPresentationData private func generateCheckImage(partial: Bool, color: UIColor) -> UIImage? { return generateImage(CGSize(width: 11.0, height: 9.0), rotatedContext: { size, context in diff --git a/submodules/TelegramUI/TelegramUI/PresentationResourceKey.swift b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourceKey.swift similarity index 98% rename from submodules/TelegramUI/TelegramUI/PresentationResourceKey.swift rename to submodules/TelegramPresentationData/Sources/Resources/PresentationResourceKey.swift index 2e071ccb40..dfe1325e08 100644 --- a/submodules/TelegramUI/TelegramUI/PresentationResourceKey.swift +++ b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourceKey.swift @@ -1,9 +1,9 @@ import Foundation -struct PresentationResources { +public struct PresentationResources { } -enum PresentationResourceKey: Int32 { +public enum PresentationResourceKey: Int32 { case rootNavigationIndefiniteActivity case rootTabContactsIcon diff --git a/submodules/TelegramUI/TelegramUI/PresentationResourcesCallList.swift b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesCallList.swift similarity index 71% rename from submodules/TelegramUI/TelegramUI/PresentationResourcesCallList.swift rename to submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesCallList.swift index 18943b6698..89f5a4e0d7 100644 --- a/submodules/TelegramUI/TelegramUI/PresentationResourcesCallList.swift +++ b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesCallList.swift @@ -1,16 +1,15 @@ import Foundation import UIKit import Display -import TelegramPresentationData -struct PresentationResourcesCallList { - static func outgoingIcon(_ theme: PresentationTheme) -> UIImage? { +public struct PresentationResourcesCallList { + public static func outgoingIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.callListOutgoingIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Call List/OutgoingIcon"), color: theme.list.disclosureArrowColor) }) } - static func infoButton(_ theme: PresentationTheme) -> UIImage? { + public static func infoButton(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.callListInfoButton.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Call List/InfoButton"), color: theme.list.itemAccentColor) }) diff --git a/submodules/TelegramUI/TelegramUI/PresentationResourcesChat.swift b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChat.swift similarity index 86% rename from submodules/TelegramUI/TelegramUI/PresentationResourcesChat.swift rename to submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChat.swift index 0239693f0b..6766585161 100644 --- a/submodules/TelegramUI/TelegramUI/PresentationResourcesChat.swift +++ b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChat.swift @@ -38,8 +38,8 @@ private func generateInputPanelButtonBackgroundImage(fillColor: UIColor, strokeC })?.stretchableImage(withLeftCapWidth: Int(radius), topCapHeight: Int(radius)) } -struct PresentationResourcesChat { - static func chatTitleLockIcon(_ theme: PresentationTheme) -> UIImage? { +public struct PresentationResourcesChat { + public static func chatTitleLockIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatTitleLockIcon.rawValue, { theme in return generateImage(CGSize(width: 9.0, height: 13.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -56,7 +56,7 @@ struct PresentationResourcesChat { }) } - static func chatTitleMuteIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatTitleMuteIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatTitleMuteIcon.rawValue, { theme in return generateImage(CGSize(width: 9.0, height: 9.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -67,7 +67,7 @@ struct PresentationResourcesChat { }) } - static func principalGraphics(_ theme: PresentationTheme, wallpaper: TelegramWallpaper) -> PrincipalThemeEssentialGraphics { + public static func principalGraphics(_ theme: PresentationTheme, wallpaper: TelegramWallpaper) -> PrincipalThemeEssentialGraphics { let hasWallpaper = !wallpaper.isEmpty let key: PresentationResourceKey = !hasWallpaper ? PresentationResourceKey.chatPrincipalThemeEssentialGraphicsWithoutWallpaper : PresentationResourceKey.chatPrincipalThemeEssentialGraphicsWithWallpaper return theme.object(key.rawValue, { theme in @@ -75,50 +75,50 @@ struct PresentationResourcesChat { }) as! PrincipalThemeEssentialGraphics } - static func additionalGraphics(_ theme: PresentationTheme, wallpaper: TelegramWallpaper) -> PrincipalThemeAdditionalGraphics { + public static func additionalGraphics(_ theme: PresentationTheme, wallpaper: TelegramWallpaper) -> PrincipalThemeAdditionalGraphics { let key: PresentationResourceKey = wallpaper.isBuiltin ? PresentationResourceKey.chatPrincipalThemeAdditionalGraphicsWithDefaultWallpaper : PresentationResourceKey.chatPrincipalThemeAdditionalGraphicsWithCustomWallpaper return theme.object(key.rawValue, { theme in return PrincipalThemeAdditionalGraphics(theme.chat, wallpaper: wallpaper) }) as! PrincipalThemeAdditionalGraphics } - static func chatBubbleVerticalLineIncomingImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleVerticalLineIncomingImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleVerticalLineIncomingImage.rawValue, { theme in return generateLineImage(color: theme.chat.message.incoming.accentControlColor) }) } - static func chatBubbleVerticalLineOutgoingImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleVerticalLineOutgoingImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleVerticalLineOutgoingImage.rawValue, { theme in return generateLineImage(color: theme.chat.message.outgoing.accentControlColor) }) } - static func chatBubbleConsumableContentIncomingIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleConsumableContentIncomingIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleConsumableContentIncomingIcon.rawValue, { theme in return generateFilledCircleImage(diameter: 4.0, color: theme.chat.message.incoming.accentControlColor) }) } - static func chatBubbleConsumableContentOutgoingIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleConsumableContentOutgoingIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleConsumableContentOutgoingIcon.rawValue, { theme in return generateFilledCircleImage(diameter: 4.0, color: theme.chat.message.outgoing.accentControlColor) }) } - static func chatMediaConsumableContentIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatMediaConsumableContentIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatMediaConsumableContentIcon.rawValue, { theme in return generateFilledCircleImage(diameter: 4.0, color: theme.chat.message.mediaDateAndStatusTextColor) }) } - static func chatBubbleSecretMediaIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleSecretMediaIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleSecretMediaIcon.rawValue, { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/SecretMediaIcon"), color: theme.chat.message.mediaOverlayControlColors.foregroundColor) }) } - static func chatBubbleSecretMediaCompactIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleSecretMediaCompactIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleSecretMediaCompactIcon.rawValue, { theme in if let image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/SecretMediaIcon"), color: theme.chat.message.mediaOverlayControlColors.foregroundColor) { let factor: CGFloat = 0.6 @@ -132,14 +132,14 @@ struct PresentationResourcesChat { }) } - static func chatInstantVideoBackgroundImage(_ theme: PresentationTheme, wallpaper: Bool) -> UIImage? { + public static func chatInstantVideoBackgroundImage(_ theme: PresentationTheme, wallpaper: Bool) -> UIImage? { let key: PresentationResourceKey = !wallpaper ? PresentationResourceKey.chatInstantVideoWithoutWallpaperBackgroundImage : PresentationResourceKey.chatInstantVideoWithWallpaperBackgroundImage return theme.image(key.rawValue, { theme in return generateInstantVideoBackground(fillColor: theme.chat.message.freeform.withWallpaper.fill, strokeColor: theme.chat.message.freeform.withWallpaper.stroke) }) } - static func chatUnreadBarBackgroundImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatUnreadBarBackgroundImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatUnreadBarBackgroundImage.rawValue, { theme in return generateImage(CGSize(width: 1.0, height: 8.0), contextGenerator: { size, context -> Void in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -152,13 +152,13 @@ struct PresentationResourcesChat { }) } - static func chatInfoItemBackgroundImageWithoutWallpaper(_ theme: PresentationTheme) -> UIImage? { + public static func chatInfoItemBackgroundImageWithoutWallpaper(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInfoItemBackgroundImageWithoutWallpaper.rawValue, { theme in return messageSingleBubbleLikeImage(fillColor: theme.chat.message.incoming.bubble.withoutWallpaper.fill, strokeColor: theme.chat.message.incoming.bubble.withoutWallpaper.stroke) }) } - static func chatInfoItemBackgroundImage(_ theme: PresentationTheme, wallpaper: Bool) -> UIImage? { + public static func chatInfoItemBackgroundImage(_ theme: PresentationTheme, wallpaper: Bool) -> UIImage? { let key: PresentationResourceKey = !wallpaper ? PresentationResourceKey.chatInfoItemBackgroundImageWithoutWallpaper : PresentationResourceKey.chatInfoItemBackgroundImageWithWallpaper return theme.image(key.rawValue, { theme in let components: PresentationThemeBubbleColorComponents = wallpaper ? theme.chat.message.incoming.bubble.withWallpaper : theme.chat.message.incoming.bubble.withoutWallpaper @@ -166,7 +166,7 @@ struct PresentationResourcesChat { }) } - static func chatInputPanelCloseIconImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelCloseIconImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelCloseIconImage.rawValue, { theme in return generateImage(CGSize(width: 12.0, height: 12.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -184,25 +184,25 @@ struct PresentationResourcesChat { }) } - static func chatInputPanelEncircledCloseIconImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelEncircledCloseIconImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelEncircledCloseIconImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/EncircledCloseButton"), color: theme.chat.inputPanel.panelControlAccentColor) }) } - static func chatInputPanelVerticalSeparatorLineImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelVerticalSeparatorLineImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelVerticalSeparatorLineImage.rawValue, { theme in return generateVerticallyStretchableFilledCircleImage(radius: 1.0, color: theme.chat.inputPanel.panelControlAccentColor) }) } - static func chatMediaInputPanelHighlightedIconImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatMediaInputPanelHighlightedIconImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatMediaInputPanelHighlightedIconImage.rawValue, { theme in return generateStretchableFilledCircleImage(radius: 9.0, color: theme.chat.inputMediaPanel.panelHighlightedIconBackgroundColor) }) } - static func chatInputMediaPanelSavedStickersIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputMediaPanelSavedStickersIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputMediaPanelSavedStickersIconImage.rawValue, { theme in return generateImage(CGSize(width: 26.0, height: 26.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -213,7 +213,7 @@ struct PresentationResourcesChat { }) } - static func chatInputMediaPanelRecentStickersIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputMediaPanelRecentStickersIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputMediaPanelRecentStickersIconImage.rawValue, { theme in return generateImage(CGSize(width: 26.0, height: 26.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -224,7 +224,7 @@ struct PresentationResourcesChat { }) } - static func chatInputMediaPanelRecentGifsIconImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputMediaPanelRecentGifsIconImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputMediaPanelRecentGifsIconImage.rawValue, { theme in return generateImage(CGSize(width: 26.0, height: 26.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -235,49 +235,49 @@ struct PresentationResourcesChat { }) } - static func chatInputMediaPanelTrendingIconImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputMediaPanelTrendingIconImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputMediaPanelTrendingIconImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Media/TrendingIcon"), color: theme.chat.inputMediaPanel.panelIconColor) }) } - static func chatInputMediaPanelSettingsIconImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputMediaPanelSettingsIconImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputMediaPanelSettingsIconImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Media/SettingsIcon"), color: theme.chat.inputMediaPanel.panelIconColor) }) } - static func chatInputMediaPanelAddPackButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputMediaPanelAddPackButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputMediaPanelAddPackButtonImage.rawValue, { theme in return generateStretchableFilledCircleImage(diameter: 8.0, color: nil, strokeColor: theme.chat.inputPanel.panelControlAccentColor, strokeWidth: 1.0, backgroundColor: nil) }) } - static func chatInputMediaPanelGridSetupImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputMediaPanelGridSetupImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputMediaPanelGridSetupImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Media/GridSetupIcon"), color: theme.chat.inputMediaPanel.panelIconColor.withAlphaComponent(0.65)) }) } - static func chatInputMediaPanelGridDismissImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputMediaPanelGridDismissImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputMediaPanelGridDismissImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Media/GridDismissIcon"), color: theme.chat.inputMediaPanel.panelIconColor.withAlphaComponent(0.65)) }) } - static func chatInputButtonPanelButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputButtonPanelButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputButtonPanelButtonImage.rawValue, { theme in return generateInputPanelButtonBackgroundImage(fillColor: theme.chat.inputButtonPanel.buttonFillColor, strokeColor: theme.chat.inputButtonPanel.buttonStrokeColor) }) } - static func chatInputButtonPanelButtonHighlightedImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputButtonPanelButtonHighlightedImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputButtonPanelButtonHighlightedImage.rawValue, { theme in return generateInputPanelButtonBackgroundImage(fillColor: theme.chat.inputButtonPanel.buttonHighlightedFillColor, strokeColor: theme.chat.inputButtonPanel.buttonHighlightedStrokeColor) }) } - static func chatInputTextFieldBackgroundImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputTextFieldBackgroundImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputTextFieldBackgroundImage.rawValue, { theme in let diameter: CGFloat = 35.0 UIGraphicsBeginImageContextWithOptions(CGSize(width: diameter, height: diameter), false, 0.0) @@ -300,7 +300,7 @@ struct PresentationResourcesChat { }) } - static func chatInputTextFieldClearImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputTextFieldClearImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputTextFieldClearImage.rawValue, { theme in return generateImage(CGSize(width: 14.0, height: 14.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -329,7 +329,7 @@ struct PresentationResourcesChat { }) } - static func chatInputPanelSendButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelSendButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelSendButtonImage.rawValue, { theme in return generateImage(CGSize(width: 33.0, height: 33.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -346,7 +346,7 @@ struct PresentationResourcesChat { }) } - static func chatInputPanelApplyButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelApplyButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelApplyButtonImage.rawValue, { theme in return generateImage(CGSize(width: 33.0, height: 33.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -362,37 +362,37 @@ struct PresentationResourcesChat { }) } - static func chatInputPanelVoiceButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelVoiceButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelVoiceButtonImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/IconMicrophone"), color: theme.chat.inputPanel.panelControlColor) }) } - static func chatInputPanelVideoButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelVideoButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelVideoButtonImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/IconVideo"), color: theme.chat.inputPanel.panelControlColor) }) } - static func chatInputPanelVoiceActiveButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelVoiceActiveButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelVoiceActiveButtonImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/IconMicrophone"), color: theme.chat.inputPanel.mediaRecordingControl.activeIconColor) }) } - static func chatInputPanelVideoActiveButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelVideoActiveButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelVideoActiveButtonImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/IconVideo"), color: theme.chat.inputPanel.mediaRecordingControl.activeIconColor) }) } - static func chatInputPanelAttachmentButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelAttachmentButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelAttachmentButtonImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/IconAttachment"), color: theme.chat.inputPanel.panelControlColor) }) } - static func chatInputPanelEditAttachmentButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelEditAttachmentButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelEditAttachmentButtonImage.rawValue, { theme in if let image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/IconAttachment"), color: theme.chat.inputPanel.panelControlColor) { return generateImage(image.size, rotatedContext: { size, context in @@ -439,67 +439,67 @@ struct PresentationResourcesChat { }) } - static func chatInputPanelExpandButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelExpandButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelExpandButtonImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/IconExpandInput"), color: theme.chat.inputPanel.panelControlColor) }) } - static func chatInputPanelMediaRecordingDotImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelMediaRecordingDotImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelMediaRecordingDotImage.rawValue, { theme in return generateFilledCircleImage(diameter: 9.0, color: theme.chat.inputPanel.mediaRecordingDotColor) }) } - static func chatInputPanelMediaRecordingCancelArrowImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputPanelMediaRecordingCancelArrowImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputPanelMediaRecordingCancelArrowImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/AudioRecordingCancelArrow"), color: theme.chat.inputPanel.panelControlColor) }) } - static func chatInputTextFieldStickersImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputTextFieldStickersImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputTextFieldStickersImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/AccessoryIconStickers"), color: theme.chat.inputPanel.inputControlColor) }) } - static func chatInputTextFieldInputButtonsImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputTextFieldInputButtonsImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputTextFieldInputButtonsImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/AccessoryIconInputButtons"), color: theme.chat.inputPanel.inputControlColor) }) } - static func chatInputTextFieldCommandsImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputTextFieldCommandsImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputTextFieldCommandsImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/AccessoryIconCommands"), color: theme.chat.inputPanel.inputControlColor) }) } - static func chatInputTextFieldSilentPostOnImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputTextFieldSilentPostOnImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputTextFieldSilentPostOnImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/AccessoryIconSilentPostOn"), color: theme.chat.inputPanel.inputControlColor) }) } - static func chatInputTextFieldSilentPostOffImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputTextFieldSilentPostOffImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputTextFieldSilentPostOffImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/AccessoryIconSilentPostOff"), color: theme.chat.inputPanel.inputControlColor) }) } - static func chatInputTextFieldKeyboardImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputTextFieldKeyboardImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputTextFieldKeyboardImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/AccessoryIconKeyboard"), color: theme.chat.inputPanel.inputControlColor) }) } - static func chatInputTextFieldTimerImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputTextFieldTimerImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputTextFieldTimerImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/AccessoryIconTimer"), color: theme.chat.inputPanel.inputControlColor) }) } - static func chatHistoryNavigationButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatHistoryNavigationButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatHistoryNavigationButtonImage.rawValue, { theme in return generateImage(CGSize(width: 38.0, height: 38.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -520,7 +520,7 @@ struct PresentationResourcesChat { }) } - static func chatHistoryMentionsButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatHistoryMentionsButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatHistoryMentionsButtonImage.rawValue, { theme in return generateImage(CGSize(width: 38.0, height: 38.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -537,19 +537,19 @@ struct PresentationResourcesChat { }) } - static func chatHistoryNavigationButtonBadgeImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatHistoryNavigationButtonBadgeImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatHistoryNavigationButtonBadgeImage.rawValue, { theme in return generateStretchableFilledCircleImage(diameter: 18.0, color: theme.chat.historyNavigation.badgeBackgroundColor, strokeColor: theme.chat.historyNavigation.badgeStrokeColor, strokeWidth: 1.0, backgroundColor: nil) }) } - static func sharedMediaFileDownloadStartIcon(_ theme: PresentationTheme) -> UIImage? { + public static func sharedMediaFileDownloadStartIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.sharedMediaFileDownloadStartIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "List Menu/ListDownloadStartIcon"), color: theme.list.itemAccentColor) }) } - static func sharedMediaFileDownloadPauseIcon(_ theme: PresentationTheme) -> UIImage? { + public static func sharedMediaFileDownloadPauseIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.sharedMediaFileDownloadPauseIcon.rawValue, { theme in return generateImage(CGSize(width: 11.0, height: 11.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -562,7 +562,7 @@ struct PresentationResourcesChat { }) } - static func sharedMediaInstantViewIcon(_ theme: PresentationTheme) -> UIImage? { + public static func sharedMediaInstantViewIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.sharedMediaInstantViewIcon.rawValue, { theme in return generateImage(CGSize(width: 9.0, height: 12.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -577,13 +577,13 @@ struct PresentationResourcesChat { }) } - static func chatInfoCallButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInfoCallButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInfoCallButtonImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Info/CallButton"), color: theme.list.itemAccentColor) }) } - static func chatInstantMessageInfoBackgroundImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInstantMessageInfoBackgroundImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInstantMessageInfoBackgroundImage.rawValue, { theme in return generateImage(CGSize(width: 24.0, height: 24.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -593,7 +593,7 @@ struct PresentationResourcesChat { }) } - static func chatInstantMessageMuteIconImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInstantMessageMuteIconImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInstantMessageMuteIconImage.rawValue, { theme in return generateImage(CGSize(width: 24.0, height: 24.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -605,19 +605,19 @@ struct PresentationResourcesChat { }) } - static func chatBubbleIncomingCallButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleIncomingCallButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleIncomingCallButtonImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Info/CallButton"), color: theme.chat.message.incoming.accentControlColor) }) } - static func chatBubbleOutgoingCallButtonImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleOutgoingCallButtonImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleOutgoingCallButtonImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Info/CallButton"), color: theme.chat.message.outgoing.accentControlColor) }) } - static func chatBubbleMapPinImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleMapPinImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleMapPinImage.rawValue, { theme in return generateImage(CGSize(width: 62.0, height: 74.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -634,85 +634,85 @@ struct PresentationResourcesChat { }) } - static func chatInputSearchPanelUpImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputSearchPanelUpImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputSearchPanelUpImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Search/UpButton"), color: theme.chat.inputPanel.panelControlAccentColor) }) } - static func chatInputSearchPanelUpDisabledImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputSearchPanelUpDisabledImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputSearchPanelUpDisabledImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Search/UpButton"), color: theme.chat.inputPanel.panelControlDisabledColor) }) } - static func chatInputSearchPanelDownImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputSearchPanelDownImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputSearchPanelDownImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Search/DownButton"), color: theme.chat.inputPanel.panelControlAccentColor) }) } - static func chatInputSearchPanelDownDisabledImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputSearchPanelDownDisabledImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputSearchPanelDownDisabledImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Search/DownButton"), color: theme.chat.inputPanel.panelControlDisabledColor) }) } - static func chatInputSearchPanelCalendarImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputSearchPanelCalendarImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputSearchPanelCalendarImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Search/Calendar"), color: theme.chat.inputPanel.panelControlAccentColor) }) } - static func chatInputSearchPanelMembersImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatInputSearchPanelMembersImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatInputSearchPanelMembersImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Search/Members"), color: theme.chat.inputPanel.panelControlAccentColor) }) } - static func chatTitlePanelInfoImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatTitlePanelInfoImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatTitlePanelInfoImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Title Panels/InfoIcon"), color: theme.chat.inputPanel.panelControlAccentColor) }) } - static func chatTitlePanelSearchImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatTitlePanelSearchImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatTitlePanelSearchImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Title Panels/SearchIcon"), color: theme.chat.inputPanel.panelControlAccentColor) }) } - static func chatTitlePanelUnarchiveImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatTitlePanelUnarchiveImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatTitlePanelUnarchiveImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Title Panels/UnarchiveIcon"), color: theme.chat.inputPanel.panelControlAccentColor) }) } - static func chatTitlePanelMuteImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatTitlePanelMuteImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatTitlePanelMuteImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat List/RevealActionMuteIcon"), color: theme.chat.inputPanel.panelControlAccentColor) }) } - static func chatTitlePanelUnmuteImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatTitlePanelUnmuteImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatTitlePanelUnmuteImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat List/RevealActionUnmuteIcon"), color: theme.chat.inputPanel.panelControlAccentColor) }) } - static func chatTitlePanelCallImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatTitlePanelCallImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatTitlePanelCallImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Info/CallButton"), color: theme.chat.inputPanel.panelControlAccentColor) }) } - static func chatTitlePanelReportImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatTitlePanelReportImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatTitlePanelReportImage.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Title Panels/ReportIcon"), color: theme.chat.inputPanel.panelControlAccentColor) }) } - static func chatTitlePanelGroupingImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatTitlePanelGroupingImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatTitlePanelGroupingImage.rawValue, { theme in return generateImage(CGSize(width: 32.0, height: 32.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -724,57 +724,57 @@ struct PresentationResourcesChat { }) } - static func chatMessageAttachedContentButtonIncoming(_ theme: PresentationTheme) -> UIImage? { + public static func chatMessageAttachedContentButtonIncoming(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatMessageAttachedContentButtonIncoming.rawValue, { theme in return generateStretchableFilledCircleImage(diameter: 9.0, color: nil, strokeColor: theme.chat.message.incoming.accentControlColor, strokeWidth: 1.0, backgroundColor: nil) }) } - static func chatMessageAttachedContentHighlightedButtonIncoming(_ theme: PresentationTheme) -> UIImage? { + public static func chatMessageAttachedContentHighlightedButtonIncoming(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatMessageAttachedContentHighlightedButtonIncoming.rawValue, { theme in return generateStretchableFilledCircleImage(diameter: 9.0, color: theme.chat.message.incoming.accentControlColor) }) } - static func chatMessageAttachedContentButtonOutgoing(_ theme: PresentationTheme) -> UIImage? { + public static func chatMessageAttachedContentButtonOutgoing(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatMessageAttachedContentButtonOutgoing.rawValue, { theme in return generateStretchableFilledCircleImage(diameter: 9.0, color: nil, strokeColor: theme.chat.message.outgoing.accentControlColor, strokeWidth: 1.0, backgroundColor: nil) }) } - static func chatMessageAttachedContentHighlightedButtonOutgoing(_ theme: PresentationTheme) -> UIImage? { + public static func chatMessageAttachedContentHighlightedButtonOutgoing(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatMessageAttachedContentHighlightedButtonOutgoing.rawValue, { theme in return generateStretchableFilledCircleImage(diameter: 9.0, color: theme.chat.message.outgoing.accentControlColor) }) } - static func chatMessageAttachedContentButtonIconInstantIncoming(_ theme: PresentationTheme) -> UIImage? { + public static func chatMessageAttachedContentButtonIconInstantIncoming(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatMessageAttachedContentButtonIconInstantIncoming.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/AttachedContentInstantIcon"), color: theme.chat.message.incoming.accentControlColor) }) } - static func chatMessageAttachedContentHighlightedButtonIconInstantIncoming(_ theme: PresentationTheme, wallpaper: Bool) -> UIImage? { + public static func chatMessageAttachedContentHighlightedButtonIconInstantIncoming(_ theme: PresentationTheme, wallpaper: Bool) -> UIImage? { let key: PresentationResourceKey = !wallpaper ? PresentationResourceKey.chatMessageAttachedContentHighlightedButtonIconInstantIncomingWithoutWallpaper : PresentationResourceKey.chatMessageAttachedContentHighlightedButtonIconInstantIncomingWithWallpaper return theme.image(key.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/AttachedContentInstantIcon"), color: bubbleColorComponents(theme: theme, incoming: true, wallpaper: wallpaper).fill) }) } - static func chatMessageAttachedContentButtonIconInstantOutgoing(_ theme: PresentationTheme) -> UIImage? { + public static func chatMessageAttachedContentButtonIconInstantOutgoing(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatMessageAttachedContentButtonIconInstantOutgoing.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/AttachedContentInstantIcon"), color: theme.chat.message.outgoing.accentControlColor) }) } - static func chatMessageAttachedContentHighlightedButtonIconInstantOutgoing(_ theme: PresentationTheme, wallpaper: Bool) -> UIImage? { + public static func chatMessageAttachedContentHighlightedButtonIconInstantOutgoing(_ theme: PresentationTheme, wallpaper: Bool) -> UIImage? { let key: PresentationResourceKey = !wallpaper ? PresentationResourceKey.chatMessageAttachedContentHighlightedButtonIconInstantOutgoingWithoutWallpaper : PresentationResourceKey.chatMessageAttachedContentHighlightedButtonIconInstantOutgoingWithWallpaper return theme.image(key.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/AttachedContentInstantIcon"), color: bubbleColorComponents(theme: theme, incoming: false, wallpaper: wallpaper).fill) }) } - static func chatBubbleReplyThumbnailPlayImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleReplyThumbnailPlayImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleReplyThumbnailPlayImage.rawValue, { theme in return generateImage(CGSize(width: 16.0, height: 16.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -806,7 +806,7 @@ struct PresentationResourcesChat { }) } - static func chatCommandPanelArrowImage(_ theme: PresentationTheme) -> UIImage? { + public static func chatCommandPanelArrowImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatCommandPanelArrowImage.rawValue, { theme in return generateImage(CGSize(width: 11.0, height: 11.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -834,7 +834,7 @@ struct PresentationResourcesChat { }) } - static func chatBubbleFileCloudFetchMediaIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleFileCloudFetchMediaIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleFileCloudFetchMediaIcon.rawValue, { theme in guard let image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/FileCloudFetch"), color: theme.chat.message.mediaOverlayControlColors.foregroundColor) else { return nil @@ -846,31 +846,31 @@ struct PresentationResourcesChat { }) } - static func chatBubbleFileCloudFetchIncomingIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleFileCloudFetchIncomingIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleFileCloudFetchIncomingIcon.rawValue, { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/FileCloudFetch"), color: theme.chat.message.incoming.accentControlColor) }) } - static func chatBubbleFileCloudFetchOutgoingIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleFileCloudFetchOutgoingIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleFileCloudFetchOutgoingIcon.rawValue, { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/FileCloudFetch"), color: theme.chat.message.outgoing.accentControlColor) }) } - static func chatBubbleFileCloudFetchedIncomingIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleFileCloudFetchedIncomingIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleFileCloudFetchedIncomingIcon.rawValue, { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/FileCloudFetched"), color: theme.chat.message.incoming.accentControlColor) }) } - static func chatBubbleFileCloudFetchedOutgoingIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleFileCloudFetchedOutgoingIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleFileCloudFetchedOutgoingIcon.rawValue, { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/FileCloudFetched"), color: theme.chat.message.outgoing.accentControlColor) }) } - static func chatBubbleDeliveryFailedIcon(_ theme: PresentationTheme) -> UIImage? { + public static func chatBubbleDeliveryFailedIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatBubbleDeliveryFailedIcon.rawValue, { theme in return generateImage(CGSize(width: 22.0, height: 22.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -885,19 +885,19 @@ struct PresentationResourcesChat { }) } - static func groupInfoAdminsIcon(_ theme: PresentationTheme) -> UIImage? { + public static func groupInfoAdminsIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.groupInfoAdminsIcon.rawValue, { _ in return UIImage(bundleImageName: "Chat/Info/GroupAdminsIcon")?.precomposed() }) } - static func groupInfoPermissionsIcon(_ theme: PresentationTheme) -> UIImage? { + public static func groupInfoPermissionsIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.groupInfoPermissionsIcon.rawValue, { _ in return UIImage(bundleImageName: "Chat/Info/GroupPermissionsIcon")?.precomposed() }) } - static func groupInfoMembersIcon(_ theme: PresentationTheme) -> UIImage? { + public static func groupInfoMembersIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.groupInfoMembersIcon.rawValue, { _ in return UIImage(bundleImageName: "Chat/Info/GroupMembersIcon")?.precomposed() }) diff --git a/submodules/TelegramUI/TelegramUI/PresentationResourcesChatList.swift b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChatList.swift similarity index 89% rename from submodules/TelegramUI/TelegramUI/PresentationResourcesChatList.swift rename to submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChatList.swift index 4799b9802c..e21dfcda23 100644 --- a/submodules/TelegramUI/TelegramUI/PresentationResourcesChatList.swift +++ b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChatList.swift @@ -55,21 +55,21 @@ private func generateClockMinImage(color: UIColor) -> UIImage? { }) } -enum RecentStatusOnlineIconState { +public enum RecentStatusOnlineIconState { case regular case highlighted case pinned case panel } -enum ScamIconType { +public enum ScamIconType { case regular case outgoing case service } -struct PresentationResourcesChatList { - static func pendingImage(_ theme: PresentationTheme) -> UIImage? { +public struct PresentationResourcesChatList { + public static func pendingImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListPending.rawValue, { theme in return generateImage(CGSize(width: 12.0, height: 14.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -84,31 +84,31 @@ struct PresentationResourcesChatList { }) } - static func singleCheckImage(_ theme: PresentationTheme) -> UIImage? { + public static func singleCheckImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListSingleCheck.rawValue, { theme in return generateStatusCheckImage(theme: theme, single: true) }) } - static func doubleCheckImage(_ theme: PresentationTheme) -> UIImage? { + public static func doubleCheckImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListDoubleCheck.rawValue, { theme in return generateStatusCheckImage(theme: theme, single: false) }) } - static func clockFrameImage(_ theme: PresentationTheme) -> UIImage? { + public static func clockFrameImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListClockFrame.rawValue, { theme in return generateClockFrameImage(color: theme.chatList.pendingIndicatorColor) }) } - static func clockMinImage(_ theme: PresentationTheme) -> UIImage? { + public static func clockMinImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListClockMin.rawValue, { theme in return generateClockMinImage(color: theme.chatList.pendingIndicatorColor) }) } - static func lockTopUnlockedImage(_ theme: PresentationTheme) -> UIImage? { + public static func lockTopUnlockedImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListLockTopUnlockedImage.rawValue, { theme in return generateImage(CGSize(width: 7.0, height: 6.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -124,7 +124,7 @@ struct PresentationResourcesChatList { }) } - static func lockBottomUnlockedImage(_ theme: PresentationTheme) -> UIImage? { + public static func lockBottomUnlockedImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListLockBottomUnlockedImage.rawValue, { theme in return generateImage(CGSize(width: 10.0, height: 8.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -135,7 +135,7 @@ struct PresentationResourcesChatList { }) } - static func recentStatusOnlineIcon(_ theme: PresentationTheme, state: RecentStatusOnlineIconState) -> UIImage? { + public static func recentStatusOnlineIcon(_ theme: PresentationTheme, state: RecentStatusOnlineIconState) -> UIImage? { let key: PresentationResourceKey switch state { case .regular: @@ -169,49 +169,49 @@ struct PresentationResourcesChatList { }) } - static func badgeBackgroundActive(_ theme: PresentationTheme) -> UIImage? { + public static func badgeBackgroundActive(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListBadgeBackgroundActive.rawValue, { theme in return generateBadgeBackgroundImage(theme: theme, active: true) }) } - static func badgeBackgroundInactive(_ theme: PresentationTheme) -> UIImage? { + public static func badgeBackgroundInactive(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListBadgeBackgroundInactive.rawValue, { theme in return generateBadgeBackgroundImage(theme: theme, active: false) }) } - static func badgeBackgroundMention(_ theme: PresentationTheme) -> UIImage? { + public static func badgeBackgroundMention(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListBadgeBackgroundMention.rawValue, { theme in return generateBadgeBackgroundImage(theme: theme, active: true, icon: generateTintedImage(image: UIImage(bundleImageName: "Chat List/MentionBadgeIcon"), color: theme.chatList.unreadBadgeActiveTextColor)) }) } - static func badgeBackgroundInactiveMention(_ theme: PresentationTheme) -> UIImage? { + public static func badgeBackgroundInactiveMention(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListBadgeBackgroundInactiveMention.rawValue, { theme in return generateBadgeBackgroundImage(theme: theme, active: false, icon: generateTintedImage(image: UIImage(bundleImageName: "Chat List/MentionBadgeIcon"), color: theme.chatList.unreadBadgeInactiveTextColor)) }) } - static func badgeBackgroundPinned(_ theme: PresentationTheme) -> UIImage? { + public static func badgeBackgroundPinned(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListBadgeBackgroundPinned.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat List/PeerPinnedIcon"), color: theme.chatList.pinnedBadgeColor) }) } - static func mutedIcon(_ theme: PresentationTheme) -> UIImage? { + public static func mutedIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListMutedIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat List/PeerMutedIcon"), color: theme.chatList.muteIconColor) }) } - static func verifiedIcon(_ theme: PresentationTheme) -> UIImage? { + public static func verifiedIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListVerifiedIcon.rawValue, { theme in return UIImage(bundleImageName: "Chat List/PeerVerifiedIcon")?.precomposed() }) } - static func scamIcon(_ theme: PresentationTheme, type: ScamIconType) -> UIImage? { + public static func scamIcon(_ theme: PresentationTheme, type: ScamIconType) -> UIImage? { let key: PresentationResourceKey let color: UIColor switch type { @@ -247,7 +247,7 @@ struct PresentationResourcesChatList { }) } - static func secretIcon(_ theme: PresentationTheme) -> UIImage? { + public static func secretIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.chatListSecretIcon.rawValue, { theme in return generateImage(CGSize(width: 9.0, height: 12.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) diff --git a/submodules/TelegramUI/TelegramUI/PresentationResourcesItemList.swift b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesItemList.swift similarity index 85% rename from submodules/TelegramUI/TelegramUI/PresentationResourcesItemList.swift rename to submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesItemList.swift index 73faca85b1..30417c5c09 100644 --- a/submodules/TelegramUI/TelegramUI/PresentationResourcesItemList.swift +++ b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesItemList.swift @@ -16,7 +16,7 @@ private func generateArrowImage(_ theme: PresentationTheme) -> UIImage? { }) } -func generateItemListCheckIcon(color: UIColor) -> UIImage? { +public func generateItemListCheckIcon(color: UIColor) -> UIImage? { return generateImage(CGSize(width: 12.0, height: 10.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) context.setStrokeColor(color.cgColor) @@ -29,7 +29,7 @@ func generateItemListCheckIcon(color: UIColor) -> UIImage? { }) } -func generateItemListPlusIcon(_ color: UIColor) -> UIImage? { +public func generateItemListPlusIcon(_ color: UIColor) -> UIImage? { return generateImage(CGSize(width: 18.0, height: 18.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) context.setFillColor(color.cgColor) @@ -40,42 +40,42 @@ func generateItemListPlusIcon(_ color: UIColor) -> UIImage? { }) } -struct PresentationResourcesItemList { - static func disclosureArrowImage(_ theme: PresentationTheme) -> UIImage? { +public struct PresentationResourcesItemList { + public static func disclosureArrowImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListDisclosureArrow.rawValue, generateArrowImage) } - static func checkIconImage(_ theme: PresentationTheme) -> UIImage? { + public static func checkIconImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListCheckIcon.rawValue, { theme in return generateItemListCheckIcon(color: theme.list.itemAccentColor) }) } - static func secondaryCheckIconImage(_ theme: PresentationTheme) -> UIImage? { + public static func secondaryCheckIconImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListSecondaryCheckIcon.rawValue, { theme in return generateItemListCheckIcon(color: theme.list.itemSecondaryTextColor) }) } - static func plusIconImage(_ theme: PresentationTheme) -> UIImage? { + public static func plusIconImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListPlusIcon.rawValue, { theme in return generateItemListPlusIcon(theme.list.itemAccentColor) }) } - static func stickerUnreadDotImage(_ theme: PresentationTheme) -> UIImage? { + public static func stickerUnreadDotImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListStickerItemUnreadDot.rawValue, { theme in return generateFilledCircleImage(diameter: 6.0, color: theme.list.itemAccentColor) }) } - static func verifiedPeerIcon(_ theme: PresentationTheme) -> UIImage? { + public static func verifiedPeerIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListVerifiedPeerIcon.rawValue, { theme in return UIImage(bundleImageName: "Item List/PeerVerifiedIcon")?.precomposed() }) } - static func itemListDeleteIndicatorIcon(_ theme: PresentationTheme) -> UIImage? { + public static func itemListDeleteIndicatorIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListDeleteIndicatorIcon.rawValue, { theme in guard let image = generateTintedImage(image: UIImage(bundleImageName: "Item List/RemoveItemIcon"), color: theme.list.itemDestructiveColor) else { return nil @@ -89,7 +89,7 @@ struct PresentationResourcesItemList { }) } - static func itemListReorderIndicatorIcon(_ theme: PresentationTheme) -> UIImage? { + public static func itemListReorderIndicatorIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListReorderIndicatorIcon.rawValue, { theme in generateImage(CGSize(width: 16.0, height: 9.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -102,25 +102,25 @@ struct PresentationResourcesItemList { }) } - static func addPersonIcon(_ theme: PresentationTheme) -> UIImage? { + public static func addPersonIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListAddPersonIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Contact List/AddMemberIcon"), color: theme.list.itemAccentColor) }) } - static func createGroupIcon(_ theme: PresentationTheme) -> UIImage? { + public static func createGroupIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListCreateGroupIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Location/CreateGroupIcon"), color: theme.list.itemAccentColor) }) } - static func addExceptionIcon(_ theme: PresentationTheme) -> UIImage? { + public static func addExceptionIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListAddExceptionIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Item List/AddExceptionIcon"), color: theme.list.itemAccentColor) }) } - static func addPhoneIcon(_ theme: PresentationTheme) -> UIImage? { + public static func addPhoneIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListAddPhoneIcon.rawValue, { theme in guard let image = generateTintedImage(image: UIImage(bundleImageName: "Item List/AddItemIcon"), color: theme.list.itemAccentColor) else { return nil @@ -134,19 +134,19 @@ struct PresentationResourcesItemList { }) } - static func itemListClearInputIcon(_ theme: PresentationTheme) -> UIImage? { + public static func itemListClearInputIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListClearInputIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Clear"), color: theme.list.inputClearButtonColor) }) } - static func cloudFetchIcon(_ theme: PresentationTheme) -> UIImage? { + public static func cloudFetchIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListCloudFetchIcon.rawValue, { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/FileCloudFetch"), color: theme.list.itemAccentColor) }) } - static func itemListCloseIconImage(_ theme: PresentationTheme) -> UIImage? { + public static func itemListCloseIconImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.itemListCloseIconImage.rawValue, { theme in return generateImage(CGSize(width: 12.0, height: 12.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) diff --git a/submodules/TelegramUI/TelegramUI/PresentationResourcesRootController.swift b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesRootController.swift similarity index 86% rename from submodules/TelegramUI/TelegramUI/PresentationResourcesRootController.swift rename to submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesRootController.swift index f047389114..8b8fc7b2cc 100644 --- a/submodules/TelegramUI/TelegramUI/PresentationResourcesRootController.swift +++ b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesRootController.swift @@ -7,7 +7,7 @@ private func generateShareButtonImage(theme: PresentationTheme) -> UIImage? { return generateTintedImage(image: UIImage(bundleImageName: "Chat List/NavigationShare"), color: theme.rootController.navigationBar.accentTextColor) } -func generateIndefiniteActivityIndicatorImage(color: UIColor, diameter: CGFloat = 22.0, lineWidth: CGFloat = 2.0) -> UIImage? { +public func generateIndefiniteActivityIndicatorImage(color: UIColor, diameter: CGFloat = 22.0, lineWidth: CGFloat = 2.0) -> UIImage? { return generateImage(CGSize(width: diameter, height: diameter), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) context.setStrokeColor(color.cgColor) @@ -19,7 +19,7 @@ func generateIndefiniteActivityIndicatorImage(color: UIColor, diameter: CGFloat }) } -func generatePlayerRateIcon(_ color: UIColor) -> UIImage? { +public func generatePlayerRateIcon(_ color: UIColor) -> UIImage? { return generateImage(CGSize(width: 19.0, height: 16.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) context.setFillColor(color.cgColor) @@ -30,42 +30,42 @@ func generatePlayerRateIcon(_ color: UIColor) -> UIImage? { }) } -struct PresentationResourcesRootController { - static func navigationIndefiniteActivityImage(_ theme: PresentationTheme) -> UIImage? { +public struct PresentationResourcesRootController { + public static func navigationIndefiniteActivityImage(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.rootNavigationIndefiniteActivity.rawValue, { theme in generateIndefiniteActivityIndicatorImage(color: theme.rootController.navigationBar.accentTextColor) }) } - static func navigationComposeIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationComposeIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationComposeIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat List/ComposeIcon"), color: theme.rootController.navigationBar.accentTextColor) }) } - static func navigationShareIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationShareIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationShareIcon.rawValue, generateShareButtonImage) } - static func navigationCallIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationCallIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationCallIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Info/CallButton"), color: theme.rootController.navigationBar.accentTextColor) }) } - static func navigationInfoIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationInfoIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationInfoIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat List/InfoIcon"), color: theme.rootController.navigationBar.accentTextColor) }) } - static func navigationSearchIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationSearchIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationSearchIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat List/SearchIcon"), color: theme.rootController.navigationBar.accentTextColor) }) } - static func navigationCompactSearchIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationCompactSearchIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationCompactSearchIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat List/SearchIcon"), color: theme.rootController.navigationBar.accentTextColor).flatMap({ image in let factor: CGFloat = 0.8 @@ -78,13 +78,13 @@ struct PresentationResourcesRootController { }) } - static func navigationAddIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationAddIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationAddIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat List/AddIcon"), color: theme.rootController.navigationBar.accentTextColor) }) } - static func navigationPlayerCloseButton(_ theme: PresentationTheme) -> UIImage? { + public static func navigationPlayerCloseButton(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationPlayerCloseButton.rawValue, { theme in return generateImage(CGSize(width: 12.0, height: 12.0), contextGenerator: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) @@ -101,79 +101,79 @@ struct PresentationResourcesRootController { }) } - static func navigationPlayerPlayIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationPlayerPlayIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationPlayerPlayIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "GlobalMusicPlayer/MinimizedPlay"), color: theme.rootController.navigationBar.accentTextColor) }) } - static func navigationPlayerRateActiveIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationPlayerRateActiveIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationPlayerRateActiveIcon.rawValue, { theme in return generatePlayerRateIcon(theme.rootController.navigationBar.accentTextColor) }) } - static func navigationPlayerRateInactiveIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationPlayerRateInactiveIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationPlayerRateInactiveIcon.rawValue, { theme in return generatePlayerRateIcon(theme.rootController.navigationBar.controlColor) }) } - static func navigationPlayerPauseIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationPlayerPauseIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationPlayerPauseIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "GlobalMusicPlayer/MinimizedPause"), color: theme.rootController.navigationBar.accentTextColor) }) } - static func navigationLiveLocationIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationLiveLocationIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationLiveLocationIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat List/LiveLocationPanelIcon"), color: theme.rootController.navigationBar.accentTextColor) }) } - static func navigationPlayerMaximizedPlayIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationPlayerMaximizedPlayIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationPlayerMaximizedPlayIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "GlobalMusicPlayer/Play"), color: theme.rootController.navigationBar.primaryTextColor) }) } - static func navigationPlayerMaximizedPauseIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationPlayerMaximizedPauseIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationPlayerMaximizedPauseIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "GlobalMusicPlayer/Pause"), color: theme.rootController.navigationBar.primaryTextColor) }) } - static func navigationPlayerMaximizedPreviousIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationPlayerMaximizedPreviousIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationPlayerMaximizedPreviousIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "GlobalMusicPlayer/Previous"), color: theme.rootController.navigationBar.primaryTextColor) }) } - static func navigationPlayerMaximizedNextIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationPlayerMaximizedNextIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationPlayerMaximizedNextIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "GlobalMusicPlayer/Next"), color: theme.rootController.navigationBar.primaryTextColor) }) } - static func navigationPlayerMaximizedShuffleIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationPlayerMaximizedShuffleIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationPlayerMaximizedShuffleIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "GlobalMusicPlayer/Shuffle"), color: theme.rootController.navigationBar.primaryTextColor) }) } - static func navigationPlayerMaximizedRepeatIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationPlayerMaximizedRepeatIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationPlayerMaximizedRepeatIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "GlobalMusicPlayer/Repeat"), color: theme.rootController.navigationBar.primaryTextColor) }) } - static func navigationPlayerHandleIcon(_ theme: PresentationTheme) -> UIImage? { + public static func navigationPlayerHandleIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.navigationPlayerHandleIcon.rawValue, { theme in return generateStretchableFilledCircleImage(diameter: 7.0, color: theme.rootController.navigationBar.controlColor) }) } - static func inAppNotificationBackground(_ theme: PresentationTheme) -> UIImage? { + public static func inAppNotificationBackground(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.inAppNotificationBackground.rawValue, { theme in let inset: CGFloat = 16.0 return generateImage(CGSize(width: 30.0 + inset * 2.0, height: 30.0 + 8.0 * 2.0 + 20.0), rotatedContext: { size, context in @@ -185,7 +185,7 @@ struct PresentationResourcesRootController { }) } - static func inAppNotificationSecretChatIcon(_ theme: PresentationTheme) -> UIImage? { + public static func inAppNotificationSecretChatIcon(_ theme: PresentationTheme) -> UIImage? { return theme.image(PresentationResourceKey.inAppNotificationSecretChatIcon.rawValue, { theme in return generateTintedImage(image: UIImage(bundleImageName: "Notification/SecretLock"), color: theme.inAppNotification.primaryTextColor) }) diff --git a/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesSettings.swift b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesSettings.swift new file mode 100644 index 0000000000..fd7466ff77 --- /dev/null +++ b/submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesSettings.swift @@ -0,0 +1,28 @@ +import Foundation +import UIKit +import Display + +public struct PresentationResourcesSettings { + public static let editProfile = UIImage(bundleImageName: "Settings/MenuIcons/EditProfile")?.precomposed() + public static let proxy = UIImage(bundleImageName: "Settings/MenuIcons/Proxy")?.precomposed() + public static let savedMessages = UIImage(bundleImageName: "Settings/MenuIcons/SavedMessages")?.precomposed() + public static let recentCalls = UIImage(bundleImageName: "Settings/MenuIcons/RecentCalls")?.precomposed() + public static let stickers = UIImage(bundleImageName: "Settings/MenuIcons/Stickers")?.precomposed() + + public static let notifications = UIImage(bundleImageName: "Settings/MenuIcons/Notifications")?.precomposed() + public static let security = UIImage(bundleImageName: "Settings/MenuIcons/Security")?.precomposed() + public static let dataAndStorage = UIImage(bundleImageName: "Settings/MenuIcons/DataAndStorage")?.precomposed() + public static let appearance = UIImage(bundleImageName: "Settings/MenuIcons/Appearance")?.precomposed() + public static let language = UIImage(bundleImageName: "Settings/MenuIcons/Language")?.precomposed() + + public static let passport = UIImage(bundleImageName: "Settings/MenuIcons/Passport")?.precomposed() + public static let watch = UIImage(bundleImageName: "Settings/MenuIcons/Watch")?.precomposed() + + public static let support = UIImage(bundleImageName: "Settings/MenuIcons/Support")?.precomposed() + public static let faq = UIImage(bundleImageName: "Settings/MenuIcons/Faq")?.precomposed() + + public static let addAccount = UIImage(bundleImageName: "Settings/MenuIcons/AddAccount")?.precomposed() + public static let setPasscode = UIImage(bundleImageName: "Settings/MenuIcons/SetPasscode")?.precomposed() + public static let clearCache = UIImage(bundleImageName: "Settings/MenuIcons/ClearCache")?.precomposed() + public static let changePhoneNumber = UIImage(bundleImageName: "Settings/MenuIcons/ChangePhoneNumber")?.precomposed() +} diff --git a/submodules/TelegramPresentationData/Sources/WallpaperUtils.swift b/submodules/TelegramPresentationData/Sources/WallpaperUtils.swift new file mode 100644 index 0000000000..78c1a8f067 --- /dev/null +++ b/submodules/TelegramPresentationData/Sources/WallpaperUtils.swift @@ -0,0 +1,30 @@ +import Foundation +import TelegramCore + +public extension TelegramWallpaper { + public var isEmpty: Bool { + switch self { + case .image: + return false + case let .file(file): + if file.isPattern, file.settings.color == 0xffffff { + return true + } else { + return false + } + case let .color(color): + return color == 0xffffff + default: + return false + } + } + + public var isBuiltin: Bool { + switch self { + case .builtin: + return true + default: + return false + } + } +} diff --git a/submodules/TelegramPresentationData/TelegramPresentationData_Xcode.xcodeproj/project.pbxproj b/submodules/TelegramPresentationData/TelegramPresentationData_Xcode.xcodeproj/project.pbxproj index 5955d030f5..dc736b81b1 100644 --- a/submodules/TelegramPresentationData/TelegramPresentationData_Xcode.xcodeproj/project.pbxproj +++ b/submodules/TelegramPresentationData/TelegramPresentationData_Xcode.xcodeproj/project.pbxproj @@ -11,6 +11,17 @@ 0957DE1522D88B82001B4D57 /* PresentationThemeEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0957DE1422D88B82001B4D57 /* PresentationThemeEncoder.swift */; }; 0957DE1922D95E0F001B4D57 /* PresentationThemeDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0957DE1822D95E0F001B4D57 /* PresentationThemeDecoder.swift */; }; 097A581B22D528680078B73C /* PresentationThemeCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 097A581A22D528680078B73C /* PresentationThemeCodable.swift */; }; + D06017EB22F3578200796784 /* PresentationResourcesSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06017E422F3578100796784 /* PresentationResourcesSettings.swift */; }; + D06017EC22F3578200796784 /* PresentationResourcesChat.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06017E522F3578100796784 /* PresentationResourcesChat.swift */; }; + D06017ED22F3578200796784 /* PresentationResourcesCallList.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06017E622F3578100796784 /* PresentationResourcesCallList.swift */; }; + D06017EE22F3578200796784 /* PresentationResourcesRootController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06017E722F3578100796784 /* PresentationResourcesRootController.swift */; }; + D06017EF22F3578200796784 /* PresentationResourceKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06017E822F3578200796784 /* PresentationResourceKey.swift */; }; + D06017F022F3578200796784 /* PresentationResourcesChatList.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06017E922F3578200796784 /* PresentationResourcesChatList.swift */; }; + D06017F122F3578200796784 /* PresentationResourcesItemList.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06017EA22F3578200796784 /* PresentationResourcesItemList.swift */; }; + D06017F322F3583200796784 /* FrameworkSpecific.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06017F222F3583200796784 /* FrameworkSpecific.swift */; }; + D06017F522F35A4000796784 /* PresentationThemeEssentialGraphics.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06017F422F35A4000796784 /* PresentationThemeEssentialGraphics.swift */; }; + D06017F722F35A9200796784 /* ChatMessageBubbleImages.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06017F622F35A9200796784 /* ChatMessageBubbleImages.swift */; }; + D06017F922F35ACF00796784 /* WallpaperUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06017F822F35ACF00796784 /* WallpaperUtils.swift */; }; D0AE31AB22B273F20058D3BC /* TelegramPresentationData.h in Headers */ = {isa = PBXBuildFile; fileRef = D0AE31A922B273F20058D3BC /* TelegramPresentationData.h */; settings = {ATTRIBUTES = (Public, ); }; }; D0AE31B422B2746B0058D3BC /* PresentationStrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AE31B122B2746B0058D3BC /* PresentationStrings.swift */; }; D0AE31B522B2746B0058D3BC /* PresentationData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AE31B222B2746B0058D3BC /* PresentationData.swift */; }; @@ -39,6 +50,17 @@ 0957DE1422D88B82001B4D57 /* PresentationThemeEncoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PresentationThemeEncoder.swift; sourceTree = ""; }; 0957DE1822D95E0F001B4D57 /* PresentationThemeDecoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PresentationThemeDecoder.swift; sourceTree = ""; }; 097A581A22D528680078B73C /* PresentationThemeCodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PresentationThemeCodable.swift; sourceTree = ""; }; + D06017E422F3578100796784 /* PresentationResourcesSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresentationResourcesSettings.swift; sourceTree = ""; }; + D06017E522F3578100796784 /* PresentationResourcesChat.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresentationResourcesChat.swift; sourceTree = ""; }; + D06017E622F3578100796784 /* PresentationResourcesCallList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresentationResourcesCallList.swift; sourceTree = ""; }; + D06017E722F3578100796784 /* PresentationResourcesRootController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresentationResourcesRootController.swift; sourceTree = ""; }; + D06017E822F3578200796784 /* PresentationResourceKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresentationResourceKey.swift; sourceTree = ""; }; + D06017E922F3578200796784 /* PresentationResourcesChatList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresentationResourcesChatList.swift; sourceTree = ""; }; + D06017EA22F3578200796784 /* PresentationResourcesItemList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresentationResourcesItemList.swift; sourceTree = ""; }; + D06017F222F3583200796784 /* FrameworkSpecific.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FrameworkSpecific.swift; sourceTree = ""; }; + D06017F422F35A4000796784 /* PresentationThemeEssentialGraphics.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresentationThemeEssentialGraphics.swift; sourceTree = ""; }; + D06017F622F35A9200796784 /* ChatMessageBubbleImages.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChatMessageBubbleImages.swift; sourceTree = ""; }; + D06017F822F35ACF00796784 /* WallpaperUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WallpaperUtils.swift; sourceTree = ""; }; D0AE31A622B273F20058D3BC /* TelegramPresentationData.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TelegramPresentationData.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D0AE31A922B273F20058D3BC /* TelegramPresentationData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TelegramPresentationData.h; sourceTree = ""; }; D0AE31AA22B273F20058D3BC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -80,6 +102,20 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + D06017E322F3574F00796784 /* Resources */ = { + isa = PBXGroup; + children = ( + D06017E822F3578200796784 /* PresentationResourceKey.swift */, + D06017E622F3578100796784 /* PresentationResourcesCallList.swift */, + D06017E522F3578100796784 /* PresentationResourcesChat.swift */, + D06017E922F3578200796784 /* PresentationResourcesChatList.swift */, + D06017EA22F3578200796784 /* PresentationResourcesItemList.swift */, + D06017E722F3578100796784 /* PresentationResourcesRootController.swift */, + D06017E422F3578100796784 /* PresentationResourcesSettings.swift */, + ); + path = Resources; + sourceTree = ""; + }; D0AE319C22B273F20058D3BC = { isa = PBXGroup; children = ( @@ -101,6 +137,7 @@ D0AE31A822B273F20058D3BC /* Sources */ = { isa = PBXGroup; children = ( + D06017E322F3574F00796784 /* Resources */, D0AE31D122B27A780058D3BC /* DefaultDayPresentationTheme.swift */, D0AE31CE22B27A780058D3BC /* DefaultDarkPresentationTheme.swift */, D0AE31CF22B27A780058D3BC /* DefaultDarkTintedPresentationTheme.swift */, @@ -120,6 +157,10 @@ 097A581A22D528680078B73C /* PresentationThemeCodable.swift */, 0957DE1422D88B82001B4D57 /* PresentationThemeEncoder.swift */, 0957DE1822D95E0F001B4D57 /* PresentationThemeDecoder.swift */, + D06017F422F35A4000796784 /* PresentationThemeEssentialGraphics.swift */, + D06017F622F35A9200796784 /* ChatMessageBubbleImages.swift */, + D06017F822F35ACF00796784 /* WallpaperUtils.swift */, + D06017F222F3583200796784 /* FrameworkSpecific.swift */, D0AE31A922B273F20058D3BC /* TelegramPresentationData.h */, ); path = Sources; @@ -219,23 +260,34 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + D06017F122F3578200796784 /* PresentationResourcesItemList.swift in Sources */, + D06017EC22F3578200796784 /* PresentationResourcesChat.swift in Sources */, D0AE31D522B27A780058D3BC /* DefaultDayPresentationTheme.swift in Sources */, + D06017F322F3583200796784 /* FrameworkSpecific.swift in Sources */, + D06017F022F3578200796784 /* PresentationResourcesChatList.swift in Sources */, D0AE31D422B27A780058D3BC /* DefaultPresentationStrings.swift in Sources */, 097A581B22D528680078B73C /* PresentationThemeCodable.swift in Sources */, 0938677D22E0B9CB000EF19E /* MakePresentationTheme.swift in Sources */, + D06017EB22F3578200796784 /* PresentationResourcesSettings.swift in Sources */, D0AE31CB22B279D00058D3BC /* NumericFormat.swift in Sources */, + D06017F722F35A9200796784 /* ChatMessageBubbleImages.swift in Sources */, 0957DE1922D95E0F001B4D57 /* PresentationThemeDecoder.swift in Sources */, D0AE31B422B2746B0058D3BC /* PresentationStrings.swift in Sources */, D0AE321422B2826A0058D3BC /* ComponentsThemes.swift in Sources */, D0AE31C522B279720058D3BC /* StringPluralization.swift in Sources */, D0AE31CD22B279FD0058D3BC /* PresentationsResourceCache.swift in Sources */, D0AE31C922B2799B0058D3BC /* NumberPluralizationForm.m in Sources */, + D06017EF22F3578200796784 /* PresentationResourceKey.swift in Sources */, D0AE31D922B27AAF0058D3BC /* EDSunriseSet.m in Sources */, D0AE31B522B2746B0058D3BC /* PresentationData.swift in Sources */, + D06017F922F35ACF00796784 /* WallpaperUtils.swift in Sources */, D0AE31D322B27A780058D3BC /* DefaultDarkTintedPresentationTheme.swift in Sources */, D0AE31B622B2746B0058D3BC /* PresentationTheme.swift in Sources */, + D06017ED22F3578200796784 /* PresentationResourcesCallList.swift in Sources */, 0957DE1522D88B82001B4D57 /* PresentationThemeEncoder.swift in Sources */, D0AE31D222B27A780058D3BC /* DefaultDarkPresentationTheme.swift in Sources */, + D06017EE22F3578200796784 /* PresentationResourcesRootController.swift in Sources */, + D06017F522F35A4000796784 /* PresentationThemeEssentialGraphics.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/submodules/TelegramUI/TelegramUI/PresentationResourcesSettings.swift b/submodules/TelegramUI/TelegramUI/PresentationResourcesSettings.swift deleted file mode 100644 index b98eb9d519..0000000000 --- a/submodules/TelegramUI/TelegramUI/PresentationResourcesSettings.swift +++ /dev/null @@ -1,28 +0,0 @@ -import Foundation -import UIKit -import Display - -struct PresentationResourcesSettings { - static let editProfile = UIImage(bundleImageName: "Settings/MenuIcons/EditProfile")?.precomposed() - static let proxy = UIImage(bundleImageName: "Settings/MenuIcons/Proxy")?.precomposed() - static let savedMessages = UIImage(bundleImageName: "Settings/MenuIcons/SavedMessages")?.precomposed() - static let recentCalls = UIImage(bundleImageName: "Settings/MenuIcons/RecentCalls")?.precomposed() - static let stickers = UIImage(bundleImageName: "Settings/MenuIcons/Stickers")?.precomposed() - - static let notifications = UIImage(bundleImageName: "Settings/MenuIcons/Notifications")?.precomposed() - static let security = UIImage(bundleImageName: "Settings/MenuIcons/Security")?.precomposed() - static let dataAndStorage = UIImage(bundleImageName: "Settings/MenuIcons/DataAndStorage")?.precomposed() - static let appearance = UIImage(bundleImageName: "Settings/MenuIcons/Appearance")?.precomposed() - static let language = UIImage(bundleImageName: "Settings/MenuIcons/Language")?.precomposed() - - static let passport = UIImage(bundleImageName: "Settings/MenuIcons/Passport")?.precomposed() - static let watch = UIImage(bundleImageName: "Settings/MenuIcons/Watch")?.precomposed() - - static let support = UIImage(bundleImageName: "Settings/MenuIcons/Support")?.precomposed() - static let faq = UIImage(bundleImageName: "Settings/MenuIcons/Faq")?.precomposed() - - static let addAccount = UIImage(bundleImageName: "Settings/MenuIcons/AddAccount")?.precomposed() - static let setPasscode = UIImage(bundleImageName: "Settings/MenuIcons/SetPasscode")?.precomposed() - static let clearCache = UIImage(bundleImageName: "Settings/MenuIcons/ClearCache")?.precomposed() - static let changePhoneNumber = UIImage(bundleImageName: "Settings/MenuIcons/ChangePhoneNumber")?.precomposed() -}