mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Theming fixes
This commit is contained in:
parent
ad7e156466
commit
e97d2ca981
17 changed files with 3647 additions and 3587 deletions
|
|
@ -5224,3 +5224,5 @@ Any member of this group will be able to see messages in the channel.";
|
|||
"OldChannels.InactiveYear_any" = "inactive %@ years";
|
||||
|
||||
"PrivacySettings.WebSessions" = "Active Websites";
|
||||
|
||||
"Appearance.ShareThemeColor" = "Share";
|
||||
|
|
|
|||
|
|
@ -164,9 +164,9 @@ func uploadCustomWallpaper(context: AccountContext, wallpaper: WallpaperGalleryE
|
|||
}
|
||||
let accentColor = current.themeSpecificAccentColors[themeReference.index]
|
||||
if let accentColor = accentColor, accentColor.baseColor == .custom {
|
||||
themeSpecificChatWallpapers[themeReference.index &+ Int64(accentColor.index)] = wallpaper
|
||||
themeSpecificChatWallpapers[coloredThemeIndex(reference: themeReference, accentColor: accentColor)] = wallpaper
|
||||
} else {
|
||||
themeSpecificChatWallpapers[themeReference.index &+ Int64(accentColor?.index ?? 0)] = nil
|
||||
themeSpecificChatWallpapers[coloredThemeIndex(reference: themeReference, accentColor: accentColor)] = nil
|
||||
themeSpecificChatWallpapers[themeReference.index] = wallpaper
|
||||
}
|
||||
return current.withUpdatedThemeSpecificChatWallpapers(themeSpecificChatWallpapers)
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ final class ThemeAccentColorController: ViewController {
|
|||
wallpaper = coloredWallpaper
|
||||
}
|
||||
|
||||
themeSpecificChatWallpapers[currentTheme.index &+ Int64(index)] = wallpaper
|
||||
themeSpecificChatWallpapers[coloredThemeIndex(reference: currentTheme, accentColor: color)] = wallpaper
|
||||
themeSpecificCustomColors[currentTheme.index] = PresentationThemeCustomColors(colors: customColors)
|
||||
|
||||
return PresentationThemeSettings(theme: current.theme, themeSpecificAccentColors: themeSpecificAccentColors, themeSpecificCustomColors: themeSpecificCustomColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
||||
|
|
@ -321,7 +321,7 @@ final class ThemeAccentColorController: ViewController {
|
|||
}
|
||||
accentColor = themeSpecificAccentColor?.color ?? defaultDayAccentColor
|
||||
var wallpaper: TelegramWallpaper
|
||||
if let index = themeSpecificAccentColor?.index, let customWallpaper = settings.themeSpecificChatWallpapers[themeReference.index &+ Int64(index)] {
|
||||
if let accentColor = themeSpecificAccentColor, let customWallpaper = settings.themeSpecificChatWallpapers[coloredThemeIndex(reference: themeReference, accentColor: accentColor)] {
|
||||
wallpaper = customWallpaper
|
||||
} else if let customWallpaper = settings.themeSpecificChatWallpapers[themeReference.index] {
|
||||
wallpaper = customWallpaper
|
||||
|
|
|
|||
|
|
@ -188,9 +188,8 @@ final class ThemeGridController: ViewController {
|
|||
} else {
|
||||
themeReference = current.theme
|
||||
}
|
||||
let accentColorIndex = current.themeSpecificAccentColors[themeReference.index]?.index ?? 0
|
||||
themeSpecificChatWallpapers[current.theme.index] = nil
|
||||
themeSpecificChatWallpapers[current.theme.index &+ Int64(accentColorIndex)] = nil
|
||||
themeSpecificChatWallpapers[themeReference.index] = nil
|
||||
themeSpecificChatWallpapers[coloredThemeIndex(reference: themeReference, accentColor: current.themeSpecificAccentColors[themeReference.index])] = nil
|
||||
return current.withUpdatedThemeSpecificChatWallpapers(themeSpecificChatWallpapers)
|
||||
})).start()
|
||||
break
|
||||
|
|
|
|||
|
|
@ -200,6 +200,7 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||
}
|
||||
strongSelf.blurredNode.image = image
|
||||
strongSelf.blurredNode.blurView.blurRadius = 45.0
|
||||
strongSelf.ready.set(.single(true))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -248,9 +249,6 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||
signal = .complete()
|
||||
}
|
||||
strongSelf.remoteChatBackgroundNode.setSignal(signal)
|
||||
strongSelf.remoteChatBackgroundNode.imageUpdated = { [weak self] _ in
|
||||
self?.ready.set(.single(true))
|
||||
}
|
||||
|
||||
strongSelf.fetchDisposable.set(freeMediaFileInteractiveFetched(account: context.account, fileReference: .standalone(media: file.file)).start())
|
||||
|
||||
|
|
|
|||
|
|
@ -322,22 +322,28 @@ private enum ThemeSettingsControllerEntry: ItemListNodeEntry {
|
|||
return TelegramWallpaper.file(id: 0, accessHash: 0, isCreator: false, isDefault: true, isPattern: true, isDark: false, slug: slug, file: TelegramMediaFile(fileId: MediaId(namespace: 0, id: 0), partialReference: nil, resource: LocalFileMediaResource(fileId: 0), previewRepresentations: [], immediateThumbnailData: nil, mimeType: "", size: nil, attributes: []), settings: WallpaperSettings(blur: false, motion: false, color: topColor, bottomColor: bottomColor, intensity: intensity ?? 50, rotation: rotation))
|
||||
}
|
||||
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 104, baseColor: .preset, accentColor: 0x5a9e29, bubbleColors: (0xdcf8c6, nil), wallpaper: patternWallpaper("R3j69wKskFIBAAAAoUdXWCKMzCM", 0xede6dd, nil, 50, nil))))
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 106, baseColor: .preset, accentColor: 0xf55783, bubbleColors: (0xd6f5ff, nil), wallpaper: patternWallpaper("p-pXcflrmFIBAAAAvXYQk-mCwZU", 0xfce3ec, nil, 40, nil))))
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 101, baseColor: .preset, accentColor: 0x7e5fe5, bubbleColors: (0xf5e2ff, nil), wallpaper: patternWallpaper("nQcFYJe1mFIBAAAAcI95wtIK0fk", 0xfcccf4, 0xae85f0, 54, nil))))
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 102, baseColor: .preset, accentColor: 0xff5fa9, bubbleColors: (0xfff4d7, nil), wallpaper: patternWallpaper("51nnTjx8mFIBAAAAaFGJsMIvWkk", 0xf6b594, 0xebf6cd, 46, 45))))
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 103, baseColor: .preset, accentColor: 0x199972, bubbleColors: (0xfffec7, nil), wallpaper: patternWallpaper("fqv01SQemVIBAAAApND8LDRUhRU", 0xc1e7cb, nil, 50, nil))))
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 104, baseColor: .preset, accentColor: 0x5a9e29, bubbleColors: (0xdcf8c6, nil), wallpaper: patternWallpaper("R3j69wKskFIBAAAAoUdXWCKMzCM", 0xede6dd, nil, 50, nil))))
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 105, baseColor: .preset, accentColor: 0x009eee, bubbleColors: (0x94fff9, 0xccffc7), wallpaper: patternWallpaper("p-pXcflrmFIBAAAAvXYQk-mCwZU", 0xffbca6, 0xff63bd, 57, 225))))
|
||||
} else if name == .day {
|
||||
colorItems.append(.color(.blue))
|
||||
colors = colors.filter { $0 != .blue }
|
||||
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 101, baseColor: .preset, accentColor: 0x007aff, bubbleColors: (0x007aff, 0xff53f4), wallpaper: nil)))
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 102, baseColor: .preset, accentColor: 0x00b09b, bubbleColors: (0xaee946, 0x00b09b), wallpaper: nil)))
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 103, baseColor: .preset, accentColor: 0xd33213, bubbleColors: (0xf9db00, 0xd33213), wallpaper: nil)))
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 104, baseColor: .preset, accentColor: 0xea8ced, bubbleColors: (0xea8ced, 0x00c2ed), wallpaper: nil)))
|
||||
} else if name == .night {
|
||||
colorItems.append(.color(.blue))
|
||||
colors = colors.filter { $0 != .blue }
|
||||
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 101, baseColor: .preset, accentColor: 0x007aff, bubbleColors: (0x007aff, 0xff53f4), wallpaper: nil)))
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 102, baseColor: .preset, accentColor: 0x00b09b, bubbleColors: (0xaee946, 0x00b09b), wallpaper: nil)))
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 103, baseColor: .preset, accentColor: 0xd33213, bubbleColors: (0xf9db00, 0xd33213), wallpaper: nil)))
|
||||
colorItems.append(.preset(PresentationThemeAccentColor(index: 104, baseColor: .preset, accentColor: 0xea8ced, bubbleColors: (0xea8ced, 0x00c2ed), wallpaper: nil)))
|
||||
}
|
||||
if name != .day {
|
||||
colors = colors.filter { $0 != .black }
|
||||
|
|
@ -418,12 +424,6 @@ private func themeSettingsControllerEntries(presentationData: PresentationData,
|
|||
let title = presentationData.autoNightModeTriggered ? strings.Appearance_ColorThemeNight.uppercased() : strings.Appearance_ColorTheme.uppercased()
|
||||
entries.append(.themeListHeader(presentationData.theme, title))
|
||||
entries.append(.chatPreview(presentationData.theme, presentationData.theme, presentationData.chatWallpaper, presentationData.fontSize, presentationData.strings, presentationData.dateTimeFormat, presentationData.nameDisplayOrder, [ChatPreviewMessageItem(outgoing: false, reply: (presentationData.strings.Appearance_PreviewReplyAuthor, presentationData.strings.Appearance_PreviewReplyText), text: presentationData.strings.Appearance_PreviewIncomingText), ChatPreviewMessageItem(outgoing: true, reply: nil, text: presentationData.strings.Appearance_PreviewOutgoingText)]))
|
||||
|
||||
var wallpaper: TelegramWallpaper?
|
||||
if let accentColor = presentationThemeSettings.themeSpecificAccentColors[themeReference.index] {
|
||||
wallpaper = presentationThemeSettings.themeSpecificChatWallpapers[themeReference.index &+ Int64(accentColor.index)]
|
||||
}
|
||||
|
||||
entries.append(.themeItem(presentationData.theme, presentationData.strings, availableThemes, themeReference, presentationThemeSettings.themeSpecificAccentColors, presentationThemeSettings.themeSpecificChatWallpapers, presentationThemeSettings.themeSpecificAccentColors[themeReference.index]))
|
||||
|
||||
if case let .builtin(theme) = themeReference {
|
||||
|
|
@ -514,9 +514,9 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
|||
}).start()
|
||||
}, openWallpaperSettings: {
|
||||
pushControllerImpl?(ThemeGridController(context: context))
|
||||
}, selectAccentColor: { color in
|
||||
}, selectAccentColor: { accentColor in
|
||||
var wallpaperSignal: Signal<TelegramWallpaper?, NoError> = .single(nil)
|
||||
if let colorWallpaper = color?.wallpaper, case let .file(file) = colorWallpaper {
|
||||
if let colorWallpaper = accentColor?.wallpaper, case let .file(file) = colorWallpaper {
|
||||
wallpaperSignal = cachedWallpaper(account: context.account, slug: file.slug, settings: colorWallpaper.settings)
|
||||
|> mapToSignal { cachedWallpaper in
|
||||
if let wallpaper = cachedWallpaper?.wallpaper, case let .file(file) = wallpaper {
|
||||
|
|
@ -556,21 +556,21 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
|||
currentTheme = current.automaticThemeSwitchSetting.theme
|
||||
}
|
||||
|
||||
guard let theme = makePresentationTheme(mediaBox: context.sharedContext.accountManager.mediaBox, themeReference: currentTheme, accentColor: color?.color) else {
|
||||
guard let theme = makePresentationTheme(mediaBox: context.sharedContext.accountManager.mediaBox, themeReference: currentTheme, accentColor: accentColor?.color) else {
|
||||
return current
|
||||
}
|
||||
|
||||
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
||||
var themeSpecificAccentColors = current.themeSpecificAccentColors
|
||||
themeSpecificAccentColors[currentTheme.index] = color
|
||||
themeSpecificAccentColors[currentTheme.index] = accentColor
|
||||
|
||||
if case let .builtin(theme) = currentTheme {
|
||||
if let wallpaper = presetWallpaper, let color = color {
|
||||
themeSpecificChatWallpapers[currentTheme.index &+ Int64(color.index)] = wallpaper
|
||||
if let wallpaper = presetWallpaper, let color = accentColor {
|
||||
themeSpecificChatWallpapers[coloredThemeIndex(reference: currentTheme, accentColor: color)] = wallpaper
|
||||
} else if let wallpaper = current.themeSpecificChatWallpapers[currentTheme.index], wallpaper.isColorOrGradient || wallpaper.isPattern || wallpaper.isBuiltin {
|
||||
themeSpecificChatWallpapers[currentTheme.index] = nil
|
||||
if let color = color {
|
||||
themeSpecificChatWallpapers[currentTheme.index &+ Int64(color.index)] = nil
|
||||
if let accentColor = accentColor {
|
||||
themeSpecificChatWallpapers[coloredThemeIndex(reference: currentTheme, accentColor: accentColor)] = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -617,7 +617,7 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
|||
let accentColor = settings.themeSpecificAccentColors[reference.index]
|
||||
var wallpaper: TelegramWallpaper?
|
||||
if let accentColor = accentColor {
|
||||
wallpaper = settings.themeSpecificChatWallpapers[reference.index &+ Int64(accentColor.index)]
|
||||
wallpaper = settings.themeSpecificChatWallpapers[coloredThemeIndex(reference: reference, accentColor: accentColor)]
|
||||
}
|
||||
if wallpaper == nil {
|
||||
wallpaper = settings.themeSpecificChatWallpapers[reference.index]
|
||||
|
|
@ -774,7 +774,7 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
|||
let settings = transaction.getSharedData(ApplicationSpecificSharedDataKeys.presentationThemeSettings) as? PresentationThemeSettings ?? PresentationThemeSettings.defaultSettings
|
||||
var wallpaper: TelegramWallpaper?
|
||||
if let accentColor = accentColor {
|
||||
wallpaper = settings.themeSpecificChatWallpapers[reference.index &+ Int64(accentColor.index)]
|
||||
wallpaper = settings.themeSpecificChatWallpapers[coloredThemeIndex(reference: reference, accentColor: accentColor)]
|
||||
}
|
||||
if wallpaper == nil {
|
||||
wallpaper = settings.themeSpecificChatWallpapers[reference.index]
|
||||
|
|
@ -824,22 +824,18 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
|||
var themeSpecificCustomColors = current.themeSpecificCustomColors
|
||||
var customColors = themeSpecificCustomColors[themeReference.index]?.colors ?? []
|
||||
|
||||
var updatedAccentColor: PresentationThemeAccentColor
|
||||
var updatedAccentColor: PresentationThemeAccentColor?
|
||||
if let index = customColors.firstIndex(where: { $0.index == accentColor.index }) {
|
||||
if index > 0 {
|
||||
updatedAccentColor = customColors[index - 1]
|
||||
} else {
|
||||
if case let .builtin(theme) = themeReference {
|
||||
let updatedBaseColor: PresentationThemeBaseColor
|
||||
switch theme {
|
||||
case .dayClassic, .nightAccent:
|
||||
updatedBaseColor = .gray
|
||||
case .day:
|
||||
updatedBaseColor = .black
|
||||
case .night:
|
||||
updatedBaseColor = .white
|
||||
case .dayClassic:
|
||||
updatedAccentColor = nil
|
||||
case .day, .night, .nightAccent:
|
||||
updatedAccentColor = PresentationThemeAccentColor(baseColor: .blue)
|
||||
}
|
||||
updatedAccentColor = PresentationThemeAccentColor(baseColor: updatedBaseColor)
|
||||
} else {
|
||||
updatedAccentColor = PresentationThemeAccentColor(baseColor: .blue)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ class ThemeSettingsThemeItemNode: ListViewItemNode, ItemListItemNode {
|
|||
let accentColor = item.themeSpecificAccentColors[theme.index]
|
||||
var wallpaper: TelegramWallpaper?
|
||||
if let accentColor = accentColor {
|
||||
wallpaper = item.themeSpecificChatWallpapers[theme.index &+ Int64(accentColor.index)]
|
||||
wallpaper = item.themeSpecificChatWallpapers[coloredThemeIndex(reference: theme, accentColor: accentColor)]
|
||||
}
|
||||
entries.append(ThemeSettingsThemeEntry(index: index, themeReference: theme, title: title, accentColor: accentColor, selected: item.currentTheme.index == theme.index, theme: item.theme, wallpaper: wallpaper))
|
||||
index += 1
|
||||
|
|
|
|||
|
|
@ -384,9 +384,9 @@ public class WallpaperGalleryController: ViewController {
|
|||
}
|
||||
let accentColor = current.themeSpecificAccentColors[themeReference.index]
|
||||
if let accentColor = accentColor, accentColor.baseColor == .custom {
|
||||
themeSpecificChatWallpapers[themeReference.index &+ Int64(accentColor.index)] = wallpaper
|
||||
themeSpecificChatWallpapers[coloredThemeIndex(reference: themeReference, accentColor: accentColor)] = wallpaper
|
||||
} else {
|
||||
themeSpecificChatWallpapers[themeReference.index &+ Int64(accentColor?.index ?? 0)] = nil
|
||||
themeSpecificChatWallpapers[coloredThemeIndex(reference: themeReference, accentColor: accentColor)] = nil
|
||||
themeSpecificChatWallpapers[themeReference.index] = wallpaper
|
||||
}
|
||||
return current.withUpdatedThemeSpecificChatWallpapers(themeSpecificChatWallpapers)
|
||||
|
|
|
|||
|
|
@ -99,10 +99,25 @@ public func customizeDefaultDarkPresentationTheme(theme: PresentationTheme, edit
|
|||
var outgoingCheckColor: UIColor?
|
||||
|
||||
if let bubbleColors = bubbleColors {
|
||||
outgoingBubbleFillColor = bubbleColors.0
|
||||
outgoingBubbleFillGradientColor = bubbleColors.1 ?? bubbleColors.0
|
||||
var topBubbleColor = bubbleColors.0
|
||||
var bottomBubbleColor = bubbleColors.1 ?? 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outgoingBubbleFillColor = topBubbleColor
|
||||
outgoingBubbleFillGradientColor = bottomBubbleColor
|
||||
|
||||
let lightnessColor = bubbleColors.0.mixedWith(bubbleColors.1 ?? bubbleColors.0, alpha: 0.5)
|
||||
let lightnessColor = topBubbleColor.mixedWith(bottomBubbleColor, alpha: 0.5)
|
||||
if lightnessColor.lightness > 0.7 {
|
||||
outgoingPrimaryTextColor = UIColor(rgb: 0x000000)
|
||||
outgoingSecondaryTextColor = UIColor(rgb: 0x000000, alpha: 0.5)
|
||||
|
|
|
|||
|
|
@ -103,14 +103,30 @@ public func customizeDefaultDayTheme(theme: PresentationTheme, editing: Bool, ac
|
|||
var outgoingCheckColor: UIColor?
|
||||
|
||||
if !day {
|
||||
let bubbleStrokeColor = serviceBackgroundColor?.withMultiplied(hue: 0.999, saturation: 1.667, brightness: 1.1).withAlphaComponent(0.5)
|
||||
let bubbleStrokeColor = serviceBackgroundColor?.withMultiplied(hue: 0.999, saturation: 1.667, brightness: 1.1).withAlphaComponent(0.2)
|
||||
incomingBubbleStrokeColor = bubbleStrokeColor
|
||||
outgoingBubbleStrokeColor = bubbleStrokeColor
|
||||
}
|
||||
|
||||
if let bubbleColors = bubbleColors {
|
||||
outgoingBubbleFillColor = bubbleColors.0
|
||||
outgoingBubbleFillGradientColor = bubbleColors.1 ?? bubbleColors.0
|
||||
var topBubbleColor = bubbleColors.0
|
||||
var bottomBubbleColor = bubbleColors.1 ?? 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outgoingBubbleFillColor = topBubbleColor
|
||||
outgoingBubbleFillGradientColor = bottomBubbleColor
|
||||
|
||||
if day {
|
||||
outgoingBubbleStrokeColor = .clear
|
||||
}
|
||||
|
|
@ -462,7 +478,7 @@ public func makeDefaultDayPresentationTheme(serviceBackgroundColor: UIColor?, da
|
|||
onlineDotColor: UIColor(rgb: 0x4cc91f)
|
||||
)
|
||||
|
||||
let bubbleStrokeColor = serviceBackgroundColor.withMultiplied(hue: 0.999, saturation: 1.667, brightness: 1.1).withAlphaComponent(0.5)
|
||||
let bubbleStrokeColor = serviceBackgroundColor.withMultiplied(hue: 0.999, saturation: 1.667, brightness: 1.1).withAlphaComponent(0.2)
|
||||
|
||||
let message = PresentationThemeChatMessage(
|
||||
incoming: PresentationThemePartedColors(
|
||||
|
|
|
|||
|
|
@ -242,7 +242,8 @@ public func currentPresentationDataAndSettings(accountManager: AccountManager, s
|
|||
let effectiveColors = themeSettings.themeSpecificAccentColors[effectiveTheme.index]
|
||||
let theme = makePresentationTheme(mediaBox: accountManager.mediaBox, themeReference: effectiveTheme, accentColor: effectiveColors?.color, bubbleColors: effectiveColors?.customBubbleColors) ?? defaultPresentationTheme
|
||||
|
||||
let effectiveChatWallpaper: TelegramWallpaper = (themeSettings.themeSpecificChatWallpapers[effectiveTheme.index &+ Int64(effectiveColors?.index ?? 0)] ?? themeSettings.themeSpecificChatWallpapers[effectiveTheme.index]) ?? theme.chat.defaultWallpaper
|
||||
|
||||
let effectiveChatWallpaper: TelegramWallpaper = (themeSettings.themeSpecificChatWallpapers[coloredThemeIndex(reference: effectiveTheme, accentColor: effectiveColors)] ?? themeSettings.themeSpecificChatWallpapers[effectiveTheme.index]) ?? theme.chat.defaultWallpaper
|
||||
|
||||
let dateTimeFormat = currentDateTimeFormat()
|
||||
let stringsValue: PresentationStrings
|
||||
|
|
@ -507,7 +508,7 @@ public func updatedPresentationData(accountManager: AccountManager, applicationI
|
|||
let contactSettings: ContactSynchronizationSettings = sharedData.entries[ApplicationSpecificSharedDataKeys.contactSynchronizationSettings] as? ContactSynchronizationSettings ?? ContactSynchronizationSettings.defaultSettings
|
||||
|
||||
let effectiveColors = themeSettings.themeSpecificAccentColors[themeSettings.theme.index]
|
||||
let themeSpecificWallpaper = (themeSettings.themeSpecificChatWallpapers[themeSettings.theme.index &+ Int64(effectiveColors?.index ?? 0)] ?? themeSettings.themeSpecificChatWallpapers[themeSettings.theme.index])
|
||||
let themeSpecificWallpaper = (themeSettings.themeSpecificChatWallpapers[coloredThemeIndex(reference: themeSettings.theme, accentColor: effectiveColors)] ?? themeSettings.themeSpecificChatWallpapers[themeSettings.theme.index])
|
||||
|
||||
let currentWallpaper: TelegramWallpaper
|
||||
if let themeSpecificWallpaper = themeSpecificWallpaper {
|
||||
|
|
@ -533,7 +534,7 @@ public func updatedPresentationData(accountManager: AccountManager, applicationI
|
|||
if autoNightModeTriggered {
|
||||
let automaticTheme = themeSettings.automaticThemeSwitchSetting.theme
|
||||
let effectiveColors = themeSettings.themeSpecificAccentColors[automaticTheme.index]
|
||||
let themeSpecificWallpaper = (themeSettings.themeSpecificChatWallpapers[automaticTheme.index &+ Int64(effectiveColors?.index ?? 0)] ?? themeSettings.themeSpecificChatWallpapers[automaticTheme.index])
|
||||
let themeSpecificWallpaper = (themeSettings.themeSpecificChatWallpapers[coloredThemeIndex(reference: automaticTheme, accentColor: effectiveColors)] ?? themeSettings.themeSpecificChatWallpapers[automaticTheme.index])
|
||||
|
||||
if let themeSpecificWallpaper = themeSpecificWallpaper {
|
||||
effectiveChatWallpaper = themeSpecificWallpaper
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
21
submodules/TelegramUI/Images.xcassets/Settings/Spark.imageset/Contents.json
vendored
Normal file
21
submodules/TelegramUI/Images.xcassets/Settings/Spark.imageset/Contents.json
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "spark.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
submodules/TelegramUI/Images.xcassets/Settings/Spark.imageset/spark.png
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Settings/Spark.imageset/spark.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
Binary file not shown.
|
|
@ -131,10 +131,9 @@ final class WallpaperUploadManagerImpl: WallpaperUploadManager {
|
|||
} else {
|
||||
themeReference = current.theme
|
||||
}
|
||||
let accentColorIndex = current.themeSpecificAccentColors[themeReference.index]?.index ?? 0
|
||||
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
||||
themeSpecificChatWallpapers[themeReference.index] = updatedWallpaper
|
||||
themeSpecificChatWallpapers[themeReference.index &+ Int64(accentColorIndex)] = updatedWallpaper
|
||||
themeSpecificChatWallpapers[coloredThemeIndex(reference: themeReference, accentColor: current.themeSpecificAccentColors[themeReference.index])] = updatedWallpaper
|
||||
return PresentationThemeSettings(theme: current.theme, themeSpecificAccentColors: current.themeSpecificAccentColors, themeSpecificCustomColors: current.themeSpecificCustomColors, themeSpecificChatWallpapers: themeSpecificChatWallpapers, useSystemFont: current.useSystemFont, fontSize: current.fontSize, automaticThemeSwitchSetting: current.automaticThemeSwitchSetting, largeEmoji: current.largeEmoji, disableAnimations: current.disableAnimations)
|
||||
})).start()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ public enum PresentationThemeReference: PostboxCoding, Equatable {
|
|||
acc = (acc &* 20261) &+ high
|
||||
acc = (acc &* 20261) &+ low
|
||||
|
||||
return Int32(bitPattern: acc & UInt32(0x7FFFFFFF))
|
||||
return Int32(bitPattern: acc & UInt32(0x7fffffff))
|
||||
}
|
||||
|
||||
switch self {
|
||||
|
|
@ -196,6 +196,18 @@ public enum PresentationThemeReference: PostboxCoding, Equatable {
|
|||
}
|
||||
}
|
||||
|
||||
public func coloredThemeIndex(reference: PresentationThemeReference, accentColor: PresentationThemeAccentColor?) -> Int64 {
|
||||
if let accentColor = accentColor {
|
||||
if case let .builtin(theme) = reference {
|
||||
return reference.index * 1000 &+ Int64(accentColor.index)
|
||||
} else {
|
||||
return reference.index &+ Int64(accentColor.index)
|
||||
}
|
||||
} else {
|
||||
return reference.index
|
||||
}
|
||||
}
|
||||
|
||||
public enum PresentationFontSize: Int32, CaseIterable {
|
||||
case extraSmall = 0
|
||||
case small = 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue