Various theme improvements

This commit is contained in:
Ilya Laktyushin 2021-09-07 11:44:46 +03:00
parent 7998f29f4e
commit e5f15bf084
5 changed files with 11 additions and 22 deletions

View File

@ -185,27 +185,16 @@ public func customizeDefaultDayTheme(theme: PresentationTheme, specialMode: Bool
var outgoingCheckColor: UIColor?
if !day {
let bubbleStrokeColor = serviceBackgroundColor?.withMultiplied(hue: 0.999, saturation: 1.667, brightness: 1.1).withAlphaComponent(0.2)
incomingBubbleStrokeColor = bubbleStrokeColor
outgoingBubbleStrokeColor = bubbleStrokeColor
if let outgoingAccent = outgoingAccent {
outgoingBubbleStrokeColor = outgoingAccent.withAlphaComponent(0.2)
} else {
let bubbleStrokeColor = serviceBackgroundColor?.withMultiplied(hue: 0.999, saturation: 1.667, brightness: 1.1).withAlphaComponent(0.2)
incomingBubbleStrokeColor = bubbleStrokeColor
outgoingBubbleStrokeColor = bubbleStrokeColor
}
}
if !bubbleColors.isEmpty {
//var topBubbleColor = UIColor(rgb: bubbleColors[0])
//var bottomBubbleColor = UIColor(rgb: bubbleColors.last ?? bubbleColors[0])
/*if topBubbleColor.rgb != bottomBubbleColor.rgb {
let topBubbleColorLightness = topBubbleColor.lightness
let bottomBubbleColorLightness = bottomBubbleColor.lightness
if abs(topBubbleColorLightness - bottomBubbleColorLightness) > 0.7 {
if topBubbleColorLightness > bottomBubbleColorLightness {
topBubbleColor = topBubbleColor.withMultiplied(hue: 1.0, saturation: 1.0, brightness: 0.85)
} else {
bottomBubbleColor = bottomBubbleColor.withMultiplied(hue: 1.0, saturation: 1.0, brightness: 0.85)
}
}
}*/
outgoingBubbleFillColors = bubbleColors.map(UIColor.init(rgb:))
if day {

View File

@ -3920,7 +3920,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
useDarkAppearance = darkAppearancePreview
}
let customTheme = useDarkAppearance ? theme.darkTheme : theme.theme
if let settings = customTheme.settings, let theme = makePresentationTheme(settings: settings, specialMode: true) {
if let settings = customTheme.settings, let theme = makePresentationTheme(settings: settings) {
presentationData = presentationData.withUpdated(theme: theme)
presentationData = presentationData.withUpdated(chatWallpaper: theme.chat.defaultWallpaper)
}

View File

@ -1309,7 +1309,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
additionalAnimationNode?.removeFromSupernode()
}
additionalAnimationNode.frame = animationNode.frame.insetBy(dx: -animationNode.frame.width, dy: -animationNode.frame.height)
// .offsetBy(dx: incoming ? animationNode.frame.width : -animationNode.frame.width, dy: 0.0)
.offsetBy(dx: incoming ? animationNode.frame.width - 10.0 : -animationNode.frame.width + 10.0, dy: 0.0)
if incoming {
additionalAnimationNode.transform = CATransform3DMakeScale(-1.0, 1.0, 1.0)
}

View File

@ -179,7 +179,7 @@ final class ChatRecentActionsController: TelegramBaseController {
if let themeEmoticon = themeEmoticon, let theme = chatThemes.first(where: { $0.emoji == themeEmoticon }) {
let useDarkAppearance = presentationData.theme.overallDarkAppearance
let customTheme = useDarkAppearance ? theme.darkTheme : theme.theme
if let settings = customTheme.settings, let theme = makePresentationTheme(settings: settings, specialMode: true) {
if let settings = customTheme.settings, let theme = makePresentationTheme(settings: settings) {
presentationData = presentationData.withUpdated(theme: theme)
presentationData = presentationData.withUpdated(chatWallpaper: theme.chat.defaultWallpaper)
}

View File

@ -1312,7 +1312,7 @@ public func themeIconImage(account: Account, accountManager: AccountManager<Tele
themeSignal = .single(makeDefaultPresentationTheme(reference: theme, serviceBackgroundColor: nil))
} else if case let .cloud(theme) = theme, let settings = theme.theme.settings {
themeSignal = Signal { subscriber in
let theme = makePresentationTheme(mediaBox: accountManager.mediaBox, themeReference: .builtin(PresentationBuiltinThemeReference(baseTheme: settings.baseTheme)), accentColor: UIColor(argb: settings.accentColor), backgroundColors: [], bubbleColors: settings.messageColors, wallpaper: settings.wallpaper, serviceBackgroundColor: nil, specialMode: emoticon, preview: false)
let theme = makePresentationTheme(mediaBox: accountManager.mediaBox, themeReference: .builtin(PresentationBuiltinThemeReference(baseTheme: settings.baseTheme)), accentColor: UIColor(argb: settings.accentColor), backgroundColors: [], bubbleColors: settings.messageColors, wallpaper: settings.wallpaper, serviceBackgroundColor: nil, preview: false)
subscriber.putNext(theme)
subscriber.putCompletion()