mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
bd418c8689
@ -944,7 +944,7 @@ public final class ChatListContainerNode: ASDisplayNode, UIGestureRecognizerDele
|
|||||||
if value > 4.0 {
|
if value > 4.0 {
|
||||||
self.currentItemNode.startedScrollingAtUpperBound = false
|
self.currentItemNode.startedScrollingAtUpperBound = false
|
||||||
self.tempTopInset = 0.0
|
self.tempTopInset = 0.0
|
||||||
} else if value <= -94.0 {
|
} else if value <= -ChatListNavigationBar.storiesScrollHeight {
|
||||||
} else if value > -82.0 {
|
} else if value > -82.0 {
|
||||||
}
|
}
|
||||||
} else if case .unknown = offset {
|
} else if case .unknown = offset {
|
||||||
@ -958,7 +958,7 @@ public final class ChatListContainerNode: ASDisplayNode, UIGestureRecognizerDele
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
let tempTopInset: CGFloat
|
let tempTopInset: CGFloat
|
||||||
if self.currentItemNode.startedScrollingAtUpperBound {
|
if self.currentItemNode.startedScrollingAtUpperBound && !self.isInlineMode {
|
||||||
if let storySubscriptions = self.controller?.orderedStorySubscriptions, (shouldDisplayStoriesInChatListHeader(storySubscriptions: storySubscriptions) || true) {
|
if let storySubscriptions = self.controller?.orderedStorySubscriptions, (shouldDisplayStoriesInChatListHeader(storySubscriptions: storySubscriptions) || true) {
|
||||||
tempTopInset = ChatListNavigationBar.storiesScrollHeight
|
tempTopInset = ChatListNavigationBar.storiesScrollHeight
|
||||||
} else {
|
} else {
|
||||||
@ -2063,10 +2063,12 @@ final class ChatListControllerNode: ASDisplayNode, UIGestureRecognizerDelegate {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if let storySubscriptions = self.controller?.orderedStorySubscriptions, (shouldDisplayStoriesInChatListHeader(storySubscriptions: storySubscriptions) || true) {
|
if let storySubscriptions = self.controller?.orderedStorySubscriptions {
|
||||||
|
let _ = storySubscriptions
|
||||||
|
|
||||||
self.tempAllowAvatarExpansion = true
|
self.tempAllowAvatarExpansion = true
|
||||||
self.tempDisableStoriesAnimations = !animated
|
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.mainContainerNode.scrollToTop(animated: animated, adjustForTempInset: true)
|
||||||
self.tempAllowAvatarExpansion = false
|
self.tempAllowAvatarExpansion = false
|
||||||
self.tempDisableStoriesAnimations = false
|
self.tempDisableStoriesAnimations = false
|
||||||
|
@ -59,12 +59,13 @@ public func updatePeers(transaction: Transaction, peers: [Peer], update: (Peer?,
|
|||||||
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .filtered)
|
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .filtered)
|
||||||
peerIds.removeAll(where: { $0 == updated.id })
|
peerIds.removeAll(where: { $0 == updated.id })
|
||||||
transaction.replaceAllStorySubscriptions(key: .filtered, state: state, peerIds: peerIds)
|
transaction.replaceAllStorySubscriptions(key: .filtered, state: state, peerIds: peerIds)
|
||||||
}
|
|
||||||
if !transaction.storySubscriptionsContains(key: .hidden, peerId: updated.id) {
|
if !transaction.storySubscriptionsContains(key: .hidden, peerId: updated.id) {
|
||||||
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .hidden)
|
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .hidden)
|
||||||
if !peerIds.contains(updated.id) {
|
if !peerIds.contains(updated.id) {
|
||||||
peerIds.append(updated.id)
|
peerIds.append(updated.id)
|
||||||
transaction.replaceAllStorySubscriptions(key: .hidden, state: state, peerIds: peerIds)
|
transaction.replaceAllStorySubscriptions(key: .hidden, state: state, peerIds: peerIds)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -72,12 +73,13 @@ public func updatePeers(transaction: Transaction, peers: [Peer], update: (Peer?,
|
|||||||
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .hidden)
|
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .hidden)
|
||||||
peerIds.removeAll(where: { $0 == updated.id })
|
peerIds.removeAll(where: { $0 == updated.id })
|
||||||
transaction.replaceAllStorySubscriptions(key: .hidden, state: state, peerIds: peerIds)
|
transaction.replaceAllStorySubscriptions(key: .hidden, state: state, peerIds: peerIds)
|
||||||
}
|
|
||||||
if !transaction.storySubscriptionsContains(key: .filtered, peerId: updated.id) {
|
if !transaction.storySubscriptionsContains(key: .filtered, peerId: updated.id) {
|
||||||
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .filtered)
|
var (state, peerIds) = transaction.getAllStorySubscriptions(key: .filtered)
|
||||||
if !peerIds.contains(updated.id) {
|
if !peerIds.contains(updated.id) {
|
||||||
peerIds.append(updated.id)
|
peerIds.append(updated.id)
|
||||||
transaction.replaceAllStorySubscriptions(key: .filtered, state: state, peerIds: peerIds)
|
transaction.replaceAllStorySubscriptions(key: .filtered, state: state, peerIds: peerIds)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -511,7 +511,10 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
|
|||||||
secretIconColor: UIColor(rgb: 0x00b12c),
|
secretIconColor: UIColor(rgb: 0x00b12c),
|
||||||
pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x72d5fd), bottomColor: UIColor(rgb: 0x2a9ef1)), foregroundColor: UIColor(rgb: 0xffffff)),
|
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)),
|
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
|
let incomingBubbleAlpha: CGFloat = 0.9
|
||||||
|
@ -228,7 +228,8 @@ public func customizeDefaultDarkTintedPresentationTheme(theme: PresentationTheme
|
|||||||
bottomColor: accentColor?.withMultiplied(hue: 0.98, saturation: 0.268, brightness: 0.39)
|
bottomColor: accentColor?.withMultiplied(hue: 0.98, saturation: 0.268, brightness: 0.39)
|
||||||
),
|
),
|
||||||
foregroundColor: additionalBackgroundColor
|
foregroundColor: additionalBackgroundColor
|
||||||
)
|
),
|
||||||
|
storySeenColors: mainForegroundColor.flatMap { mainForegroundColor in PresentationThemeGradientColors(topColor: mainForegroundColor, bottomColor: mainForegroundColor) }
|
||||||
)
|
)
|
||||||
actionSheet = actionSheet.withUpdated(
|
actionSheet = actionSheet.withUpdated(
|
||||||
opaqueItemBackgroundColor: mainBackgroundColor,
|
opaqueItemBackgroundColor: mainBackgroundColor,
|
||||||
@ -720,7 +721,10 @@ public func makeDefaultDarkTintedPresentationTheme(extendingThemeReference: Pres
|
|||||||
secretIconColor: UIColor(rgb: 0x89df9e),
|
secretIconColor: UIColor(rgb: 0x89df9e),
|
||||||
pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x72d5fd), bottomColor: UIColor(rgb: 0x2a9ef1)), foregroundColor: .white),
|
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),
|
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)
|
let buttonStrokeColor = accentColor.withMultiplied(hue: 1.014, saturation: 0.56, brightness: 0.64).withAlphaComponent(0.15)
|
||||||
|
@ -569,7 +569,10 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio
|
|||||||
secretIconColor: UIColor(rgb: 0x00b12c),
|
secretIconColor: UIColor(rgb: 0x00b12c),
|
||||||
pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors(backgroundColors: PresentationThemeGradientColors(topColor: UIColor(rgb: 0x72d5fd), bottomColor: UIColor(rgb: 0x2a9ef1)), foregroundColor: UIColor(rgb: 0xffffff)),
|
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)),
|
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
|
let bubbleStrokeColor: UIColor
|
||||||
|
@ -591,6 +591,9 @@ public final class PresentationThemeChatList {
|
|||||||
public let pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors
|
public let pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors
|
||||||
public let unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors
|
public let unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors
|
||||||
public let onlineDotColor: UIColor
|
public let onlineDotColor: UIColor
|
||||||
|
public let storyUnseenColors: PresentationThemeGradientColors
|
||||||
|
public let storyUnseenPrivateColors: PresentationThemeGradientColors
|
||||||
|
public let storySeenColors: PresentationThemeGradientColors
|
||||||
|
|
||||||
init(
|
init(
|
||||||
backgroundColor: UIColor,
|
backgroundColor: UIColor,
|
||||||
@ -627,7 +630,10 @@ public final class PresentationThemeChatList {
|
|||||||
secretIconColor: UIColor,
|
secretIconColor: UIColor,
|
||||||
pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors,
|
pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors,
|
||||||
unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors,
|
unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors,
|
||||||
onlineDotColor: UIColor
|
onlineDotColor: UIColor,
|
||||||
|
storyUnseenColors: PresentationThemeGradientColors,
|
||||||
|
storyUnseenPrivateColors: PresentationThemeGradientColors,
|
||||||
|
storySeenColors: PresentationThemeGradientColors
|
||||||
) {
|
) {
|
||||||
self.backgroundColor = backgroundColor
|
self.backgroundColor = backgroundColor
|
||||||
self.itemSeparatorColor = itemSeparatorColor
|
self.itemSeparatorColor = itemSeparatorColor
|
||||||
@ -664,6 +670,9 @@ public final class PresentationThemeChatList {
|
|||||||
self.pinnedArchiveAvatarColor = pinnedArchiveAvatarColor
|
self.pinnedArchiveAvatarColor = pinnedArchiveAvatarColor
|
||||||
self.unpinnedArchiveAvatarColor = unpinnedArchiveAvatarColor
|
self.unpinnedArchiveAvatarColor = unpinnedArchiveAvatarColor
|
||||||
self.onlineDotColor = onlineDotColor
|
self.onlineDotColor = onlineDotColor
|
||||||
|
self.storyUnseenColors = storyUnseenColors
|
||||||
|
self.storyUnseenPrivateColors = storyUnseenPrivateColors
|
||||||
|
self.storySeenColors = storySeenColors
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withUpdated(
|
public func withUpdated(
|
||||||
@ -701,7 +710,10 @@ public final class PresentationThemeChatList {
|
|||||||
secretIconColor: UIColor? = nil,
|
secretIconColor: UIColor? = nil,
|
||||||
pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors? = nil,
|
pinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors? = nil,
|
||||||
unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors? = nil,
|
unpinnedArchiveAvatarColor: PresentationThemeArchiveAvatarColors? = nil,
|
||||||
onlineDotColor: UIColor? = nil
|
onlineDotColor: UIColor? = nil,
|
||||||
|
storyUnseenColors: PresentationThemeGradientColors? = nil,
|
||||||
|
storyUnseenPrivateColors: PresentationThemeGradientColors? = nil,
|
||||||
|
storySeenColors: PresentationThemeGradientColors? = nil
|
||||||
) -> PresentationThemeChatList {
|
) -> PresentationThemeChatList {
|
||||||
return PresentationThemeChatList(
|
return PresentationThemeChatList(
|
||||||
backgroundColor: backgroundColor ?? self.backgroundColor,
|
backgroundColor: backgroundColor ?? self.backgroundColor,
|
||||||
@ -738,7 +750,10 @@ public final class PresentationThemeChatList {
|
|||||||
secretIconColor: secretIconColor ?? self.secretIconColor,
|
secretIconColor: secretIconColor ?? self.secretIconColor,
|
||||||
pinnedArchiveAvatarColor: pinnedArchiveAvatarColor ?? self.pinnedArchiveAvatarColor,
|
pinnedArchiveAvatarColor: pinnedArchiveAvatarColor ?? self.pinnedArchiveAvatarColor,
|
||||||
unpinnedArchiveAvatarColor: unpinnedArchiveAvatarColor ?? self.unpinnedArchiveAvatarColor,
|
unpinnedArchiveAvatarColor: unpinnedArchiveAvatarColor ?? self.unpinnedArchiveAvatarColor,
|
||||||
onlineDotColor: onlineDotColor ?? self.onlineDotColor
|
onlineDotColor: onlineDotColor ?? self.onlineDotColor,
|
||||||
|
storyUnseenColors: storyUnseenColors ?? self.storyUnseenColors,
|
||||||
|
storyUnseenPrivateColors: storyUnseenPrivateColors ?? self.storyUnseenPrivateColors,
|
||||||
|
storySeenColors: storySeenColors ?? self.storySeenColors
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -995,46 +995,54 @@ extension PresentationThemeChatList: Codable {
|
|||||||
case pinnedArchiveAvatar
|
case pinnedArchiveAvatar
|
||||||
case unpinnedArchiveAvatar
|
case unpinnedArchiveAvatar
|
||||||
case onlineDot
|
case onlineDot
|
||||||
|
case storyUnseen
|
||||||
|
case storyUnseenPrivate
|
||||||
|
case storySeen
|
||||||
}
|
}
|
||||||
|
|
||||||
public convenience init(from decoder: Decoder) throws {
|
public convenience init(from decoder: Decoder) throws {
|
||||||
let values = try decoder.container(keyedBy: CodingKeys.self)
|
let values = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
let codingPath = decoder.codingPath.map { $0.stringValue }.joined(separator: ".")
|
let codingPath = decoder.codingPath.map { $0.stringValue }.joined(separator: ".")
|
||||||
self.init(backgroundColor: try decodeColor(values, .bg),
|
self.init(
|
||||||
itemSeparatorColor: try decodeColor(values, .itemSeparator),
|
backgroundColor: try decodeColor(values, .bg),
|
||||||
itemBackgroundColor: try decodeColor(values, .itemBg),
|
itemSeparatorColor: try decodeColor(values, .itemSeparator),
|
||||||
pinnedItemBackgroundColor: try decodeColor(values, .pinnedItemBg),
|
itemBackgroundColor: try decodeColor(values, .itemBg),
|
||||||
itemHighlightedBackgroundColor: try decodeColor(values, .itemHighlightedBg),
|
pinnedItemBackgroundColor: try decodeColor(values, .pinnedItemBg),
|
||||||
pinnedItemHighlightedBackgroundColor: try decodeColor(values, .pinnedItemHighlightedBg, fallbackKey: "\(codingPath).itemHighlightedBg"),
|
itemHighlightedBackgroundColor: try decodeColor(values, .itemHighlightedBg),
|
||||||
itemSelectedBackgroundColor: try decodeColor(values, .itemSelectedBg),
|
pinnedItemHighlightedBackgroundColor: try decodeColor(values, .pinnedItemHighlightedBg, fallbackKey: "\(codingPath).itemHighlightedBg"),
|
||||||
titleColor: try decodeColor(values, .title),
|
itemSelectedBackgroundColor: try decodeColor(values, .itemSelectedBg),
|
||||||
secretTitleColor: try decodeColor(values, .secretTitle),
|
titleColor: try decodeColor(values, .title),
|
||||||
dateTextColor: try decodeColor(values, .dateText),
|
secretTitleColor: try decodeColor(values, .secretTitle),
|
||||||
authorNameColor: try decodeColor(values, .authorName),
|
dateTextColor: try decodeColor(values, .dateText),
|
||||||
messageTextColor: try decodeColor(values, .messageText),
|
authorNameColor: try decodeColor(values, .authorName),
|
||||||
messageHighlightedTextColor: try decodeColor(values, .messageHighlightedText),
|
messageTextColor: try decodeColor(values, .messageText),
|
||||||
messageDraftTextColor: try decodeColor(values, .messageDraftText),
|
messageHighlightedTextColor: try decodeColor(values, .messageHighlightedText),
|
||||||
checkmarkColor: try decodeColor(values, .checkmark),
|
messageDraftTextColor: try decodeColor(values, .messageDraftText),
|
||||||
pendingIndicatorColor: try decodeColor(values, .pendingIndicator),
|
checkmarkColor: try decodeColor(values, .checkmark),
|
||||||
failedFillColor: try decodeColor(values, .failedFill),
|
pendingIndicatorColor: try decodeColor(values, .pendingIndicator),
|
||||||
failedForegroundColor: try decodeColor(values, .failedFg),
|
failedFillColor: try decodeColor(values, .failedFill),
|
||||||
muteIconColor: try decodeColor(values, .muteIcon),
|
failedForegroundColor: try decodeColor(values, .failedFg),
|
||||||
unreadBadgeActiveBackgroundColor: try decodeColor(values, .unreadBadgeActiveBg),
|
muteIconColor: try decodeColor(values, .muteIcon),
|
||||||
unreadBadgeActiveTextColor: try decodeColor(values, .unreadBadgeActiveText),
|
unreadBadgeActiveBackgroundColor: try decodeColor(values, .unreadBadgeActiveBg),
|
||||||
unreadBadgeInactiveBackgroundColor: try decodeColor(values, .unreadBadgeInactiveBg),
|
unreadBadgeActiveTextColor: try decodeColor(values, .unreadBadgeActiveText),
|
||||||
unreadBadgeInactiveTextColor: try decodeColor(values, .unreadBadgeInactiveText),
|
unreadBadgeInactiveBackgroundColor: try decodeColor(values, .unreadBadgeInactiveBg),
|
||||||
reactionBadgeActiveBackgroundColor: try decodeColor(values, .reactionBadgeActiveBg, fallbackKey: "\(codingPath).unreadBadgeActiveBg"),
|
unreadBadgeInactiveTextColor: try decodeColor(values, .unreadBadgeInactiveText),
|
||||||
pinnedBadgeColor: try decodeColor(values, .pinnedBadge),
|
reactionBadgeActiveBackgroundColor: try decodeColor(values, .reactionBadgeActiveBg, fallbackKey: "\(codingPath).unreadBadgeActiveBg"),
|
||||||
pinnedSearchBarColor: try decodeColor(values, .pinnedSearchBar),
|
pinnedBadgeColor: try decodeColor(values, .pinnedBadge),
|
||||||
regularSearchBarColor: try decodeColor(values, .regularSearchBar),
|
pinnedSearchBarColor: try decodeColor(values, .pinnedSearchBar),
|
||||||
sectionHeaderFillColor: try decodeColor(values, .sectionHeaderBg),
|
regularSearchBarColor: try decodeColor(values, .regularSearchBar),
|
||||||
sectionHeaderTextColor: try decodeColor(values, .sectionHeaderText),
|
sectionHeaderFillColor: try decodeColor(values, .sectionHeaderBg),
|
||||||
verifiedIconFillColor: try decodeColor(values, .verifiedIconBg),
|
sectionHeaderTextColor: try decodeColor(values, .sectionHeaderText),
|
||||||
verifiedIconForegroundColor: try decodeColor(values, .verifiedIconFg),
|
verifiedIconFillColor: try decodeColor(values, .verifiedIconBg),
|
||||||
secretIconColor: try decodeColor(values, .secretIcon),
|
verifiedIconForegroundColor: try decodeColor(values, .verifiedIconFg),
|
||||||
pinnedArchiveAvatarColor: try values.decode(PresentationThemeArchiveAvatarColors.self, forKey: .pinnedArchiveAvatar),
|
secretIconColor: try decodeColor(values, .secretIcon),
|
||||||
unpinnedArchiveAvatarColor: try values.decode(PresentationThemeArchiveAvatarColors.self, forKey: .unpinnedArchiveAvatar),
|
pinnedArchiveAvatarColor: try values.decode(PresentationThemeArchiveAvatarColors.self, forKey: .pinnedArchiveAvatar),
|
||||||
onlineDotColor: try decodeColor(values, .onlineDot))
|
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 {
|
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.pinnedArchiveAvatarColor, forKey: .pinnedArchiveAvatar)
|
||||||
try values.encode(self.unpinnedArchiveAvatarColor, forKey: .unpinnedArchiveAvatar)
|
try values.encode(self.unpinnedArchiveAvatarColor, forKey: .unpinnedArchiveAvatar)
|
||||||
try encodeColor(&values, self.onlineDotColor, .onlineDot)
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -947,7 +947,7 @@ public final class ChatListHeaderComponent: Component {
|
|||||||
}
|
}
|
||||||
)),
|
)),
|
||||||
environment: {},
|
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 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
|
//let storyPeerListPosition: CGFloat = storyPeerListMinOffset * (1.0 - component.storiesFraction) + storyPeerListMaxOffset * component.storiesFraction
|
||||||
|
|
||||||
|
@ -144,7 +144,9 @@ public final class ChatListNavigationBar: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static let searchScrollHeight: CGFloat = 52.0
|
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 {
|
public final class View: UIView {
|
||||||
private let backgroundView: BlurredBackgroundView
|
private let backgroundView: BlurredBackgroundView
|
||||||
@ -298,8 +300,8 @@ public final class ChatListNavigationBar: Component {
|
|||||||
self.addSubview(searchContentNode.view)
|
self.addSubview(searchContentNode.view)
|
||||||
}
|
}
|
||||||
|
|
||||||
let searchSize = CGSize(width: currentLayout.size.width, height: navigationBarSearchContentHeight)
|
let searchSize = CGSize(width: currentLayout.size.width - 6.0 * 2.0, height: navigationBarSearchContentHeight)
|
||||||
var searchFrame = CGRect(origin: CGPoint(x: 0.0, y: visibleSize.height - searchSize.height), size: searchSize)
|
var searchFrame = CGRect(origin: CGPoint(x: 6.0, y: visibleSize.height - searchSize.height), size: searchSize)
|
||||||
if component.tabsNode != nil {
|
if component.tabsNode != nil {
|
||||||
searchFrame.origin.y -= 40.0
|
searchFrame.origin.y -= 40.0
|
||||||
}
|
}
|
||||||
@ -322,9 +324,9 @@ public final class ChatListNavigationBar: Component {
|
|||||||
if allowAvatarsExpansion {
|
if allowAvatarsExpansion {
|
||||||
storiesOffsetFraction = max(0.0, min(1.0, -offset / ChatListNavigationBar.storiesScrollHeight))
|
storiesOffsetFraction = max(0.0, min(1.0, -offset / ChatListNavigationBar.storiesScrollHeight))
|
||||||
|
|
||||||
if offset <= -80.0 {
|
if offset <= -60.0 {
|
||||||
storiesUnlocked = true
|
storiesUnlocked = true
|
||||||
} else if offset >= -66.0 {
|
} else if offset >= -56.0 {
|
||||||
storiesUnlocked = false
|
storiesUnlocked = false
|
||||||
} else {
|
} else {
|
||||||
storiesUnlocked = self.storiesUnlocked
|
storiesUnlocked = self.storiesUnlocked
|
||||||
|
@ -107,25 +107,15 @@ public final class AvatarStoryIndicatorComponent: Component {
|
|||||||
let inactiveColors: [CGColor]
|
let inactiveColors: [CGColor]
|
||||||
|
|
||||||
if component.hasUnseenCloseFriendsItems {
|
if component.hasUnseenCloseFriendsItems {
|
||||||
activeColors = [
|
activeColors = [component.theme.chatList.storyUnseenPrivateColors.topColor.cgColor, component.theme.chatList.storyUnseenPrivateColors.bottomColor.cgColor]
|
||||||
UIColor(rgb: 0x7CD636).cgColor,
|
|
||||||
UIColor(rgb: 0x26B470).cgColor
|
|
||||||
]
|
|
||||||
} else {
|
} else {
|
||||||
activeColors = [
|
activeColors = [component.theme.chatList.storyUnseenColors.topColor.cgColor, component.theme.chatList.storyUnseenColors.bottomColor.cgColor]
|
||||||
UIColor(rgb: 0x34C76F).cgColor,
|
|
||||||
UIColor(rgb: 0x3DA1FD).cgColor
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if component.isGlassBackground {
|
if component.isGlassBackground {
|
||||||
inactiveColors = [UIColor(white: 1.0, alpha: 0.2).cgColor, UIColor(white: 1.0, alpha: 0.2).cgColor]
|
inactiveColors = [UIColor(white: 1.0, alpha: 0.2).cgColor, UIColor(white: 1.0, alpha: 0.2).cgColor]
|
||||||
} else {
|
} else {
|
||||||
if component.theme.overallDarkAppearance {
|
inactiveColors = [component.theme.chatList.storySeenColors.topColor.cgColor, component.theme.chatList.storySeenColors.bottomColor.cgColor]
|
||||||
inactiveColors = [component.theme.rootController.tabBar.textColor.cgColor, component.theme.rootController.tabBar.textColor.cgColor]
|
|
||||||
} else {
|
|
||||||
inactiveColors = [UIColor(rgb: 0xD8D8E1).cgColor, UIColor(rgb: 0xD8D8E1).cgColor]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var locations: [CGFloat] = [0.0, 1.0]
|
var locations: [CGFloat] = [0.0, 1.0]
|
||||||
|
@ -1224,6 +1224,8 @@ public final class StoryItemSetContainerComponent: Component {
|
|||||||
}
|
}
|
||||||
self.closeButton.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
|
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 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)
|
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)
|
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.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 let leftInfoView = self.leftInfoItem?.view.view {
|
||||||
if transitionOut.destinationIsAvatar {
|
if transitionOut.destinationIsAvatar {
|
||||||
|
@ -325,9 +325,11 @@ public final class StoryPeerListComponent: Component {
|
|||||||
|
|
||||||
private struct TitleState: Equatable {
|
private struct TitleState: Equatable {
|
||||||
var text: String
|
var text: String
|
||||||
|
var color: UIColor
|
||||||
|
|
||||||
init(text: String) {
|
init(text: String, color: UIColor) {
|
||||||
self.text = text
|
self.text = text
|
||||||
|
self.color = color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,7 +620,7 @@ public final class StoryPeerListComponent: Component {
|
|||||||
|
|
||||||
let collapsedItemWidth: CGFloat = 24.0
|
let collapsedItemWidth: CGFloat = 24.0
|
||||||
let collapsedItemDistance: CGFloat = 14.0
|
let collapsedItemDistance: CGFloat = 14.0
|
||||||
let collapsedItemOffsetY: CGFloat = -60.0
|
let collapsedItemOffsetY: CGFloat = -54.0
|
||||||
let titleContentSpacing: CGFloat = 8.0
|
let titleContentSpacing: CGFloat = 8.0
|
||||||
|
|
||||||
let collapsedItemCount: CGFloat = CGFloat(min(self.sortedItems.count - collapseStartIndex, 3))
|
let collapsedItemCount: CGFloat = CGFloat(min(self.sortedItems.count - collapseStartIndex, 3))
|
||||||
@ -1381,7 +1383,7 @@ public final class StoryPeerListComponent: Component {
|
|||||||
self.component = component
|
self.component = component
|
||||||
self.state = state
|
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 {
|
if self.titleState != updatedTitleState {
|
||||||
self.titleState = updatedTitleState
|
self.titleState = updatedTitleState
|
||||||
|
|
||||||
@ -1436,7 +1438,7 @@ public final class StoryPeerListComponent: Component {
|
|||||||
|
|
||||||
let itemLayout = ItemLayout(
|
let itemLayout = ItemLayout(
|
||||||
containerSize: availableSize,
|
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),
|
itemSize: CGSize(width: 60.0, height: 77.0),
|
||||||
itemSpacing: 24.0,
|
itemSpacing: 24.0,
|
||||||
itemCount: self.sortedItems.count
|
itemCount: self.sortedItems.count
|
||||||
|
@ -649,22 +649,12 @@ public final class StoryPeerListItemComponent: Component {
|
|||||||
|
|
||||||
if component.hasUnseen || component.ringAnimation != nil {
|
if component.hasUnseen || component.ringAnimation != nil {
|
||||||
if component.hasUnseenCloseFriendsItems {
|
if component.hasUnseenCloseFriendsItems {
|
||||||
colors = [
|
colors = [component.theme.chatList.storyUnseenPrivateColors.topColor.cgColor, component.theme.chatList.storyUnseenPrivateColors.bottomColor.cgColor]
|
||||||
UIColor(rgb: 0x7CD636).cgColor,
|
|
||||||
UIColor(rgb: 0x26B470).cgColor
|
|
||||||
]
|
|
||||||
} else {
|
} else {
|
||||||
colors = [
|
colors = [component.theme.chatList.storyUnseenColors.topColor.cgColor, component.theme.chatList.storyUnseenColors.bottomColor.cgColor]
|
||||||
UIColor(rgb: 0x34C76F).cgColor,
|
|
||||||
UIColor(rgb: 0x3DA1FD).cgColor
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if component.theme.overallDarkAppearance {
|
colors = [component.theme.chatList.storySeenColors.topColor.cgColor, component.theme.chatList.storySeenColors.bottomColor.cgColor]
|
||||||
colors = [component.theme.rootController.tabBar.textColor.cgColor, component.theme.rootController.tabBar.textColor.cgColor]
|
|
||||||
} else {
|
|
||||||
colors = [UIColor(rgb: 0xD8D8E1).cgColor, UIColor(rgb: 0xD8D8E1).cgColor]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.indicatorColorLayer.locations = locations.map { $0 as NSNumber }
|
self.indicatorColorLayer.locations = locations.map { $0 as NSNumber }
|
||||||
|
@ -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 effectiveItemsWidth: CGFloat = outerDiameter * 0.5 + CGFloat(max(0, items.count - 1)) * (outerDiameter - overflow) + outerDiameter * 0.5
|
||||||
|
|
||||||
let borderColors: [UInt32]
|
let borderColors: [UInt32]
|
||||||
if component.theme.overallDarkAppearance {
|
|
||||||
if component.hasUnseen {
|
if component.hasUnseen {
|
||||||
borderColors = [
|
borderColors = [component.theme.chatList.storyUnseenColors.topColor.argb, component.theme.chatList.storyUnseenColors.bottomColor.argb]
|
||||||
0xFF34C76F,
|
|
||||||
0xFF3DA1FD
|
|
||||||
]
|
|
||||||
} else {
|
|
||||||
borderColors = [
|
|
||||||
UIColor(white: 1.0, alpha: 0.3).argb,
|
|
||||||
UIColor(white: 1.0, alpha: 0.3).argb
|
|
||||||
]
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if component.hasUnseen {
|
borderColors = [component.theme.chatList.storySeenColors.topColor.argb, component.theme.chatList.storySeenColors.bottomColor.argb]
|
||||||
borderColors = [
|
|
||||||
0xFF34C76F,
|
|
||||||
0xFF3DA1FD
|
|
||||||
]
|
|
||||||
} else {
|
|
||||||
borderColors = [
|
|
||||||
UIColor(white: 1.0, alpha: 0.3).argb,
|
|
||||||
UIColor(white: 1.0, alpha: 0.3).argb
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let imageSize = CGSize(width: maxItemsWidth, height: outerDiameter)
|
let imageSize = CGSize(width: maxItemsWidth, height: outerDiameter)
|
||||||
|
@ -526,11 +526,18 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if preferMediaBeforeText {
|
if preferMediaBeforeText, let textString, textString.length != 0 {
|
||||||
isImage = false
|
isImage = false
|
||||||
}
|
}
|
||||||
|
|
||||||
let statusInText = !isImage
|
var statusInText = !isImage
|
||||||
|
if let textString {
|
||||||
|
if textString.length == 0 {
|
||||||
|
statusInText = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
statusInText = false
|
||||||
|
}
|
||||||
|
|
||||||
switch preparePosition {
|
switch preparePosition {
|
||||||
case .linear(_, .None), .linear(_, .Neighbour(true, _, _)):
|
case .linear(_, .None), .linear(_, .Neighbour(true, _, _)):
|
||||||
|
@ -893,7 +893,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
|
|||||||
|
|
||||||
return (resultWidth, { boundingWidth in
|
return (resultWidth, { boundingWidth in
|
||||||
var boundingSize: CGSize
|
var boundingSize: CGSize
|
||||||
let drawingSize: CGSize
|
var drawingSize: CGSize
|
||||||
|
|
||||||
switch sizeCalculation {
|
switch sizeCalculation {
|
||||||
case .constrained:
|
case .constrained:
|
||||||
@ -918,6 +918,9 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
|
|||||||
case .aspectFill:
|
case .aspectFill:
|
||||||
drawingSize = nativeSize.aspectFilled(boundingSize)
|
drawingSize = nativeSize.aspectFilled(boundingSize)
|
||||||
}
|
}
|
||||||
|
if additionalWidthConstrainment {
|
||||||
|
drawingSize.height = drawingSize.width * (1920.0 / 1080.0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case .unconstrained:
|
case .unconstrained:
|
||||||
boundingSize = constrainedSize
|
boundingSize = constrainedSize
|
||||||
|
Loading…
x
Reference in New Issue
Block a user