Comments update

This commit is contained in:
Ali 2020-09-18 21:09:24 +04:00
parent e31f0f0cca
commit f3fabd8bcd
24 changed files with 143 additions and 36 deletions

View File

@ -0,0 +1,22 @@
load("//Config:buck_rule_macros.bzl", "static_library")
static_library(
name = "ChatListFilterSettingsHeaderItem",
srcs = glob([
"Sources/**/*.swift",
]),
deps = [
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared",
"//submodules/AsyncDisplayKit:AsyncDisplayKit#shared",
"//submodules/Display:Display#shared",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/ItemListUI:ItemListUI",
"//submodules/PresentationDataUtils:PresentationDataUtils",
"//submodules/AnimatedStickerNode:AnimatedStickerNode",
"//submodules/AppBundle:AppBundle",
],
frameworks = [
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
"$SDKROOT/System/Library/Frameworks/UIKit.framework",
],
)

View File

@ -0,0 +1,22 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "ChatListFilterSettingsHeaderItem",
module_name = "ChatListFilterSettingsHeaderItem",
srcs = glob([
"Sources/**/*.swift",
]),
deps = [
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
"//submodules/Display:Display",
"//submodules/TelegramPresentationData:TelegramPresentationData",
"//submodules/ItemListUI:ItemListUI",
"//submodules/PresentationDataUtils:PresentationDataUtils",
"//submodules/AnimatedStickerNode:AnimatedStickerNode",
"//submodules/AppBundle:AppBundle",
],
visibility = [
"//visibility:public",
],
)

View File

