Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2023-07-03 14:43:06 +02:00
commit bd418c8689
16 changed files with 139 additions and 121 deletions

View File

@ -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

View File

@ -59,12 +59,13 @@ public func updatePeers(transaction: Transaction, peers: [Peer], update: (Peer?,
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .filtered)
peerIds.removeAll(where: { $0 == updated.id })
transaction.replaceAllStorySubscriptions(key: .filtered, state: state, peerIds: peerIds)
}
if !transaction.storySubscriptionsContains(key: .hidden, peerId: updated.id) {
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .hidden)
if !peerIds.contains(updated.id) {
peerIds.append(updated.id)
transaction.replaceAllStorySubscriptions(key: .hidden, state: state, peerIds: peerIds)
if !transaction.storySubscriptionsContains(key: .hidden, peerId: updated.id) {
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .hidden)
if !peerIds.contains(updated.id) {
peerIds.append(updated.id)
transaction.replaceAllStorySubscriptions(key: .hidden, state: state, peerIds: peerIds)
}
}
}
} else {
@ -72,12 +73,13 @@ public func updatePeers(transaction: Transaction, peers: [Peer], update: (Peer?,
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .hidden)
peerIds.removeAll(where: { $0 == updated.id })
transaction.replaceAllStorySubscriptions(key: .hidden, state: state, peerIds: peerIds)
}
if !transaction.storySubscriptionsContains(key: .filtered, peerId: updated.id) {
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .filtered)
if !peerIds.contains(updated.id) {
peerIds.append(updated.id)
transaction.replaceAllStorySubscriptions(key: .filtered, state: state, peerIds: peerIds)
if !transaction.storySubscriptionsContains(key: .filtered, peerId: updated.id) {
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .filtered)
if !peerIds.contains(updated.id) {
peerIds.append(updated.id)
transaction.replaceAllStorySubscriptions(key: .filtered, state: state, peerIds: peerIds)
}
}
}
}

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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
)
}
}

View File

@ -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)
}
}

View File

@ -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

View File

@ -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

View File

@ -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]

View File

@ -1224,6 +1224,8 @@ public final class StoryItemSetContainerComponent: Component {
}
self.closeButton.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
self.topContentGradientLayer.animateAlpha(from: 0.0, to: CGFloat(self.topContentGradientLayer.opacity), duration: 0.25)
let sourceLocalFrame = sourceView.convert(transitionIn.sourceRect, to: self)
let innerSourceLocalFrame = CGRect(origin: CGPoint(x: sourceLocalFrame.minX - contentContainerView.frame.minX, y: sourceLocalFrame.minY - contentContainerView.frame.minY), size: sourceLocalFrame.size)
@ -1347,6 +1349,7 @@ public final class StoryItemSetContainerComponent: Component {
closeFriendIconView.layer.animateAlpha(from: closeFriendIconView.alpha, to: 0.0, duration: 0.25, removeOnCompletion: false)
}
self.closeButton.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.25, removeOnCompletion: false)
self.topContentGradientLayer.animateAlpha(from: CGFloat(self.topContentGradientLayer.opacity), to: 0.0, duration: 0.25, removeOnCompletion: false)
if let leftInfoView = self.leftInfoItem?.view.view {
if transitionOut.destinationIsAvatar {

View File

@ -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

View File

@ -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 }

View File

@ -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)

View File

@ -526,11 +526,18 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
}
}
if preferMediaBeforeText {
if preferMediaBeforeText, let textString, textString.length != 0 {
isImage = false
}
let statusInText = !isImage
var statusInText = !isImage
if let textString {
if textString.length == 0 {
statusInText = false
}
} else {
statusInText = false
}
switch preparePosition {
case .linear(_, .None), .linear(_, .Neighbour(true, _, _)):

View File

@ -893,7 +893,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
return (resultWidth, { boundingWidth in
var boundingSize: CGSize
let drawingSize: CGSize
var drawingSize: CGSize
switch sizeCalculation {
case .constrained:
@ -918,6 +918,9 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
case .aspectFill:
drawingSize = nativeSize.aspectFilled(boundingSize)
}
if additionalWidthConstrainment {
drawingSize.height = drawingSize.width * (1920.0 / 1080.0)
}
}
case .unconstrained:
boundingSize = constrainedSize