mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
f441343f4c
commit
c53d7a1401
@ -8908,3 +8908,5 @@ Sorry for the inconvenience.";
|
|||||||
"Gallery.VoiceOver.PictureInPicture" = "Picture-in-Picture";
|
"Gallery.VoiceOver.PictureInPicture" = "Picture-in-Picture";
|
||||||
|
|
||||||
"Appearance.VoiceOver.Theme" = "%@ Theme";
|
"Appearance.VoiceOver.Theme" = "%@ Theme";
|
||||||
|
|
||||||
|
"ChatList.EmptyChatListWithArchive" = "All of your chats are archived.";
|
||||||
|
@ -357,6 +357,7 @@ private final class ChatListContainerItemNode: ASDisplayNode {
|
|||||||
var shimmerNodeOffset: CGFloat = 0.0
|
var shimmerNodeOffset: CGFloat = 0.0
|
||||||
|
|
||||||
var needsEmptyNode = false
|
var needsEmptyNode = false
|
||||||
|
var hasOnlyArchive = false
|
||||||
var hasOnlyGeneralThread = false
|
var hasOnlyGeneralThread = false
|
||||||
var isLoading = false
|
var isLoading = false
|
||||||
|
|
||||||
@ -375,8 +376,9 @@ private final class ChatListContainerItemNode: ASDisplayNode {
|
|||||||
if !isLoadingValue {
|
if !isLoadingValue {
|
||||||
strongSelf.becameEmpty(filter)
|
strongSelf.becameEmpty(filter)
|
||||||
}
|
}
|
||||||
case let .notEmpty(_, onlyGeneralThreadValue):
|
case let .notEmpty(_, onlyHasArchiveValue, onlyGeneralThreadValue):
|
||||||
needsEmptyNode = onlyGeneralThreadValue
|
needsEmptyNode = onlyHasArchiveValue || onlyGeneralThreadValue
|
||||||
|
hasOnlyArchive = onlyHasArchiveValue
|
||||||
hasOnlyGeneralThread = onlyGeneralThreadValue
|
hasOnlyGeneralThread = onlyGeneralThreadValue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,7 +399,7 @@ private final class ChatListContainerItemNode: ASDisplayNode {
|
|||||||
if case .forum = location {
|
if case .forum = location {
|
||||||
subject = .forum(hasGeneral: hasOnlyGeneralThread)
|
subject = .forum(hasGeneral: hasOnlyGeneralThread)
|
||||||
} else {
|
} else {
|
||||||
subject = .chats
|
subject = .chats(hasArchive: hasOnlyArchive)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import AccountContext
|
|||||||
|
|
||||||
final class ChatListEmptyNode: ASDisplayNode {
|
final class ChatListEmptyNode: ASDisplayNode {
|
||||||
enum Subject {
|
enum Subject {
|
||||||
case chats
|
case chats(hasArchive: Bool)
|
||||||
case filter(showEdit: Bool)
|
case filter(showEdit: Bool)
|
||||||
case forum(hasGeneral: Bool)
|
case forum(hasGeneral: Bool)
|
||||||
}
|
}
|
||||||
@ -58,6 +58,8 @@ final class ChatListEmptyNode: ASDisplayNode {
|
|||||||
var gloss = true
|
var gloss = true
|
||||||
if case .filter = subject {
|
if case .filter = subject {
|
||||||
gloss = false
|
gloss = false
|
||||||
|
} else if case .chats(true) = subject {
|
||||||
|
gloss = false
|
||||||
}
|
}
|
||||||
|
|
||||||
self.buttonNode = SolidRoundedButtonNode(theme: SolidRoundedButtonTheme(theme: theme), cornerRadius: 11.0, gloss: gloss)
|
self.buttonNode = SolidRoundedButtonNode(theme: SolidRoundedButtonTheme(theme: theme), cornerRadius: 11.0, gloss: gloss)
|
||||||
@ -132,8 +134,8 @@ final class ChatListEmptyNode: ASDisplayNode {
|
|||||||
var descriptionText = ""
|
var descriptionText = ""
|
||||||
let buttonText: String
|
let buttonText: String
|
||||||
switch self.subject {
|
switch self.subject {
|
||||||
case .chats:
|
case let .chats(hasArchive):
|
||||||
text = strings.ChatList_EmptyChatList
|
text = hasArchive ? strings.ChatList_EmptyChatListWithArchive : strings.ChatList_EmptyChatList
|
||||||
buttonText = strings.ChatList_EmptyChatListNewMessage
|
buttonText = strings.ChatList_EmptyChatListNewMessage
|
||||||
case .filter:
|
case .filter:
|
||||||
text = strings.ChatList_EmptyChatListFilterTitle
|
text = strings.ChatList_EmptyChatListFilterTitle
|
||||||
@ -242,9 +244,6 @@ final class ChatListEmptyNode: ASDisplayNode {
|
|||||||
if self.secondaryButtonNode.frame.contains(point), !self.secondaryButtonNode.isHidden {
|
if self.secondaryButtonNode.frame.contains(point), !self.secondaryButtonNode.isHidden {
|
||||||
return self.secondaryButtonNode.view.hitTest(self.view.convert(point, to: self.secondaryButtonNode.view), with: event)
|
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
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -932,7 +932,7 @@ public enum ChatListNodeScrollPosition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum ChatListNodeEmptyState: Equatable {
|
public enum ChatListNodeEmptyState: Equatable {
|
||||||
case notEmpty(containsChats: Bool, onlyGeneralThread: Bool)
|
case notEmpty(containsChats: Bool, onlyArchive: Bool, onlyGeneralThread: Bool)
|
||||||
case empty(isLoading: Bool, hasArchiveInfo: Bool)
|
case empty(isLoading: Bool, hasArchiveInfo: Bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2767,10 +2767,15 @@ public final class ChatListNode: ListView {
|
|||||||
var containsChats = false
|
var containsChats = false
|
||||||
var threadCount = 0
|
var threadCount = 0
|
||||||
var hasGeneral = false
|
var hasGeneral = false
|
||||||
|
var hasArchive = false
|
||||||
loop: for entry in transition.chatListView.filteredEntries {
|
loop: for entry in transition.chatListView.filteredEntries {
|
||||||
switch entry {
|
switch entry {
|
||||||
case .GroupReferenceEntry, .HoleEntry, .PeerEntry:
|
case .GroupReferenceEntry, .HoleEntry, .PeerEntry:
|
||||||
containsChats = true
|
if case .GroupReferenceEntry = entry {
|
||||||
|
hasArchive = true
|
||||||
|
} else {
|
||||||
|
containsChats = true
|
||||||
|
}
|
||||||
if case .forum = strongSelf.location {
|
if case .forum = strongSelf.location {
|
||||||
if case let .PeerEntry(peerEntry) = entry, let threadInfo = peerEntry.threadInfo {
|
if case let .PeerEntry(peerEntry) = entry, let threadInfo = peerEntry.threadInfo {
|
||||||
if threadInfo.id == 1 {
|
if threadInfo.id == 1 {
|
||||||
@ -2788,7 +2793,7 @@ public final class ChatListNode: ListView {
|
|||||||
break
|
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] = []
|
var insertedPeerIds: [EnginePeer.Id] = []
|
||||||
|
@ -657,7 +657,7 @@ func chatListNodeEntriesForView(_ view: EngineChatList, state: ChatListNodeState
|
|||||||
message: groupReference.topMessage,
|
message: groupReference.topMessage,
|
||||||
editing: state.editing,
|
editing: state.editing,
|
||||||
unreadCount: groupReference.unreadCount,
|
unreadCount: groupReference.unreadCount,
|
||||||
revealed: state.hiddenItemShouldBeTemporaryRevealed || view.items.isEmpty,
|
revealed: state.hiddenItemShouldBeTemporaryRevealed,
|
||||||
hiddenByDefault: hideArchivedFolderByDefault
|
hiddenByDefault: hideArchivedFolderByDefault
|
||||||
))
|
))
|
||||||
if pinningIndex != 0 {
|
if pinningIndex != 0 {
|
||||||
|
@ -567,9 +567,7 @@ public class Window1 {
|
|||||||
if strongSelf.hostView.containerView is ChildWindowHostView, !isTablet {
|
if strongSelf.hostView.containerView is ChildWindowHostView, !isTablet {
|
||||||
keyboardHeight += 27.0
|
keyboardHeight += 27.0
|
||||||
}
|
}
|
||||||
|
|
||||||
print("keyboardHeight: \(keyboardHeight) (raw: \(keyboardFrame))")
|
|
||||||
|
|
||||||
var duration: Double = (notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0.0
|
var duration: Double = (notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0.0
|
||||||
if duration > Double.ulpOfOne {
|
if duration > Double.ulpOfOne {
|
||||||
duration = 0.5
|
duration = 0.5
|
||||||
|
@ -776,10 +776,10 @@ final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
} else {
|
} else {
|
||||||
maxBarHeight = containerLayout.safeInsets.top + 34.0
|
maxBarHeight = containerLayout.safeInsets.top + 34.0
|
||||||
}
|
}
|
||||||
minBarHeight = containerLayout.safeInsets.top + 8.0
|
minBarHeight = containerLayout.safeInsets.top + 8.0 + 20.0
|
||||||
} else {
|
} else {
|
||||||
maxBarHeight = (containerLayout.statusBarHeight ?? 0.0) + 44.0
|
maxBarHeight = (containerLayout.statusBarHeight ?? 0.0) + 44.0
|
||||||
minBarHeight = 20.0
|
minBarHeight = (containerLayout.statusBarHeight ?? 20.0) + 20.0
|
||||||
}
|
}
|
||||||
|
|
||||||
var pageProgress: CGFloat = 0.0
|
var pageProgress: CGFloat = 0.0
|
||||||
|
@ -591,7 +591,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
private let scrollToMessageIdPromise = Promise<MessageIndex?>(nil)
|
private let scrollToMessageIdPromise = Promise<MessageIndex?>(nil)
|
||||||
|
|
||||||
private let currentlyPlayingMessageIdPromise = Promise<(MessageIndex, Bool)?>(nil)
|
private let currentlyPlayingMessageIdPromise = Promise<(MessageIndex, Bool)?>(nil)
|
||||||
private var appliedPlayingMessageId: MessageIndex? = nil
|
private var appliedPlayingMessageId: (MessageIndex, Bool)? = nil
|
||||||
|
|
||||||
private(set) var isScrollAtBottomPosition = false
|
private(set) var isScrollAtBottomPosition = false
|
||||||
public var isScrollAtBottomPositionUpdated: (() -> Void)?
|
public var isScrollAtBottomPositionUpdated: (() -> Void)?
|
||||||
@ -1102,7 +1102,6 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
translationState
|
translationState
|
||||||
).start(next: { [weak self] update, chatPresentationData, selectedMessages, updatingMedia, networkType, animatedEmojiStickers, additionalAnimatedEmojiStickers, customChannelDiscussionReadState, customThreadOutgoingReadState, availableReactions, defaultReaction, accountPeer, suggestAudioTranscription, promises, topicAuthorId, allAdMessages, translationState in
|
).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 (historyAppearsCleared, pendingUnpinnedAllMessages, pendingRemovedMessages, currentlyPlayingMessageIdAndType, scrollToMessageId, chatHasBots) = promises
|
||||||
let currentlyPlayingMessageId = currentlyPlayingMessageIdAndType?.0
|
|
||||||
|
|
||||||
func applyHole() {
|
func applyHole() {
|
||||||
Queue.mainQueue().async {
|
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(
|
let filteredEntries = chatHistoryEntriesForView(
|
||||||
location: chatLocation,
|
location: chatLocation,
|
||||||
@ -1343,7 +1342,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
scrollAnimationCurve = .Spring(duration: 0.4)
|
scrollAnimationCurve = .Spring(duration: 0.4)
|
||||||
} else {
|
} else {
|
||||||
let wasPlaying = strongSelf.appliedPlayingMessageId != nil
|
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 {
|
if isFirstTime {
|
||||||
} else if case let .peer(peerId) = chatLocation, currentlyPlayingMessageId.id.peerId != peerId {
|
} else if case let .peer(peerId) = chatLocation, currentlyPlayingMessageId.id.peerId != peerId {
|
||||||
} else {
|
} else {
|
||||||
@ -1357,7 +1356,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
if let appliedPlayingMessageId = strongSelf.appliedPlayingMessageId {
|
if let appliedPlayingMessageId = strongSelf.appliedPlayingMessageId {
|
||||||
currentIsVisible = false
|
currentIsVisible = false
|
||||||
strongSelf.forEachVisibleMessageItemNode({ view in
|
strongSelf.forEachVisibleMessageItemNode({ view in
|
||||||
if view.item?.message.id == appliedPlayingMessageId.id {
|
if view.item?.message.id == appliedPlayingMessageId.0.id && appliedPlayingMessageId.1 == true {
|
||||||
currentIsVisible = true
|
currentIsVisible = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1440,8 +1439,8 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if strongSelf.appliedPlayingMessageId != currentlyPlayingMessageId {
|
if strongSelf.appliedPlayingMessageId?.0 != currentlyPlayingMessageIdAndType?.0 {
|
||||||
strongSelf.appliedPlayingMessageId = currentlyPlayingMessageId
|
strongSelf.appliedPlayingMessageId = currentlyPlayingMessageIdAndType
|
||||||
}
|
}
|
||||||
if strongSelf.appliedScrollToMessageId != scrollToMessageId {
|
if strongSelf.appliedScrollToMessageId != scrollToMessageId {
|
||||||
strongSelf.appliedScrollToMessageId = scrollToMessageId
|
strongSelf.appliedScrollToMessageId = scrollToMessageId
|
||||||
|
@ -32,9 +32,10 @@ class ChatMessageCallBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
self.iconNode.isLayerBacked = true
|
self.iconNode.isLayerBacked = true
|
||||||
|
|
||||||
self.buttonNode = HighlightableButtonNode()
|
self.buttonNode = HighlightableButtonNode()
|
||||||
|
self.buttonNode.isAccessibilityElement = false
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
self.titleNode.isUserInteractionEnabled = false
|
self.titleNode.isUserInteractionEnabled = false
|
||||||
self.titleNode.contentMode = .topLeft
|
self.titleNode.contentMode = .topLeft
|
||||||
self.titleNode.contentsScale = UIScreenScale
|
self.titleNode.contentsScale = UIScreenScale
|
||||||
@ -58,6 +59,12 @@ class ChatMessageCallBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func didLoad() {
|
||||||
|
super.didLoad()
|
||||||
|
|
||||||
|
self.view.accessibilityElementsHidden = true
|
||||||
|
}
|
||||||
|
|
||||||
required init?(coder aDecoder: NSCoder) {
|
required init?(coder aDecoder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user