diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 99a1e37548..8559364046 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -8908,3 +8908,5 @@ Sorry for the inconvenience."; "Gallery.VoiceOver.PictureInPicture" = "Picture-in-Picture"; "Appearance.VoiceOver.Theme" = "%@ Theme"; + +"ChatList.EmptyChatListWithArchive" = "All of your chats are archived."; diff --git a/submodules/ChatListUI/Sources/ChatListControllerNode.swift b/submodules/ChatListUI/Sources/ChatListControllerNode.swift index c13315d9c8..b9a3938c50 100644 --- a/submodules/ChatListUI/Sources/ChatListControllerNode.swift +++ b/submodules/ChatListUI/Sources/ChatListControllerNode.swift @@ -357,6 +357,7 @@ private final class ChatListContainerItemNode: ASDisplayNode { var shimmerNodeOffset: CGFloat = 0.0 var needsEmptyNode = false + var hasOnlyArchive = false var hasOnlyGeneralThread = false var isLoading = false @@ -375,8 +376,9 @@ private final class ChatListContainerItemNode: ASDisplayNode { if !isLoadingValue { strongSelf.becameEmpty(filter) } - case let .notEmpty(_, onlyGeneralThreadValue): - needsEmptyNode = onlyGeneralThreadValue + case let .notEmpty(_, onlyHasArchiveValue, onlyGeneralThreadValue): + needsEmptyNode = onlyHasArchiveValue || onlyGeneralThreadValue + hasOnlyArchive = onlyHasArchiveValue hasOnlyGeneralThread = onlyGeneralThreadValue } @@ -397,7 +399,7 @@ private final class ChatListContainerItemNode: ASDisplayNode { if case .forum = location { subject = .forum(hasGeneral: hasOnlyGeneralThread) } else { - subject = .chats + subject = .chats(hasArchive: hasOnlyArchive) } } diff --git a/submodules/ChatListUI/Sources/ChatListEmptyNode.swift b/submodules/ChatListUI/Sources/ChatListEmptyNode.swift index 39f0bbfb70..f4b8cbd48f 100644 --- a/submodules/ChatListUI/Sources/ChatListEmptyNode.swift +++ b/submodules/ChatListUI/Sources/ChatListEmptyNode.swift @@ -12,7 +12,7 @@ import AccountContext final class ChatListEmptyNode: ASDisplayNode { enum Subject { - case chats + case chats(hasArchive: Bool) case filter(showEdit: Bool) case forum(hasGeneral: Bool) } @@ -58,6 +58,8 @@ final class ChatListEmptyNode: ASDisplayNode { var gloss = true if case .filter = subject { gloss = false + } else if case .chats(true) = subject { + gloss = false } self.buttonNode = SolidRoundedButtonNode(theme: SolidRoundedButtonTheme(theme: theme), cornerRadius: 11.0, gloss: gloss) @@ -132,8 +134,8 @@ final class ChatListEmptyNode: ASDisplayNode { var descriptionText = "" let buttonText: String switch self.subject { - case .chats: - text = strings.ChatList_EmptyChatList + case let .chats(hasArchive): + text = hasArchive ? strings.ChatList_EmptyChatListWithArchive : strings.ChatList_EmptyChatList buttonText = strings.ChatList_EmptyChatListNewMessage case .filter: text = strings.ChatList_EmptyChatListFilterTitle @@ -242,9 +244,6 @@ final class ChatListEmptyNode: ASDisplayNode { if self.secondaryButtonNode.frame.contains(point), !self.secondaryButtonNode.isHidden { return self.secondaryButtonNode.view.hitTest(self.view.convert(point, to: self.secondaryButtonNode.view), with: event) } - if self.animationNode.frame.contains(point) { - return self.animationNode.view.hitTest(self.view.convert(point, to: self.animationNode.view), with: event) - } return nil } } diff --git a/submodules/ChatListUI/Sources/Node/ChatListNode.swift b/submodules/ChatListUI/Sources/Node/ChatListNode.swift index 39fa90802e..d5c665113e 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListNode.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListNode.swift @@ -932,7 +932,7 @@ public enum ChatListNodeScrollPosition { } public enum ChatListNodeEmptyState: Equatable { - case notEmpty(containsChats: Bool, onlyGeneralThread: Bool) + case notEmpty(containsChats: Bool, onlyArchive: Bool, onlyGeneralThread: Bool) case empty(isLoading: Bool, hasArchiveInfo: Bool) } @@ -2767,10 +2767,15 @@ public final class ChatListNode: ListView { var containsChats = false var threadCount = 0 var hasGeneral = false + var hasArchive = false loop: for entry in transition.chatListView.filteredEntries { switch entry { case .GroupReferenceEntry, .HoleEntry, .PeerEntry: - containsChats = true + if case .GroupReferenceEntry = entry { + hasArchive = true + } else { + containsChats = true + } if case .forum = strongSelf.location { if case let .PeerEntry(peerEntry) = entry, let threadInfo = peerEntry.threadInfo { if threadInfo.id == 1 { @@ -2788,7 +2793,7 @@ public final class ChatListNode: ListView { break } } - isEmptyState = .notEmpty(containsChats: containsChats, onlyGeneralThread: hasGeneral && threadCount == 1) + isEmptyState = .notEmpty(containsChats: containsChats || hasArchive, onlyArchive: hasArchive && !containsChats, onlyGeneralThread: hasGeneral && threadCount == 1) } var insertedPeerIds: [EnginePeer.Id] = [] diff --git a/submodules/ChatListUI/Sources/Node/ChatListNodeEntries.swift b/submodules/ChatListUI/Sources/Node/ChatListNodeEntries.swift index 95f8de2fdd..55cbb5e6a0 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListNodeEntries.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListNodeEntries.swift @@ -657,7 +657,7 @@ func chatListNodeEntriesForView(_ view: EngineChatList, state: ChatListNodeState message: groupReference.topMessage, editing: state.editing, unreadCount: groupReference.unreadCount, - revealed: state.hiddenItemShouldBeTemporaryRevealed || view.items.isEmpty, + revealed: state.hiddenItemShouldBeTemporaryRevealed, hiddenByDefault: hideArchivedFolderByDefault )) if pinningIndex != 0 { diff --git a/submodules/Display/Source/WindowContent.swift b/submodules/Display/Source/WindowContent.swift index fbf0c016ab..f2adb8f223 100644 --- a/submodules/Display/Source/WindowContent.swift +++ b/submodules/Display/Source/WindowContent.swift @@ -567,9 +567,7 @@ public class Window1 { if strongSelf.hostView.containerView is ChildWindowHostView, !isTablet { keyboardHeight += 27.0 } - - print("keyboardHeight: \(keyboardHeight) (raw: \(keyboardFrame))") - + var duration: Double = (notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0.0 if duration > Double.ulpOfOne { duration = 0.5 diff --git a/submodules/InstantPageUI/Sources/InstantPageControllerNode.swift b/submodules/InstantPageUI/Sources/InstantPageControllerNode.swift index d66c110f82..020df6f0b8 100644 --- a/submodules/InstantPageUI/Sources/InstantPageControllerNode.swift +++ b/submodules/InstantPageUI/Sources/InstantPageControllerNode.swift @@ -776,10 +776,10 @@ final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate { } else { maxBarHeight = containerLayout.safeInsets.top + 34.0 } - minBarHeight = containerLayout.safeInsets.top + 8.0 + minBarHeight = containerLayout.safeInsets.top + 8.0 + 20.0 } else { maxBarHeight = (containerLayout.statusBarHeight ?? 0.0) + 44.0 - minBarHeight = 20.0 + minBarHeight = (containerLayout.statusBarHeight ?? 20.0) + 20.0 } var pageProgress: CGFloat = 0.0 diff --git a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift index 92b2fef89c..9ff00cdb4f 100644 --- a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift +++ b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift @@ -591,7 +591,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode { private let scrollToMessageIdPromise = Promise(nil) private let currentlyPlayingMessageIdPromise = Promise<(MessageIndex, Bool)?>(nil) - private var appliedPlayingMessageId: MessageIndex? = nil + private var appliedPlayingMessageId: (MessageIndex, Bool)? = nil private(set) var isScrollAtBottomPosition = false public var isScrollAtBottomPositionUpdated: (() -> Void)? @@ -1102,7 +1102,6 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode { translationState ).start(next: { [weak self] update, chatPresentationData, selectedMessages, updatingMedia, networkType, animatedEmojiStickers, additionalAnimatedEmojiStickers, customChannelDiscussionReadState, customThreadOutgoingReadState, availableReactions, defaultReaction, accountPeer, suggestAudioTranscription, promises, topicAuthorId, allAdMessages, translationState in let (historyAppearsCleared, pendingUnpinnedAllMessages, pendingRemovedMessages, currentlyPlayingMessageIdAndType, scrollToMessageId, chatHasBots) = promises - let currentlyPlayingMessageId = currentlyPlayingMessageIdAndType?.0 func applyHole() { Queue.mainQueue().async { @@ -1250,7 +1249,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode { } } - let associatedData = extractAssociatedData(chatLocation: chatLocation, view: view, automaticDownloadNetworkType: networkType, animatedEmojiStickers: animatedEmojiStickers, additionalAnimatedEmojiStickers: additionalAnimatedEmojiStickers, subject: subject, currentlyPlayingMessageId: currentlyPlayingMessageId, isCopyProtectionEnabled: isCopyProtectionEnabled, availableReactions: availableReactions, defaultReaction: defaultReaction, isPremium: isPremium, alwaysDisplayTranscribeButton: alwaysDisplayTranscribeButton, accountPeer: accountPeer, topicAuthorId: topicAuthorId, hasBots: chatHasBots, translateToLanguage: translateToLanguage) + let associatedData = extractAssociatedData(chatLocation: chatLocation, view: view, automaticDownloadNetworkType: networkType, animatedEmojiStickers: animatedEmojiStickers, additionalAnimatedEmojiStickers: additionalAnimatedEmojiStickers, subject: subject, currentlyPlayingMessageId: currentlyPlayingMessageIdAndType?.0, isCopyProtectionEnabled: isCopyProtectionEnabled, availableReactions: availableReactions, defaultReaction: defaultReaction, isPremium: isPremium, alwaysDisplayTranscribeButton: alwaysDisplayTranscribeButton, accountPeer: accountPeer, topicAuthorId: topicAuthorId, hasBots: chatHasBots, translateToLanguage: translateToLanguage) let filteredEntries = chatHistoryEntriesForView( location: chatLocation, @@ -1343,7 +1342,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode { scrollAnimationCurve = .Spring(duration: 0.4) } else { let wasPlaying = strongSelf.appliedPlayingMessageId != nil - if strongSelf.appliedPlayingMessageId != currentlyPlayingMessageId, let (currentlyPlayingMessageId, currentlyPlayingVideo) = currentlyPlayingMessageIdAndType { + if strongSelf.appliedPlayingMessageId?.0 != currentlyPlayingMessageIdAndType?.0, let (currentlyPlayingMessageId, currentlyPlayingVideo) = currentlyPlayingMessageIdAndType { if isFirstTime { } else if case let .peer(peerId) = chatLocation, currentlyPlayingMessageId.id.peerId != peerId { } else { @@ -1357,7 +1356,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode { if let appliedPlayingMessageId = strongSelf.appliedPlayingMessageId { currentIsVisible = false strongSelf.forEachVisibleMessageItemNode({ view in - if view.item?.message.id == appliedPlayingMessageId.id { + if view.item?.message.id == appliedPlayingMessageId.0.id && appliedPlayingMessageId.1 == true { currentIsVisible = true } }) @@ -1440,8 +1439,8 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode { guard let strongSelf = self else { return } - if strongSelf.appliedPlayingMessageId != currentlyPlayingMessageId { - strongSelf.appliedPlayingMessageId = currentlyPlayingMessageId + if strongSelf.appliedPlayingMessageId?.0 != currentlyPlayingMessageIdAndType?.0 { + strongSelf.appliedPlayingMessageId = currentlyPlayingMessageIdAndType } if strongSelf.appliedScrollToMessageId != scrollToMessageId { strongSelf.appliedScrollToMessageId = scrollToMessageId diff --git a/submodules/TelegramUI/Sources/ChatMessageCallBubbleContentNode.swift b/submodules/TelegramUI/Sources/ChatMessageCallBubbleContentNode.swift index 25aa0d6d85..362b2bfae8 100644 --- a/submodules/TelegramUI/Sources/ChatMessageCallBubbleContentNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageCallBubbleContentNode.swift @@ -32,9 +32,10 @@ class ChatMessageCallBubbleContentNode: ChatMessageBubbleContentNode { self.iconNode.isLayerBacked = true self.buttonNode = HighlightableButtonNode() + self.buttonNode.isAccessibilityElement = false super.init() - + self.titleNode.isUserInteractionEnabled = false self.titleNode.contentMode = .topLeft self.titleNode.contentsScale = UIScreenScale @@ -58,6 +59,12 @@ class ChatMessageCallBubbleContentNode: ChatMessageBubbleContentNode { return true } + override func didLoad() { + super.didLoad() + + self.view.accessibilityElementsHidden = true + } + required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") }