From 52c6f20b5fde7854c9c5929639641a122e761e51 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Mon, 3 Jul 2023 14:06:55 +0200 Subject: [PATCH] Stories --- .../Sources/ChatListControllerNode.swift | 10 ++- .../DefaultDarkPresentationTheme.swift | 5 +- .../DefaultDarkTintedPresentationTheme.swift | 8 +- .../Sources/DefaultDayPresentationTheme.swift | 5 +- .../Sources/PresentationTheme.swift | 21 ++++- .../Sources/PresentationThemeCodable.swift | 81 +++++++++++-------- .../Sources/ChatListHeaderComponent.swift | 4 +- .../Sources/ChatListNavigationBar.swift | 12 +-- .../AvatarStoryIndicatorComponent.swift | 16 +--- .../Sources/StoryPeerListComponent.swift | 10 ++- .../Sources/StoryPeerListItemComponent.swift | 16 +--- .../Sources/StorySetIndicatorComponent.swift | 27 +------ 12 files changed, 109 insertions(+), 106 deletions(-) diff --git a/submodules/ChatListUI/Sources/ChatListControllerNode.swift b/submodules/ChatListUI/Sources/ChatListControllerNode.swift index d828653729..3c08069541 100644 --- a/submodules/ChatListUI/Sources/ChatListControllerNode.swift +++ b/submodules/ChatListUI/Sources/ChatListControllerNode.swift @@ -944,7 +944,7 @@ public final class ChatListContainerNode: ASDisplayNode, UIGestureRecognizerDele if value > 4.0 { self.currentItemNode.startedScrollingAtUpperBound = false self.tempTopInset = 0.0 - } else if value <= -94.0 { + } else if value <= -ChatListNavigationBar.storiesScrollHeight { } else if value > -82.0 { } } else if case .unknown = offset { @@ -958,7 +958,7 @@ public final class ChatListContainerNode: ASDisplayNode, UIGestureRecognizerDele return } let tempTopInset: CGFloat - if self.currentItemNode.startedScrollingAtUpperBound { + if self.currentItemNode.startedScrollingAtUpperBound && !self.isInlineMode { if let storySubscriptions = self.controller?.orderedStorySubscriptions, (shouldDisplayStoriesInChatListHeader(storySubscriptions: storySubscriptions) || true) { tempTopInset = ChatListNavigationBar.storiesScrollHeight } else { @@ -2063,10 +2063,12 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate { return } - if let storySubscriptions = self.controller?.orderedStorySubscriptions, (shouldDisplayStoriesInChatListHeader(storySubscriptions: storySubscriptions) || true) { + if let storySubscriptions = self.controller?.orderedStorySubscriptions { + let _ = storySubscriptions + self.tempAllowAvatarExpansion = true self.tempDisableStoriesAnimations = !animated - self.tempNavigationScrollingTransition = animated ? .animated(duration: 0.3, curve: .spring) : .immediate + self.tempNavigationScrollingTransition = animated ? .animated(duration: 0.3, curve: .custom(0.33, 0.52, 0.25, 0.99)) : .immediate self.mainContainerNode.scrollToTop(animated: animated, adjustForTempInset: true) self.tempAllowAvatarExpansion = false self.tempDisableStoriesAnimations = false diff --git a/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift index 09ed616499..c9a2e45a2b 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift @@ -511,7 +511,10 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati secretIconColor: UIColor(rgb: 0x00b12c), pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x72d5fd), bottomColor: UIColor(rgb: 0x2a9ef1)), foregroundColor: UIColor(rgb: 0xffffff)), unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x666666), bottomColor: UIColor(rgb: 0x666666)), foregroundColor: UIColor(rgb: 0x000000)), - onlineDotColor: UIColor(rgb: 0x4cc91f) + onlineDotColor: UIColor(rgb: 0x4cc91f), + storyUnseenColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x34C76F), bottomColor: UIColor(rgb: 0x3DA1FD)), + storyUnseenPrivateColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x7CD636), bottomColor: UIColor(rgb: 0x26B470)), + storySeenColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x48484A), bottomColor: UIColor(rgb: 0x48484A)) ) let incomingBubbleAlpha: CGFloat = 0.9 diff --git a/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift index 76c1c159e5..337c7188aa 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDarkTintedPresentationTheme.swift @@ -228,7 +228,8 @@ public func customizeDefaultDarkTintedPresentationTheme(theme: PresentationTheme bottomColor: accentColor?.withMultiplied(hue: 0.98, saturation: 0.268, brightness: 0.39) ), foregroundColor: additionalBackgroundColor - ) + ), + storySeenColors: mainForegroundColor.flatMap { mainForegroundColor in PresentationThemeGradientColors(topColor: mainForegroundColor, bottomColor: mainForegroundColor) } ) actionSheet = actionSheet.withUpdated( opaqueItemBackgroundColor: mainBackgroundColor, @@ -720,7 +721,10 @@ public func makeDefaultDarkTintedPresentationTheme(extendingThemeReference: Pres secretIconColor: UIColor(rgb: 0x89df9e), pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x72d5fd), bottomColor: UIColor(rgb: 0x2a9ef1)), foregroundColor: .white), unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: PresentationThemeGradientColors(topColor: accentColor.withMultiplied(hue: 0.985, saturation: 0.268, brightness: 0.47), bottomColor: accentColor.withMultiplied(hue: 0.98, saturation: 0.268, brightness: 0.39)), foregroundColor: additionalBackgroundColor), - onlineDotColor: UIColor(rgb: 0x4cc91f) + onlineDotColor: UIColor(rgb: 0x4cc91f), + storyUnseenColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x34C76F), bottomColor: UIColor(rgb: 0x3DA1FD)), + storyUnseenPrivateColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x7CD636), bottomColor: UIColor(rgb: 0x26B470)), + storySeenColors: PresentationThemeGradientColors(topColor: mainForegroundColor, bottomColor: mainForegroundColor) ) let buttonStrokeColor = accentColor.withMultiplied(hue: 1.014, saturation: 0.56, brightness: 0.64).withAlphaComponent(0.15) diff --git a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift index 714ca9940b..00c4211f45 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift @@ -569,7 +569,10 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio secretIconColor: UIColor(rgb: 0x00b12c), pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x72d5fd), bottomColor: UIColor(rgb: 0x2a9ef1)), foregroundColor: UIColor(rgb: 0xffffff)), unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0xdedee5), bottomColor: UIColor(rgb: 0xc5c6cc)), foregroundColor: UIColor(rgb: 0xffffff)), - onlineDotColor: UIColor(rgb: 0x4cc91f) + onlineDotColor: UIColor(rgb: 0x4cc91f), + storyUnseenColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x34C76F), bottomColor: UIColor(rgb: 0x3DA1FD)), + storyUnseenPrivateColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x7CD636), bottomColor: UIColor(rgb: 0x26B470)), + storySeenColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0xD8D8E1), bottomColor: UIColor(rgb: 0xD8D8E1)) ) let bubbleStrokeColor: UIColor diff --git a/submodules/TelegramPresentationData/Sources/PresentationTheme.swift b/submodules/TelegramPresentationData/Sources/PresentationTheme.swift index 42c5da6266..064c18d7b4 100644 --- a/submodules/TelegramPresentationData/Sources/PresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationTheme.swift @@ -591,6 +591,9 @@ public final class PresentationThemeChatList { public let pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors public let unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors public let onlineDotColor: UIColor + public let storyUnseenColors: PresentationThemeGradientColors + public let storyUnseenPrivateColors: PresentationThemeGradientColors + public let storySeenColors: PresentationThemeGradientColors init( backgroundColor: UIColor, @@ -627,7 +630,10 @@ public final class PresentationThemeChatList { secretIconColor: UIColor, pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors, unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors, - onlineDotColor: UIColor + onlineDotColor: UIColor, + storyUnseenColors: PresentationThemeGradientColors, + storyUnseenPrivateColors: PresentationThemeGradientColors, + storySeenColors: PresentationThemeGradientColors ) { self.backgroundColor = backgroundColor self.itemSeparatorColor = itemSeparatorColor @@ -664,6 +670,9 @@ public final class PresentationThemeChatList { self.pinnedArchiveAvatarColor = pinnedArchiveAvatarColor self.unpinnedArchiveAvatarColor = unpinnedArchiveAvatarColor self.onlineDotColor = onlineDotColor + self.storyUnseenColors = storyUnseenColors + self.storyUnseenPrivateColors = storyUnseenPrivateColors + self.storySeenColors = storySeenColors } public func withUpdated( @@ -701,7 +710,10 @@ public final class PresentationThemeChatList { secretIconColor: UIColor? = nil, pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors? = nil, unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors? = nil, - onlineDotColor: UIColor? = nil + onlineDotColor: UIColor? = nil, + storyUnseenColors: PresentationThemeGradientColors? = nil, + storyUnseenPrivateColors: PresentationThemeGradientColors? = nil, + storySeenColors: PresentationThemeGradientColors? = nil ) -> PresentationThemeChatList { return PresentationThemeChatList( backgroundColor: backgroundColor ?? self.backgroundColor, @@ -738,7 +750,10 @@ public final class PresentationThemeChatList { secretIconColor: secretIconColor ?? self.secretIconColor, pinnedArchiveAvatarColor: pinnedArchiveAvatarColor ?? self.pinnedArchiveAvatarColor, unpinnedArchiveAvatarColor: unpinnedArchiveAvatarColor ?? self.unpinnedArchiveAvatarColor, - onlineDotColor: onlineDotColor ?? self.onlineDotColor + onlineDotColor: onlineDotColor ?? self.onlineDotColor, + storyUnseenColors: storyUnseenColors ?? self.storyUnseenColors, + storyUnseenPrivateColors: storyUnseenPrivateColors ?? self.storyUnseenPrivateColors, + storySeenColors: storySeenColors ?? self.storySeenColors ) } } diff --git a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift index 4fbb4d2b63..591e5e131b 100644 --- a/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift +++ b/submodules/TelegramPresentationData/Sources/PresentationThemeCodable.swift @@ -995,46 +995,54 @@ extension PresentationThemeChatList: Codable { case pinnedArchiveAvatar case unpinnedArchiveAvatar case onlineDot + case storyUnseen + case storyUnseenPrivate + case storySeen } public convenience init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) let codingPath = decoder.codingPath.map { $0.stringValue }.joined(separator: ".") - self.init(backgroundColor: try decodeColor(values, .bg), - itemSeparatorColor: try decodeColor(values, .itemSeparator), - itemBackgroundColor: try decodeColor(values, .itemBg), - pinnedItemBackgroundColor: try decodeColor(values, .pinnedItemBg), - itemHighlightedBackgroundColor: try decodeColor(values, .itemHighlightedBg), - pinnedItemHighlightedBackgroundColor: try decodeColor(values, .pinnedItemHighlightedBg, fallbackKey: "\(codingPath).itemHighlightedBg"), - itemSelectedBackgroundColor: try decodeColor(values, .itemSelectedBg), - titleColor: try decodeColor(values, .title), - secretTitleColor: try decodeColor(values, .secretTitle), - dateTextColor: try decodeColor(values, .dateText), - authorNameColor: try decodeColor(values, .authorName), - messageTextColor: try decodeColor(values, .messageText), - messageHighlightedTextColor: try decodeColor(values, .messageHighlightedText), - messageDraftTextColor: try decodeColor(values, .messageDraftText), - checkmarkColor: try decodeColor(values, .checkmark), - pendingIndicatorColor: try decodeColor(values, .pendingIndicator), - failedFillColor: try decodeColor(values, .failedFill), - failedForegroundColor: try decodeColor(values, .failedFg), - muteIconColor: try decodeColor(values, .muteIcon), - unreadBadgeActiveBackgroundColor: try decodeColor(values, .unreadBadgeActiveBg), - unreadBadgeActiveTextColor: try decodeColor(values, .unreadBadgeActiveText), - unreadBadgeInactiveBackgroundColor: try decodeColor(values, .unreadBadgeInactiveBg), - unreadBadgeInactiveTextColor: try decodeColor(values, .unreadBadgeInactiveText), - reactionBadgeActiveBackgroundColor: try decodeColor(values, .reactionBadgeActiveBg, fallbackKey: "\(codingPath).unreadBadgeActiveBg"), - pinnedBadgeColor: try decodeColor(values, .pinnedBadge), - pinnedSearchBarColor: try decodeColor(values, .pinnedSearchBar), - regularSearchBarColor: try decodeColor(values, .regularSearchBar), - sectionHeaderFillColor: try decodeColor(values, .sectionHeaderBg), - sectionHeaderTextColor: try decodeColor(values, .sectionHeaderText), - verifiedIconFillColor: try decodeColor(values, .verifiedIconBg), - verifiedIconForegroundColor: try decodeColor(values, .verifiedIconFg), - secretIconColor: try decodeColor(values, .secretIcon), - pinnedArchiveAvatarColor: try values.decode(PresentationThemeArchiveAvatarColors.self, forKey: .pinnedArchiveAvatar), - unpinnedArchiveAvatarColor: try values.decode(PresentationThemeArchiveAvatarColors.self, forKey: .unpinnedArchiveAvatar), - onlineDotColor: try decodeColor(values, .onlineDot)) + self.init( + backgroundColor: try decodeColor(values, .bg), + itemSeparatorColor: try decodeColor(values, .itemSeparator), + itemBackgroundColor: try decodeColor(values, .itemBg), + pinnedItemBackgroundColor: try decodeColor(values, .pinnedItemBg), + itemHighlightedBackgroundColor: try decodeColor(values, .itemHighlightedBg), + pinnedItemHighlightedBackgroundColor: try decodeColor(values, .pinnedItemHighlightedBg, fallbackKey: "\(codingPath).itemHighlightedBg"), + itemSelectedBackgroundColor: try decodeColor(values, .itemSelectedBg), + titleColor: try decodeColor(values, .title), + secretTitleColor: try decodeColor(values, .secretTitle), + dateTextColor: try decodeColor(values, .dateText), + authorNameColor: try decodeColor(values, .authorName), + messageTextColor: try decodeColor(values, .messageText), + messageHighlightedTextColor: try decodeColor(values, .messageHighlightedText), + messageDraftTextColor: try decodeColor(values, .messageDraftText), + checkmarkColor: try decodeColor(values, .checkmark), + pendingIndicatorColor: try decodeColor(values, .pendingIndicator), + failedFillColor: try decodeColor(values, .failedFill), + failedForegroundColor: try decodeColor(values, .failedFg), + muteIconColor: try decodeColor(values, .muteIcon), + unreadBadgeActiveBackgroundColor: try decodeColor(values, .unreadBadgeActiveBg), + unreadBadgeActiveTextColor: try decodeColor(values, .unreadBadgeActiveText), + unreadBadgeInactiveBackgroundColor: try decodeColor(values, .unreadBadgeInactiveBg), + unreadBadgeInactiveTextColor: try decodeColor(values, .unreadBadgeInactiveText), + reactionBadgeActiveBackgroundColor: try decodeColor(values, .reactionBadgeActiveBg, fallbackKey: "\(codingPath).unreadBadgeActiveBg"), + pinnedBadgeColor: try decodeColor(values, .pinnedBadge), + pinnedSearchBarColor: try decodeColor(values, .pinnedSearchBar), + regularSearchBarColor: try decodeColor(values, .regularSearchBar), + sectionHeaderFillColor: try decodeColor(values, .sectionHeaderBg), + sectionHeaderTextColor: try decodeColor(values, .sectionHeaderText), + verifiedIconFillColor: try decodeColor(values, .verifiedIconBg), + verifiedIconForegroundColor: try decodeColor(values, .verifiedIconFg), + secretIconColor: try decodeColor(values, .secretIcon), + pinnedArchiveAvatarColor: try values.decode(PresentationThemeArchiveAvatarColors.self, forKey: .pinnedArchiveAvatar), + unpinnedArchiveAvatarColor: try values.decode(PresentationThemeArchiveAvatarColors.self, forKey: .unpinnedArchiveAvatar), + onlineDotColor: try decodeColor(values, .onlineDot), + storyUnseenColors: (try? values.decode(PresentationThemeGradientColors.self, forKey: .storyUnseen)) ?? PresentationThemeGradientColors(topColor: UIColor(rgb: 0x34C76F), bottomColor: UIColor(rgb: 0x3DA1FD)), + storyUnseenPrivateColors: (try? values.decode(PresentationThemeGradientColors.self, forKey: .storyUnseenPrivate)) ?? PresentationThemeGradientColors(topColor: UIColor(rgb: 0x7CD636), bottomColor: UIColor(rgb: 0x26B470)), + storySeenColors: (try? values.decode(PresentationThemeGradientColors.self, forKey: .storySeen)) ?? PresentationThemeGradientColors(topColor: UIColor(rgb: 0xD8D8E1), bottomColor: UIColor(rgb: 0xD8D8E1)) + ) } public func encode(to encoder: Encoder) throws { @@ -1074,6 +1082,9 @@ extension PresentationThemeChatList: Codable { try values.encode(self.pinnedArchiveAvatarColor, forKey: .pinnedArchiveAvatar) try values.encode(self.unpinnedArchiveAvatarColor, forKey: .unpinnedArchiveAvatar) try encodeColor(&values, self.onlineDotColor, .onlineDot) + try values.encode(self.storyUnseenColors, forKey: .storyUnseen) + try values.encode(self.storyUnseenPrivateColors, forKey: .storyUnseenPrivate) + try values.encode(self.storySeenColors, forKey: .storySeen) } } diff --git a/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListHeaderComponent.swift b/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListHeaderComponent.swift index f38b194b2b..1d92f733b4 100644 --- a/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListHeaderComponent.swift +++ b/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListHeaderComponent.swift @@ -947,7 +947,7 @@ public final class ChatListHeaderComponent: Component { } )), environment: {}, - containerSize: CGSize(width: availableSize.width, height: 94.0) + containerSize: CGSize(width: availableSize.width, height: ChatListNavigationBar.storiesScrollHeight) ) } @@ -1031,7 +1031,7 @@ public final class ChatListHeaderComponent: Component { } //let storyPeerListMinOffset: CGFloat = -7.0 - let storyPeerListMaxOffset: CGFloat = availableSize.height + 8.0 + let storyPeerListMaxOffset: CGFloat = availableSize.height + 2.0 //let storyPeerListPosition: CGFloat = storyPeerListMinOffset * (1.0 - component.storiesFraction) + storyPeerListMaxOffset * component.storiesFraction diff --git a/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListNavigationBar.swift b/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListNavigationBar.swift index f3473da42d..9f8317ce2c 100644 --- a/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListNavigationBar.swift +++ b/submodules/TelegramUI/Components/ChatListHeaderComponent/Sources/ChatListNavigationBar.swift @@ -144,7 +144,9 @@ public final class ChatListNavigationBar: Component { } public static let searchScrollHeight: CGFloat = 52.0 - public static let storiesScrollHeight: CGFloat = 94.0 + public static let storiesScrollHeight: CGFloat = { + return 79.0 + }() public final class View: UIView { private let backgroundView: BlurredBackgroundView @@ -298,8 +300,8 @@ public final class ChatListNavigationBar: Component { self.addSubview(searchContentNode.view) } - let searchSize = CGSize(width: currentLayout.size.width, height: navigationBarSearchContentHeight) - var searchFrame = CGRect(origin: CGPoint(x: 0.0, y: visibleSize.height - searchSize.height), size: searchSize) + let searchSize = CGSize(width: currentLayout.size.width - 6.0 * 2.0, height: navigationBarSearchContentHeight) + var searchFrame = CGRect(origin: CGPoint(x: 6.0, y: visibleSize.height - searchSize.height), size: searchSize) if component.tabsNode != nil { searchFrame.origin.y -= 40.0 } @@ -322,9 +324,9 @@ public final class ChatListNavigationBar: Component { if allowAvatarsExpansion { storiesOffsetFraction = max(0.0, min(1.0, -offset / ChatListNavigationBar.storiesScrollHeight)) - if offset <= -80.0 { + if offset <= -60.0 { storiesUnlocked = true - } else if offset >= -66.0 { + } else if offset >= -56.0 { storiesUnlocked = false } else { storiesUnlocked = self.storiesUnlocked diff --git a/submodules/TelegramUI/Components/Stories/AvatarStoryIndicatorComponent/Sources/AvatarStoryIndicatorComponent.swift b/submodules/TelegramUI/Components/Stories/AvatarStoryIndicatorComponent/Sources/AvatarStoryIndicatorComponent.swift index e6174a3c66..bb5fbb1950 100644 --- a/submodules/TelegramUI/Components/Stories/AvatarStoryIndicatorComponent/Sources/AvatarStoryIndicatorComponent.swift +++ b/submodules/TelegramUI/Components/Stories/AvatarStoryIndicatorComponent/Sources/AvatarStoryIndicatorComponent.swift @@ -107,25 +107,15 @@ public final class AvatarStoryIndicatorComponent: Component { let inactiveColors: [CGColor] if component.hasUnseenCloseFriendsItems { - activeColors = [ - UIColor(rgb: 0x7CD636).cgColor, - UIColor(rgb: 0x26B470).cgColor - ] + activeColors = [component.theme.chatList.storyUnseenPrivateColors.topColor.cgColor, component.theme.chatList.storyUnseenPrivateColors.bottomColor.cgColor] } else { - activeColors = [ - UIColor(rgb: 0x34C76F).cgColor, - UIColor(rgb: 0x3DA1FD).cgColor - ] + activeColors = [component.theme.chatList.storyUnseenColors.topColor.cgColor, component.theme.chatList.storyUnseenColors.bottomColor.cgColor] } if component.isGlassBackground { inactiveColors = [UIColor(white: 1.0, alpha: 0.2).cgColor, UIColor(white: 1.0, alpha: 0.2).cgColor] } else { - if component.theme.overallDarkAppearance { - inactiveColors = [component.theme.rootController.tabBar.textColor.cgColor, component.theme.rootController.tabBar.textColor.cgColor] - } else { - inactiveColors = [UIColor(rgb: 0xD8D8E1).cgColor, UIColor(rgb: 0xD8D8E1).cgColor] - } + inactiveColors = [component.theme.chatList.storySeenColors.topColor.cgColor, component.theme.chatList.storySeenColors.bottomColor.cgColor] } var locations: [CGFloat] = [0.0, 1.0] diff --git a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListComponent.swift b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListComponent.swift index dfce3dbe0e..580c9528cf 100644 --- a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListComponent.swift @@ -325,9 +325,11 @@ public final class StoryPeerListComponent: Component { private struct TitleState: Equatable { var text: String + var color: UIColor - init(text: String) { + init(text: String, color: UIColor) { self.text = text + self.color = color } } @@ -618,7 +620,7 @@ public final class StoryPeerListComponent: Component { let collapsedItemWidth: CGFloat = 24.0 let collapsedItemDistance: CGFloat = 14.0 - let collapsedItemOffsetY: CGFloat = -60.0 + let collapsedItemOffsetY: CGFloat = -54.0 let titleContentSpacing: CGFloat = 8.0 let collapsedItemCount: CGFloat = CGFloat(min(self.sortedItems.count - collapseStartIndex, 3)) @@ -1381,7 +1383,7 @@ public final class StoryPeerListComponent: Component { self.component = component self.state = state - let updatedTitleState = TitleState(text: component.title) + let updatedTitleState = TitleState(text: component.title, color: component.theme.rootController.navigationBar.primaryTextColor) if self.titleState != updatedTitleState { self.titleState = updatedTitleState @@ -1436,7 +1438,7 @@ public final class StoryPeerListComponent: Component { let itemLayout = ItemLayout( containerSize: availableSize, - containerInsets: UIEdgeInsets(top: 4.0, left: component.sideInset - 4.0, bottom: 0.0, right: component.sideInset - 4.0), + containerInsets: UIEdgeInsets(top: 4.0, left: component.sideInset - 6.0, bottom: 0.0, right: component.sideInset - 6.0), itemSize: CGSize(width: 60.0, height: 77.0), itemSpacing: 24.0, itemCount: self.sortedItems.count diff --git a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift index 53066a51eb..6d3d8cbae7 100644 --- a/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StoryPeerListComponent/Sources/StoryPeerListItemComponent.swift @@ -649,22 +649,12 @@ public final class StoryPeerListItemComponent: Component { if component.hasUnseen || component.ringAnimation != nil { if component.hasUnseenCloseFriendsItems { - colors = [ - UIColor(rgb: 0x7CD636).cgColor, - UIColor(rgb: 0x26B470).cgColor - ] + colors = [component.theme.chatList.storyUnseenPrivateColors.topColor.cgColor, component.theme.chatList.storyUnseenPrivateColors.bottomColor.cgColor] } else { - colors = [ - UIColor(rgb: 0x34C76F).cgColor, - UIColor(rgb: 0x3DA1FD).cgColor - ] + colors = [component.theme.chatList.storyUnseenColors.topColor.cgColor, component.theme.chatList.storyUnseenColors.bottomColor.cgColor] } } else { - if component.theme.overallDarkAppearance { - colors = [component.theme.rootController.tabBar.textColor.cgColor, component.theme.rootController.tabBar.textColor.cgColor] - } else { - colors = [UIColor(rgb: 0xD8D8E1).cgColor, UIColor(rgb: 0xD8D8E1).cgColor] - } + colors = [component.theme.chatList.storySeenColors.topColor.cgColor, component.theme.chatList.storySeenColors.bottomColor.cgColor] } self.indicatorColorLayer.locations = locations.map { $0 as NSNumber } diff --git a/submodules/TelegramUI/Components/Stories/StorySetIndicatorComponent/Sources/StorySetIndicatorComponent.swift b/submodules/TelegramUI/Components/Stories/StorySetIndicatorComponent/Sources/StorySetIndicatorComponent.swift index 767f2cf56b..47141b8e51 100644 --- a/submodules/TelegramUI/Components/Stories/StorySetIndicatorComponent/Sources/StorySetIndicatorComponent.swift +++ b/submodules/TelegramUI/Components/Stories/StorySetIndicatorComponent/Sources/StorySetIndicatorComponent.swift @@ -341,30 +341,11 @@ public final class StorySetIndicatorComponent: Component { let effectiveItemsWidth: CGFloat = outerDiameter * 0.5 + CGFloat(max(0, items.count - 1)) * (outerDiameter - overflow) + outerDiameter * 0.5 let borderColors: [UInt32] - if component.theme.overallDarkAppearance { - if component.hasUnseen { - borderColors = [ - 0xFF34C76F, - 0xFF3DA1FD - ] - } else { - borderColors = [ - UIColor(white: 1.0, alpha: 0.3).argb, - UIColor(white: 1.0, alpha: 0.3).argb - ] - } + + if component.hasUnseen { + borderColors = [component.theme.chatList.storyUnseenColors.topColor.argb, component.theme.chatList.storyUnseenColors.bottomColor.argb] } else { - if component.hasUnseen { - borderColors = [ - 0xFF34C76F, - 0xFF3DA1FD - ] - } else { - borderColors = [ - UIColor(white: 1.0, alpha: 0.3).argb, - UIColor(white: 1.0, alpha: 0.3).argb - ] - } + borderColors = [component.theme.chatList.storySeenColors.topColor.argb, component.theme.chatList.storySeenColors.bottomColor.argb] } let imageSize = CGSize(width: maxItemsWidth, height: outerDiameter)