Various fixes

This commit is contained in:
Ilya Laktyushin 2023-02-09 21:08:14 +04:00
parent f441343f4c
commit c53d7a1401
9 changed files with 38 additions and 26 deletions

View File

@ -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.";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -591,7 +591,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
private let scrollToMessageIdPromise = Promise<MessageIndex?>(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

View File

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