@ -9,25 +9,26 @@ import PresentationDataUtils
import AnimatedStickerNode import AnimatedStickerNode
import AppBundle import AppBundle
enum ChatListFilterSettingsHeaderAnimation { public enum ChatListFilterSettingsHeaderAnimation {
case folders case folders
case newFolder case newFolder
case discussionGroupSetup
} }
class ChatListFilterSettingsHeaderItem: ListViewItem, ItemListItem { public class ChatListFilterSettingsHeaderItem: ListViewItem, ItemListItem {
let theme: PresentationTheme let theme: PresentationTheme
let text: String let text: String
let animation: ChatListFilterSettingsHeaderAnimation let animation: ChatListFilterSettingsHeaderAnimation
let sectionId: ItemListSectionId public let sectionId: ItemListSectionId
init(theme: PresentationTheme, text: String, animation: ChatListFilterSettingsHeaderAnimation, sectionId: ItemListSectionId) { public init(theme: PresentationTheme, text: String, animation: ChatListFilterSettingsHeaderAnimation, sectionId: ItemListSectionId) {
self.theme = theme self.theme = theme
self.text = text self.text = text
self.animation = animation self.animation = animation
self.sectionId = sectionId self.sectionId = sectionId
} }
func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) { public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) {
async { async {
let node = ChatListFilterSettingsHeaderItemNode() let node = ChatListFilterSettingsHeaderItemNode()
let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem)) let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem))
@ -43,7 +44,7 @@ class ChatListFilterSettingsHeaderItem: ListViewItem, ItemListItem {
} }
} }
func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) { public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
Queue.mainQueue().async { Queue.mainQueue().async {
guard let nodeValue = node() as? ChatListFilterSettingsHeaderItemNode else { guard let nodeValue = node() as? ChatListFilterSettingsHeaderItemNode else {
assertionFailure() assertionFailure()
@ -124,6 +125,8 @@ class ChatListFilterSettingsHeaderItemNode: ListViewItemNode {
animationName = "ChatListFolders" animationName = "ChatListFolders"
case .newFolder: case .newFolder:
animationName = "ChatListNewFolder" animationName = "ChatListNewFolder"
case .discussionGroupSetup:
animationName = "DiscussionGroupSetup"
} }
if let path = getAppBundle().path(forResource: animationName, ofType: "tgs") { if let path = getAppBundle().path(forResource: animationName, ofType: "tgs") {
strongSelf.animationNode.setup(source: AnimatedStickerNodeLocalFileSource(path: path), width: 192, height: 192, playbackMode: .once, mode: .direct(cachePathPrefix: nil)) strongSelf.animationNode.setup(source: AnimatedStickerNodeLocalFileSource(path: path), width: 192, height: 192, playbackMode: .once, mode: .direct(cachePathPrefix: nil))

View File

@ -55,6 +55,7 @@ static_library(
"//submodules/ListSectionHeaderNode:ListSectionHeaderNode", "//submodules/ListSectionHeaderNode:ListSectionHeaderNode",
"//submodules/ChatInterfaceState:ChatInterfaceState", "//submodules/ChatInterfaceState:ChatInterfaceState",
"//submodules/GridMessageSelectionNode:GridMessageSelectionNode", "//submodules/GridMessageSelectionNode:GridMessageSelectionNode",
"//submodules/ChatListFilterSettingsHeaderItem:ChatListFilterSettingsHeaderItem",
], ],
frameworks = [ frameworks = [
"$SDKROOT/System/Library/Frameworks/Foundation.framework", "$SDKROOT/System/Library/Frameworks/Foundation.framework",

View File

@ -55,6 +55,7 @@ swift_library(
"//submodules/ChatInterfaceState:ChatInterfaceState", "//submodules/ChatInterfaceState:ChatInterfaceState",
"//submodules/ShareController:ShareController", "//submodules/ShareController:ShareController",
"//submodules/GridMessageSelectionNode:GridMessageSelectionNode", "//submodules/GridMessageSelectionNode:GridMessageSelectionNode",
"//submodules/ChatListFilterSettingsHeaderItem:ChatListFilterSettingsHeaderItem",
], ],
visibility = [ visibility = [
"//visibility:public", "//visibility:public",

View File

@ -13,6 +13,7 @@ import TelegramUIPreferences
import ItemListPeerItem import ItemListPeerItem
import ItemListPeerActionItem import ItemListPeerActionItem
import AvatarNode import AvatarNode
import ChatListFilterSettingsHeaderItem
private enum FilterSection: Int32, Hashable { private enum FilterSection: Int32, Hashable {
case include case include

View File

@ -10,6 +10,7 @@ import TelegramUIPreferences
import ItemListUI import ItemListUI
import AccountContext import AccountContext
import ItemListPeerActionItem import ItemListPeerActionItem
import ChatListFilterSettingsHeaderItem
private final class ChatListFilterPresetListControllerArguments { private final class ChatListFilterPresetListControllerArguments {
let context: AccountContext let context: AccountContext

View File

@ -555,7 +555,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
let propertyAnimator = propertyAnimator as? UIViewPropertyAnimator let propertyAnimator = propertyAnimator as? UIViewPropertyAnimator
propertyAnimator?.stopAnimation(true) propertyAnimator?.stopAnimation(true)
} }
self.effectView.effect = makeCustomZoomBlurEffect() self.effectView.effect = makeCustomZoomBlurEffect(isLight: !self.presentationData.theme.overallDarkAppearance)
self.effectView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2 * animationDurationFactor) self.effectView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2 * animationDurationFactor)
self.propertyAnimator = UIViewPropertyAnimator(duration: 0.2 * animationDurationFactor * UIView.animationDurationFactor(), curve: .easeInOut, animations: { self.propertyAnimator = UIViewPropertyAnimator(duration: 0.2 * animationDurationFactor * UIView.animationDurationFactor(), curve: .easeInOut, animations: {
}) })
@ -573,7 +573,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
} }
} else { } else {
UIView.animate(withDuration: 0.2 * animationDurationFactor, animations: { UIView.animate(withDuration: 0.2 * animationDurationFactor, animations: {
self.effectView.effect = makeCustomZoomBlurEffect() self.effectView.effect = makeCustomZoomBlurEffect(isLight: !self.presentationData.theme.overallDarkAppearance)
}, completion: { [weak self] _ in }, completion: { [weak self] _ in
self?.didCompleteAnimationIn = true self?.didCompleteAnimationIn = true
self?.actionsContainerNode.animateIn() self?.actionsContainerNode.animateIn()
@ -1082,7 +1082,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
propertyAnimator?.stopAnimation(true) propertyAnimator?.stopAnimation(true)
} }
} }
self.effectView.effect = makeCustomZoomBlurEffect() self.effectView.effect = makeCustomZoomBlurEffect(isLight: !self.presentationData.theme.overallDarkAppearance)
self.dimNode.alpha = 1.0 self.dimNode.alpha = 1.0
} }
self.dimNode.isHidden = false self.dimNode.isHidden = false

View File

@ -19,8 +19,8 @@ public func springAnimationValueAt(_ animation: CABasicAnimation, _ t: CGFloat)
return springAnimationValueAtImpl(animation, t) return springAnimationValueAtImpl(animation, t)
} }
public func makeCustomZoomBlurEffect() -> UIBlurEffect? { public func makeCustomZoomBlurEffect(isLight: Bool) -> UIBlurEffect? {
return makeCustomZoomBlurEffectImpl() return makeCustomZoomBlurEffectImpl(isLight)
} }
public func applySmoothRoundedCorners(_ layer: CALayer) { public func applySmoothRoundedCorners(_ layer: CALayer) {

View File

@ -65,6 +65,7 @@ static_library(
"//submodules/SolidRoundedButtonNode:SolidRoundedButtonNode", "//submodules/SolidRoundedButtonNode:SolidRoundedButtonNode",
"//submodules/ChatListSearchItemHeader:ChatListSearchItemHeader", "//submodules/ChatListSearchItemHeader:ChatListSearchItemHeader",
"//submodules/StatisticsUI:StatisticsUI", "//submodules/StatisticsUI:StatisticsUI",
"//submodules/ChatListFilterSettingsHeaderItem:ChatListFilterSettingsHeaderItem",
], ],
frameworks = [ frameworks = [
"$SDKROOT/System/Library/Frameworks/Foundation.framework", "$SDKROOT/System/Library/Frameworks/Foundation.framework",

View File

@ -66,6 +66,7 @@ swift_library(
"//submodules/SolidRoundedButtonNode:SolidRoundedButtonNode", "//submodules/SolidRoundedButtonNode:SolidRoundedButtonNode",
"//submodules/ChatListSearchItemHeader:ChatListSearchItemHeader", "//submodules/ChatListSearchItemHeader:ChatListSearchItemHeader",
"//submodules/StatisticsUI:StatisticsUI", "//submodules/StatisticsUI:StatisticsUI",
"//submodules/ChatListFilterSettingsHeaderItem:ChatListFilterSettingsHeaderItem",
], ],
visibility = [ visibility = [
"//visibility:public", "//visibility:public",

View File

@ -15,6 +15,7 @@ import AlertUI
import PresentationDataUtils import PresentationDataUtils
import ItemListPeerItem import ItemListPeerItem
import ItemListPeerActionItem import ItemListPeerActionItem
import ChatListFilterSettingsHeaderItem
private final class ChannelDiscussionGroupSetupControllerArguments { private final class ChannelDiscussionGroupSetupControllerArguments {
let context: AccountContext let context: AccountContext
@ -131,8 +132,18 @@ private enum ChannelDiscussionGroupSetupControllerEntry: ItemListNodeEntry {
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem { func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
let arguments = arguments as! ChannelDiscussionGroupSetupControllerArguments let arguments = arguments as! ChannelDiscussionGroupSetupControllerArguments
switch self { switch self {
case let .header(theme, strings, title, isGroup, label): case let .header(_, _, title, isGroup, _):
return ChannelDiscussionGroupSetupHeaderItem(theme: theme, strings: strings, title: title, isGroup: isGroup, label: label, sectionId: self.section) let text: String
if let title = title {
if isGroup {
text = presentationData.strings.Channel_DiscussionGroup_HeaderGroupSet(title).0
} else {
text = presentationData.strings.Channel_DiscussionGroup_HeaderSet(title).0
}
} else {
text = ""
}
return ChatListFilterSettingsHeaderItem(theme: presentationData.theme, text: text, animation: .discussionGroupSetup, sectionId: self.section)
case let .create(theme, text): case let .create(theme, text):
return ItemListPeerActionItem(presentationData: presentationData, icon: PresentationResourcesItemList.plusIconImage(theme), title: text, sectionId: self.section, editing: false, action: { return ItemListPeerActionItem(presentationData: presentationData, icon: PresentationResourcesItemList.plusIconImage(theme), title: text, sectionId: self.section, editing: false, action: {
arguments.createGroup() arguments.createGroup()

View File

@ -306,7 +306,10 @@ final class TabBarAccountSwitchControllerNode: ViewControllerTracingNode {
propertyAnimator?.stopAnimation(true) propertyAnimator?.stopAnimation(true)
} }
self.propertyAnimator = UIViewPropertyAnimator(duration: 0.2 * animationDurationFactor, curve: .easeInOut, animations: { [weak self] in self.propertyAnimator = UIViewPropertyAnimator(duration: 0.2 * animationDurationFactor, curve: .easeInOut, animations: { [weak self] in
self?.effectView.effect = makeCustomZoomBlurEffect() guard let strongSelf = self else {
return
}
strongSelf.effectView.effect = makeCustomZoomBlurEffect(isLight: !strongSelf.presentationData.theme.overallDarkAppearance)
}) })
} }
@ -319,7 +322,7 @@ final class TabBarAccountSwitchControllerNode: ViewControllerTracingNode {
} }
} else { } else {
UIView.animate(withDuration: 0.2 * animationDurationFactor, animations: { UIView.animate(withDuration: 0.2 * animationDurationFactor, animations: {
self.effectView.effect = makeCustomZoomBlurEffect() self.effectView.effect = makeCustomZoomBlurEffect(isLight: !self.presentationData.theme.overallDarkAppearance)
}, completion: { _ in }, completion: { _ in
}) })
} }

View File

@ -255,7 +255,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[643940105] = { return Api.Update.parse_updatePhoneCallSignalingData($0) } dict[643940105] = { return Api.Update.parse_updatePhoneCallSignalingData($0) }
dict[1708307556] = { return Api.Update.parse_updateChannelParticipant($0) } dict[1708307556] = { return Api.Update.parse_updateChannelParticipant($0) }
dict[1854571743] = { return Api.Update.parse_updateChannelMessageForwards($0) } dict[1854571743] = { return Api.Update.parse_updateChannelMessageForwards($0) }
dict[-966672061] = { return Api.Update.parse_updateReadChannelDiscussionInbox($0) } dict[482860628] = { return Api.Update.parse_updateReadChannelDiscussionInbox($0) }
dict[1178116716] = { return Api.Update.parse_updateReadChannelDiscussionOutbox($0) } dict[1178116716] = { return Api.Update.parse_updateReadChannelDiscussionOutbox($0) }
dict[610945826] = { return Api.Update.parse_updatePeerBlocked($0) } dict[610945826] = { return Api.Update.parse_updatePeerBlocked($0) }
dict[-13975905] = { return Api.Update.parse_updateChannelUserTyping($0) } dict[-13975905] = { return Api.Update.parse_updateChannelUserTyping($0) }

View File

@ -6236,7 +6236,7 @@ public extension Api {
case updatePhoneCallSignalingData(phoneCallId: Int64, data: Buffer) case updatePhoneCallSignalingData(phoneCallId: Int64, data: Buffer)
case updateChannelParticipant(flags: Int32, channelId: Int32, date: Int32, userId: Int32, prevParticipant: Api.ChannelParticipant?, newParticipant: Api.ChannelParticipant?, qts: Int32) case updateChannelParticipant(flags: Int32, channelId: Int32, date: Int32, userId: Int32, prevParticipant: Api.ChannelParticipant?, newParticipant: Api.ChannelParticipant?, qts: Int32)
case updateChannelMessageForwards(channelId: Int32, id: Int32, forwards: Int32) case updateChannelMessageForwards(channelId: Int32, id: Int32, forwards: Int32)
case updateReadChannelDiscussionInbox(channelId: Int32, topMsgId: Int32, readMaxId: Int32) case updateReadChannelDiscussionInbox(flags: Int32, channelId: Int32, topMsgId: Int32, readMaxId: Int32, broadcastId: Int32?, broadcastPost: Int32?)
case updateReadChannelDiscussionOutbox(channelId: Int32, topMsgId: Int32, readMaxId: Int32) case updateReadChannelDiscussionOutbox(channelId: Int32, topMsgId: Int32, readMaxId: Int32)
case updatePeerBlocked(peerId: Api.Peer, blocked: Api.Bool) case updatePeerBlocked(peerId: Api.Peer, blocked: Api.Bool)
case updateChannelUserTyping(flags: Int32, channelId: Int32, topMsgId: Int32?, userId: Int32, action: Api.SendMessageAction) case updateChannelUserTyping(flags: Int32, channelId: Int32, topMsgId: Int32?, userId: Int32, action: Api.SendMessageAction)
@ -6934,13 +6934,16 @@ public extension Api {
serializeInt32(id, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false)
serializeInt32(forwards, buffer: buffer, boxed: false) serializeInt32(forwards, buffer: buffer, boxed: false)
break break
case .updateReadChannelDiscussionInbox(let channelId, let topMsgId, let readMaxId): case .updateReadChannelDiscussionInbox(let flags, let channelId, let topMsgId, let readMaxId, let broadcastId, let broadcastPost):
if boxed { if boxed {
buffer.appendInt32(-966672061) buffer.appendInt32(482860628)
} }
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(channelId, buffer: buffer, boxed: false) serializeInt32(channelId, buffer: buffer, boxed: false)
serializeInt32(topMsgId, buffer: buffer, boxed: false) serializeInt32(topMsgId, buffer: buffer, boxed: false)
serializeInt32(readMaxId, buffer: buffer, boxed: false) serializeInt32(readMaxId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(broadcastId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(broadcastPost!, buffer: buffer, boxed: false)}
break break
case .updateReadChannelDiscussionOutbox(let channelId, let topMsgId, let readMaxId): case .updateReadChannelDiscussionOutbox(let channelId, let topMsgId, let readMaxId):
if boxed { if boxed {
@ -7144,8 +7147,8 @@ public extension Api {
return ("updateChannelParticipant", [("flags", flags), ("channelId", channelId), ("date", date), ("userId", userId), ("prevParticipant", prevParticipant), ("newParticipant", newParticipant), ("qts", qts)]) return ("updateChannelParticipant", [("flags", flags), ("channelId", channelId), ("date", date), ("userId", userId), ("prevParticipant", prevParticipant), ("newParticipant", newParticipant), ("qts", qts)])
case .updateChannelMessageForwards(let channelId, let id, let forwards): case .updateChannelMessageForwards(let channelId, let id, let forwards):
return ("updateChannelMessageForwards", [("channelId", channelId), ("id", id), ("forwards", forwards)]) return ("updateChannelMessageForwards", [("channelId", channelId), ("id", id), ("forwards", forwards)])
case .updateReadChannelDiscussionInbox(let channelId, let topMsgId, let readMaxId): case .updateReadChannelDiscussionInbox(let flags, let channelId, let topMsgId, let readMaxId, let broadcastId, let broadcastPost):
return ("updateReadChannelDiscussionInbox", [("channelId", channelId), ("topMsgId", topMsgId), ("readMaxId", readMaxId)]) return ("updateReadChannelDiscussionInbox", [("flags", flags), ("channelId", channelId), ("topMsgId", topMsgId), ("readMaxId", readMaxId), ("broadcastId", broadcastId), ("broadcastPost", broadcastPost)])
case .updateReadChannelDiscussionOutbox(let channelId, let topMsgId, let readMaxId): case .updateReadChannelDiscussionOutbox(let channelId, let topMsgId, let readMaxId):
return ("updateReadChannelDiscussionOutbox", [("channelId", channelId), ("topMsgId", topMsgId), ("readMaxId", readMaxId)]) return ("updateReadChannelDiscussionOutbox", [("channelId", channelId), ("topMsgId", topMsgId), ("readMaxId", readMaxId)])
case .updatePeerBlocked(let peerId, let blocked): case .updatePeerBlocked(let peerId, let blocked):
@ -8540,11 +8543,20 @@ public extension Api {
_2 = reader.readInt32() _2 = reader.readInt32()
var _3: Int32? var _3: Int32?
_3 = reader.readInt32() _3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt32() }
var _6: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_6 = reader.readInt32() }
let _c1 = _1 != nil let _c1 = _1 != nil
let _c2 = _2 != nil let _c2 = _2 != nil
let _c3 = _3 != nil let _c3 = _3 != nil
if _c1 && _c2 && _c3 { let _c4 = _4 != nil
return Api.Update.updateReadChannelDiscussionInbox(channelId: _1!, topMsgId: _2!, readMaxId: _3!) let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.Update.updateReadChannelDiscussionInbox(flags: _1!, channelId: _2!, topMsgId: _3!, readMaxId: _4!, broadcastId: _5, broadcastPost: _6)
} }
else { else {
return nil return nil

View File

@ -108,7 +108,7 @@ enum AccountStateMutationOperation {
case SyncChatListFilters case SyncChatListFilters
case UpdateChatListFilterOrder(order: [Int32]) case UpdateChatListFilterOrder(order: [Int32])
case UpdateChatListFilter(id: Int32, filter: Api.DialogFilter?) case UpdateChatListFilter(id: Int32, filter: Api.DialogFilter?)
case UpdateReadThread(threadMessageId: MessageId, readMaxId: Int32, isIncoming: Bool) case UpdateReadThread(threadMessageId: MessageId, readMaxId: Int32, isIncoming: Bool, mainChannelMessage: MessageId?)
} }
struct HoleFromPreviousState { struct HoleFromPreviousState {
@ -271,8 +271,8 @@ struct AccountMutableState {
self.addOperation(.ReadOutbox(messageId, timestamp)) self.addOperation(.ReadOutbox(messageId, timestamp))
} }
mutating func readThread(threadMessageId: MessageId, readMaxId: Int32, isIncoming: Bool) { mutating func readThread(threadMessageId: MessageId, readMaxId: Int32, isIncoming: Bool, mainChannelMessage: MessageId?) {
self.addOperation(.UpdateReadThread(threadMessageId: threadMessageId, readMaxId: readMaxId, isIncoming: isIncoming)) self.addOperation(.UpdateReadThread(threadMessageId: threadMessageId, readMaxId: readMaxId, isIncoming: isIncoming, mainChannelMessage: mainChannelMessage))
} }
mutating func readGroupFeedInbox(groupId: PeerGroupId, index: MessageIndex) { mutating func readGroupFeedInbox(groupId: PeerGroupId, index: MessageIndex) {

View File

@ -989,6 +989,14 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
updatedState.resetIncomingReadState(groupId: PeerGroupId(rawValue: folderId ?? 0), peerId: peer.peerId, namespace: Namespaces.Message.Cloud, maxIncomingReadId: maxId, count: stillUnreadCount, pts: pts) updatedState.resetIncomingReadState(groupId: PeerGroupId(rawValue: folderId ?? 0), peerId: peer.peerId, namespace: Namespaces.Message.Cloud, maxIncomingReadId: maxId, count: stillUnreadCount, pts: pts)
case let .updateReadHistoryOutbox(peer, maxId, _, _): case let .updateReadHistoryOutbox(peer, maxId, _, _):
updatedState.readOutbox(MessageId(peerId: peer.peerId, namespace: Namespaces.Message.Cloud, id: maxId), timestamp: updatesDate) updatedState.readOutbox(MessageId(peerId: peer.peerId, namespace: Namespaces.Message.Cloud, id: maxId), timestamp: updatesDate)
case let .updateReadChannelDiscussionInbox(_, channelId, topMsgId, readMaxId, mainChannelId, mainChannelPost):
var mainChannelMessage: MessageId?
if let mainChannelId = mainChannelId, let mainChannelPost = mainChannelPost {
mainChannelMessage = MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: mainChannelId), namespace: Namespaces.Message.Cloud, id: mainChannelPost)
}
updatedState.readThread(threadMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId), namespace: Namespaces.Message.Cloud, id: topMsgId), readMaxId: readMaxId, isIncoming: true, mainChannelMessage: mainChannelMessage)
case let .updateReadChannelDiscussionOutbox(channelId, topMsgId, readMaxId):
updatedState.readThread(threadMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId), namespace: Namespaces.Message.Cloud, id: topMsgId), readMaxId: readMaxId, isIncoming: false, mainChannelMessage: nil)
case let .updateDialogUnreadMark(flags, peer): case let .updateDialogUnreadMark(flags, peer):
switch peer { switch peer {
case let .dialogPeer(peer): case let .dialogPeer(peer):
@ -2535,7 +2543,7 @@ func replayFinalState(accountManager: AccountManager, postbox: Postbox, accountP
case let .ReadGroupFeedInbox(groupId, index): case let .ReadGroupFeedInbox(groupId, index):
break break
//transaction.applyGroupFeedReadMaxIndex(groupId: groupId, index: index) //transaction.applyGroupFeedReadMaxIndex(groupId: groupId, index: index)
case let .UpdateReadThread(threadMessageId, readMaxId, isIncoming): case let .UpdateReadThread(threadMessageId, readMaxId, isIncoming, mainChannelMessage):
if isIncoming { if isIncoming {
if let currentId = updatedIncomingThreadReadStates[threadMessageId] { if let currentId = updatedIncomingThreadReadStates[threadMessageId] {
if currentId < readMaxId { if currentId < readMaxId {
@ -2544,6 +2552,22 @@ func replayFinalState(accountManager: AccountManager, postbox: Postbox, accountP
} else { } else {
updatedIncomingThreadReadStates[threadMessageId] = readMaxId updatedIncomingThreadReadStates[threadMessageId] = readMaxId
} }
if let mainChannelMessage = mainChannelMessage {
transaction.updateMessage(mainChannelMessage, update: { currentMessage in
let storeForwardInfo = currentMessage.forwardInfo.flatMap(StoreMessageForwardInfo.init)
var attributes = currentMessage.attributes
loop: for j in 0 ..< attributes.count {
if let attribute = attributes[j] as? ReplyThreadMessageAttribute {
if let maxReadMessageId = attribute.maxReadMessageId, maxReadMessageId > readMaxId {
return .skip
}
attributes[j] = ReplyThreadMessageAttribute(count: attribute.count, latestUsers: attribute.latestUsers, commentsPeerId: attribute.commentsPeerId, maxMessageId: attribute.maxMessageId, maxReadMessageId: readMaxId)
return .update(StoreMessage(id: currentMessage.id, globallyUniqueId: currentMessage.globallyUniqueId, groupingKey: currentMessage.groupingKey, threadId: currentMessage.threadId, timestamp: currentMessage.timestamp, flags: StoreMessageFlags(currentMessage.flags), tags: currentMessage.tags, globalTags: currentMessage.globalTags, localTags: currentMessage.localTags, forwardInfo: storeForwardInfo, authorId: currentMessage.author?.id, text: currentMessage.text, attributes: attributes, media: currentMessage.media))
}
}
return .skip
})
}
} else { } else {
if let currentId = updatedOutgoingThreadReadStates[threadMessageId] { if let currentId = updatedOutgoingThreadReadStates[threadMessageId] {
if currentId < readMaxId { if currentId < readMaxId {

View File

@ -33,7 +33,7 @@ private class ReplyThreadHistoryContextImpl {
private var maxReadOutgoingMessageIdValue: MessageId? { private var maxReadOutgoingMessageIdValue: MessageId? {
didSet { didSet {
if self.maxReadOutgoingMessageIdValue != oldValue { if self.maxReadOutgoingMessageIdValue != oldValue {
self.maxReadOutgoingMessageId.set(.single(nil)) self.maxReadOutgoingMessageId.set(.single(self.maxReadOutgoingMessageIdValue))
} }
} }
} }

View File

@ -95,7 +95,7 @@ func chatHistoryEntriesForView(location: ChatLocation, view: MessageHistoryView,
} else { } else {
selection = .none selection = .none
} }
groupBucket.append((message, entry.isRead, selection, ChatMessageEntryAttributes(rank: adminRank, isContact: entry.attributes.authorIsContact, contentTypeHint: contentTypeHint, updatingMedia: updatingMedia[message.id]))) groupBucket.append((message, isRead, selection, ChatMessageEntryAttributes(rank: adminRank, isContact: entry.attributes.authorIsContact, contentTypeHint: contentTypeHint, updatingMedia: updatingMedia[message.id])))
} else { } else {
let selection: ChatHistoryMessageSelection let selection: ChatHistoryMessageSelection
if let selectedMessages = selectedMessages { if let selectedMessages = selectedMessages {
@ -103,7 +103,7 @@ func chatHistoryEntriesForView(location: ChatLocation, view: MessageHistoryView,
} else { } else {
selection = .none selection = .none
} }
entries.append(.MessageEntry(message, presentationData, entry.isRead, entry.monthLocation, selection, ChatMessageEntryAttributes(rank: adminRank, isContact: entry.attributes.authorIsContact, contentTypeHint: contentTypeHint, updatingMedia: updatingMedia[message.id]))) entries.append(.MessageEntry(message, presentationData, isRead, entry.monthLocation, selection, ChatMessageEntryAttributes(rank: adminRank, isContact: entry.attributes.authorIsContact, contentTypeHint: contentTypeHint, updatingMedia: updatingMedia[message.id])))
} }
} else { } else {
let selection: ChatHistoryMessageSelection let selection: ChatHistoryMessageSelection
@ -112,7 +112,7 @@ func chatHistoryEntriesForView(location: ChatLocation, view: MessageHistoryView,
} else { } else {
selection = .none selection = .none
} }
entries.append(.MessageEntry(message, presentationData, entry.isRead, entry.monthLocation, selection, ChatMessageEntryAttributes(rank: adminRank, isContact: entry.attributes.authorIsContact, contentTypeHint: contentTypeHint, updatingMedia: updatingMedia[message.id]))) entries.append(.MessageEntry(message, presentationData, isRead, entry.monthLocation, selection, ChatMessageEntryAttributes(rank: adminRank, isContact: entry.attributes.authorIsContact, contentTypeHint: contentTypeHint, updatingMedia: updatingMedia[message.id])))
} }
} }

View File

@ -67,7 +67,7 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> [(
result.append((message, ChatMessageActionBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform))) result.append((message, ChatMessageActionBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
} }
} else if let _ = media as? TelegramMediaMap { } else if let _ = media as? TelegramMediaMap {
result.append((message, ChatMessageMapBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .media))) result.append((message, ChatMessageMapBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))
} else if let _ = media as? TelegramMediaGame { } else if let _ = media as? TelegramMediaGame {
skipText = true skipText = true
result.append((message, ChatMessageGameBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform))) result.append((message, ChatMessageGameBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .freeform)))

View File

@ -395,7 +395,7 @@ final class ChatSendMessageActionSheetControllerNode: ViewControllerTracingNode,
UIView.animate(withDuration: 0.2, animations: { UIView.animate(withDuration: 0.2, animations: {
if #available(iOS 9.0, *) { if #available(iOS 9.0, *) {
self.effectView.effect = makeCustomZoomBlurEffect() self.effectView.effect = makeCustomZoomBlurEffect(isLight: !self.presentationData.theme.overallDarkAppearance)
} else { } else {
self.effectView.alpha = 1.0 self.effectView.alpha = 1.0
} }

View File

@ -7,5 +7,5 @@ CABasicAnimation * _Nonnull makeSpringAnimationImpl(NSString * _Nonnull keyPath)
CABasicAnimation * _Nonnull makeSpringBounceAnimationImpl(NSString * _Nonnull keyPath, CGFloat initialVelocity, CGFloat damping); CABasicAnimation * _Nonnull makeSpringBounceAnimationImpl(NSString * _Nonnull keyPath, CGFloat initialVelocity, CGFloat damping);
CGFloat springAnimationValueAtImpl(CABasicAnimation * _Nonnull animation, CGFloat t); CGFloat springAnimationValueAtImpl(CABasicAnimation * _Nonnull animation, CGFloat t);
UIBlurEffect *makeCustomZoomBlurEffectImpl(); UIBlurEffect *makeCustomZoomBlurEffectImpl(bool isLight);
void applySmoothRoundedCornersImpl(CALayer * _Nonnull layer); void applySmoothRoundedCornersImpl(CALayer * _Nonnull layer);

View File

@ -159,9 +159,13 @@ static void setBoolField(CustomBlurEffect *object, NSString *name, BOOL value) {
[inv invoke]; [inv invoke];
} }
UIBlurEffect *makeCustomZoomBlurEffectImpl() { UIBlurEffect *makeCustomZoomBlurEffectImpl(bool isLight) {
if (@available(iOS 13.0, *)) { if (@available(iOS 13.0, *)) {
if (isLight) {
return [UIBlurEffect effectWithStyle:UIBlurEffectStyleSystemUltraThinMaterialLight]; return [UIBlurEffect effectWithStyle:UIBlurEffectStyleSystemUltraThinMaterialLight];
} else {
return [UIBlurEffect effectWithStyle:UIBlurEffectStyleSystemUltraThinMaterialDark];
}
} else if (@available(iOS 11.0, *)) { } else if (@available(iOS 11.0, *)) {
NSString *string = [@[@"_", @"UI", @"Custom", @"BlurEffect"] componentsJoinedByString:@""]; NSString *string = [@[@"_", @"UI", @"Custom", @"BlurEffect"] componentsJoinedByString:@""];
CustomBlurEffect *result = (CustomBlurEffect *)[NSClassFromString(string) effectWithStyle:0]; CustomBlurEffect *result = (CustomBlurEffect *)[NSClassFromString(string) effectWithStyle:0];