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
5f0a33e414
commit
fed6d34f53
@ -600,7 +600,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
|> take(1)
|
|> take(1)
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] greetingSticker in
|
|> deliverOnMainQueue).start(next: { [weak self] greetingSticker in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(peer.id), activateInput: activateInput, scrollToEndIfExists: scrollToEndIfExists, greetingData: greetingSticker.flatMap({ ChatGreetingData(sticker: $0) }), animated: !scrollToEndIfExists, options: strongSelf.groupId == PeerGroupId.root ? [.removeOnMasterDetails] : [], parentGroupId: strongSelf.groupId, completion: { [weak self] controller in
|
strongSelf.context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: strongSelf.context, chatLocation: .peer(peer.id), activateInput: activateInput && !peer.isDeleted, scrollToEndIfExists: scrollToEndIfExists, greetingData: greetingSticker.flatMap({ ChatGreetingData(sticker: $0) }), animated: !scrollToEndIfExists, options: strongSelf.groupId == PeerGroupId.root ? [.removeOnMasterDetails] : [], parentGroupId: strongSelf.groupId, completion: { [weak self] controller in
|
||||||
self?.chatListDisplayNode.containerNode.currentItemNode.clearHighlightAnimated(true)
|
self?.chatListDisplayNode.containerNode.currentItemNode.clearHighlightAnimated(true)
|
||||||
if let promoInfo = promoInfo {
|
if let promoInfo = promoInfo {
|
||||||
switch promoInfo {
|
switch promoInfo {
|
||||||
|
@ -217,7 +217,6 @@ private final class NavigationButtonItemNode: ImmediateTextNode {
|
|||||||
|
|
||||||
override func updateLayout(_ constrainedSize: CGSize) -> CGSize {
|
override func updateLayout(_ constrainedSize: CGSize) -> CGSize {
|
||||||
var superSize = super.updateLayout(constrainedSize)
|
var superSize = super.updateLayout(constrainedSize)
|
||||||
superSize.height = max(44.0, superSize.height)
|
|
||||||
|
|
||||||
if let node = self.node {
|
if let node = self.node {
|
||||||
let nodeSize = node.measure(constrainedSize)
|
let nodeSize = node.measure(constrainedSize)
|
||||||
@ -231,6 +230,8 @@ private final class NavigationButtonItemNode: ImmediateTextNode {
|
|||||||
imageNode.frame = imageFrame
|
imageNode.frame = imageFrame
|
||||||
self.imageRippleNode.frame = imageFrame
|
self.imageRippleNode.frame = imageFrame
|
||||||
return size
|
return size
|
||||||
|
} else {
|
||||||
|
superSize.height = max(44.0, superSize.height)
|
||||||
}
|
}
|
||||||
return superSize
|
return superSize
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,8 @@ final class PasscodeEntryControllerNode: ASDisplayNode {
|
|||||||
override func didLoad() {
|
override func didLoad() {
|
||||||
super.didLoad()
|
super.didLoad()
|
||||||
|
|
||||||
|
self.view.disablesInteractiveKeyboardGestureRecognizer = true
|
||||||
|
|
||||||
self.view.insertSubview(self.effectView, at: 0)
|
self.view.insertSubview(self.effectView, at: 0)
|
||||||
|
|
||||||
if self.arguments.cancel != nil {
|
if self.arguments.cancel != nil {
|
||||||
|
@ -161,6 +161,11 @@ final class PasscodeSetupControllerNode: ASDisplayNode {
|
|||||||
transition.updateFrame(node: self.modeButtonNode, frame: CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - insets.bottom - 53.0), size: CGSize(width: layout.size.width, height: 44.0)))
|
transition.updateFrame(node: self.modeButtonNode, frame: CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - insets.bottom - 53.0), size: CGSize(width: layout.size.width, height: 44.0)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func didLoad() {
|
||||||
|
super.didLoad()
|
||||||
|
self.view.disablesInteractiveKeyboardGestureRecognizer = true
|
||||||
|
}
|
||||||
|
|
||||||
func updateMode(_ mode: PasscodeSetupControllerMode) {
|
func updateMode(_ mode: PasscodeSetupControllerMode) {
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.inputFieldNode.reset()
|
self.inputFieldNode.reset()
|
||||||
|
@ -1039,6 +1039,10 @@ public func channelAdminController(context: AccountContext, peerId: PeerId, admi
|
|||||||
return current.withUpdatedUpdating(true)
|
return current.withUpdatedUpdating(true)
|
||||||
}
|
}
|
||||||
updateRightsDisposable.set((context.peerChannelMemberCategoriesContextsManager.updateMemberAdminRights(account: context.account, peerId: peerId, memberId: adminId, adminRights: TelegramChatAdminRights(rights: updateFlags ?? []), rank: effectiveRank) |> deliverOnMainQueue).start(error: { error in
|
updateRightsDisposable.set((context.peerChannelMemberCategoriesContextsManager.updateMemberAdminRights(account: context.account, peerId: peerId, memberId: adminId, adminRights: TelegramChatAdminRights(rights: updateFlags ?? []), rank: effectiveRank) |> deliverOnMainQueue).start(error: { error in
|
||||||
|
updateState { current in
|
||||||
|
return current.withUpdatedUpdating(false)
|
||||||
|
}
|
||||||
|
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
var text = presentationData.strings.Login_UnknownError
|
var text = presentationData.strings.Login_UnknownError
|
||||||
switch error {
|
switch error {
|
||||||
|
@ -1382,6 +1382,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
}, openInstantPage: { [weak self] message, associatedData in
|
}, openInstantPage: { [weak self] message, associatedData in
|
||||||
if let strongSelf = self, strongSelf.isNodeLoaded, let navigationController = strongSelf.effectiveNavigationController, let message = strongSelf.chatDisplayNode.historyNode.messageInCurrentHistoryView(message.id) {
|
if let strongSelf = self, strongSelf.isNodeLoaded, let navigationController = strongSelf.effectiveNavigationController, let message = strongSelf.chatDisplayNode.historyNode.messageInCurrentHistoryView(message.id) {
|
||||||
|
strongSelf.chatDisplayNode.dismissInput()
|
||||||
openChatInstantPage(context: strongSelf.context, message: message, sourcePeerType: associatedData?.automaticDownloadPeerType, navigationController: navigationController)
|
openChatInstantPage(context: strongSelf.context, message: message, sourcePeerType: associatedData?.automaticDownloadPeerType, navigationController: navigationController)
|
||||||
|
|
||||||
if case .overlay = strongSelf.presentationInterfaceState.mode {
|
if case .overlay = strongSelf.presentationInterfaceState.mode {
|
||||||
@ -11642,6 +11643,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
var latestNode: (Int32, ASDisplayNode)?
|
var latestNode: (Int32, ASDisplayNode)?
|
||||||
self.chatDisplayNode.historyNode.forEachVisibleItemNode { itemNode in
|
self.chatDisplayNode.historyNode.forEachVisibleItemNode { itemNode in
|
||||||
if let itemNode = itemNode as? ChatMessageItemView, let item = itemNode.item, let statusNode = itemNode.getStatusNode() {
|
if let itemNode = itemNode as? ChatMessageItemView, let item = itemNode.item, let statusNode = itemNode.getStatusNode() {
|
||||||
|
if !item.content.effectivelyIncoming(self.context.account.peerId) {
|
||||||
if let (latestTimestamp, _) = latestNode {
|
if let (latestTimestamp, _) = latestNode {
|
||||||
if item.message.timestamp > latestTimestamp {
|
if item.message.timestamp > latestTimestamp {
|
||||||
latestNode = (item.message.timestamp, statusNode)
|
latestNode = (item.message.timestamp, statusNode)
|
||||||
@ -11651,6 +11653,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let (_, latestStatusNode) = latestNode {
|
if let (_, latestStatusNode) = latestNode {
|
||||||
let bounds = latestStatusNode.view.convert(latestStatusNode.view.bounds, to: self.chatDisplayNode.view)
|
let bounds = latestStatusNode.view.convert(latestStatusNode.view.bounds, to: self.chatDisplayNode.view)
|
||||||
|
@ -184,8 +184,6 @@ final class ChatMessageAccessibilityData {
|
|||||||
let singleUrl: String?
|
let singleUrl: String?
|
||||||
|
|
||||||
init(item: ChatMessageItem, isSelected: Bool?) {
|
init(item: ChatMessageItem, isSelected: Bool?) {
|
||||||
var label: String = ""
|
|
||||||
let value: String
|
|
||||||
var hint: String?
|
var hint: String?
|
||||||
var traits: UIAccessibilityTraits = []
|
var traits: UIAccessibilityTraits = []
|
||||||
var singleUrl: String?
|
var singleUrl: String?
|
||||||
@ -202,14 +200,18 @@ final class ChatMessageAccessibilityData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let authorName = item.message.author?.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
let dataForMessage: (Message, Bool) -> (String, String) = { message, isReply -> (String, String) in
|
||||||
|
var label: String = ""
|
||||||
|
var value: String = ""
|
||||||
|
|
||||||
if let chatPeer = item.message.peers[item.message.id.peerId] {
|
if let chatPeer = message.peers[item.message.id.peerId] {
|
||||||
let (_, _, messageText) = chatListItemStrings(strings: item.presentationData.strings, nameDisplayOrder: item.presentationData.nameDisplayOrder, messages: [item.message], chatPeer: RenderedPeer(peer: chatPeer), accountPeerId: item.context.account.peerId)
|
let authorName = message.author?.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||||
|
|
||||||
|
let (_, _, messageText) = chatListItemStrings(strings: item.presentationData.strings, nameDisplayOrder: item.presentationData.nameDisplayOrder, messages: [message], chatPeer: RenderedPeer(peer: chatPeer), accountPeerId: item.context.account.peerId)
|
||||||
|
|
||||||
var text = messageText
|
var text = messageText
|
||||||
|
|
||||||
loop: for media in item.message.media {
|
loop: for media in message.media {
|
||||||
if let _ = media as? TelegramMediaImage {
|
if let _ = media as? TelegramMediaImage {
|
||||||
if isIncoming {
|
if isIncoming {
|
||||||
if announceIncomingAuthors, let authorName = authorName {
|
if announceIncomingAuthors, let authorName = authorName {
|
||||||
@ -221,10 +223,10 @@ final class ChatMessageAccessibilityData {
|
|||||||
label = item.presentationData.strings.VoiceOver_Chat_YourPhoto
|
label = item.presentationData.strings.VoiceOver_Chat_YourPhoto
|
||||||
}
|
}
|
||||||
text = ""
|
text = ""
|
||||||
if !item.message.text.isEmpty {
|
if !message.text.isEmpty {
|
||||||
text.append("\n")
|
text.append("\n")
|
||||||
|
|
||||||
text.append(item.presentationData.strings.VoiceOver_Chat_Caption(item.message.text).0)
|
text.append(item.presentationData.strings.VoiceOver_Chat_Caption(message.text).0)
|
||||||
}
|
}
|
||||||
} else if let file = media as? TelegramMediaFile {
|
} else if let file = media as? TelegramMediaFile {
|
||||||
var isSpecialFile = false
|
var isSpecialFile = false
|
||||||
@ -339,9 +341,9 @@ final class ChatMessageAccessibilityData {
|
|||||||
text = "\(file.fileName ?? ""). "
|
text = "\(file.fileName ?? ""). "
|
||||||
text.append(item.presentationData.strings.VoiceOver_Chat_Size(sizeString).0)
|
text.append(item.presentationData.strings.VoiceOver_Chat_Size(sizeString).0)
|
||||||
}
|
}
|
||||||
if !item.message.text.isEmpty {
|
if !message.text.isEmpty {
|
||||||
text.append("\n")
|
text.append("\n")
|
||||||
text.append(item.presentationData.strings.VoiceOver_Chat_Caption(item.message.text).0)
|
text.append(item.presentationData.strings.VoiceOver_Chat_Caption(message.text).0)
|
||||||
}
|
}
|
||||||
break loop
|
break loop
|
||||||
} else if let webpage = media as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content {
|
} else if let webpage = media as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content {
|
||||||
@ -353,7 +355,7 @@ final class ChatMessageAccessibilityData {
|
|||||||
if let text = content.text, !text.isEmpty {
|
if let text = content.text, !text.isEmpty {
|
||||||
contentText.append(text)
|
contentText.append(text)
|
||||||
}
|
}
|
||||||
text = "\(item.message.text)\n\(contentText)"
|
text = "\(message.text)\n\(contentText)"
|
||||||
} else if let contact = media as? TelegramMediaContact {
|
} else if let contact = media as? TelegramMediaContact {
|
||||||
if isIncoming {
|
if isIncoming {
|
||||||
if announceIncomingAuthors, let authorName = authorName {
|
if announceIncomingAuthors, let authorName = authorName {
|
||||||
@ -537,10 +539,10 @@ final class ChatMessageAccessibilityData {
|
|||||||
|
|
||||||
result += "\(text)"
|
result += "\(text)"
|
||||||
|
|
||||||
let dateString = DateFormatter.localizedString(from: Date(timeIntervalSince1970: Double(item.message.timestamp)), dateStyle: .medium, timeStyle: .short)
|
let dateString = DateFormatter.localizedString(from: Date(timeIntervalSince1970: Double(message.timestamp)), dateStyle: .medium, timeStyle: .short)
|
||||||
|
|
||||||
result += "\n\(dateString)"
|
result += "\n\(dateString)"
|
||||||
if !isIncoming && item.read {
|
if !isIncoming && item.read && !isReply {
|
||||||
result += "\n"
|
result += "\n"
|
||||||
if announceIncomingAuthors {
|
if announceIncomingAuthors {
|
||||||
result += item.presentationData.strings.VoiceOver_Chat_SeenByRecipients
|
result += item.presentationData.strings.VoiceOver_Chat_SeenByRecipients
|
||||||
@ -554,7 +556,7 @@ final class ChatMessageAccessibilityData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if label.isEmpty {
|
if label.isEmpty {
|
||||||
if let author = item.message.author {
|
if let author = message.author {
|
||||||
if isIncoming {
|
if isIncoming {
|
||||||
label = author.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
label = author.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
|
||||||
} else {
|
} else {
|
||||||
@ -565,6 +567,11 @@ final class ChatMessageAccessibilityData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (label, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
var (label, value) = dataForMessage(item.message, false)
|
||||||
|
|
||||||
for attribute in item.message.attributes {
|
for attribute in item.message.attributes {
|
||||||
if let attribute = attribute as? TextEntitiesMessageAttribute {
|
if let attribute = attribute as? TextEntitiesMessageAttribute {
|
||||||
var hasUrls = false
|
var hasUrls = false
|
||||||
@ -593,7 +600,7 @@ final class ChatMessageAccessibilityData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if let attribute = attribute as? ReplyMessageAttribute, let replyMessage = item.message.associatedMessages[attribute.messageId] {
|
} else if let attribute = attribute as? ReplyMessageAttribute, let replyMessage = item.message.associatedMessages[attribute.messageId] {
|
||||||
let replyLabel: String
|
var replyLabel: String
|
||||||
if replyMessage.flags.contains(.Incoming) {
|
if replyMessage.flags.contains(.Incoming) {
|
||||||
if let author = replyMessage.author {
|
if let author = replyMessage.author {
|
||||||
replyLabel = item.presentationData.strings.VoiceOver_Chat_ReplyFrom(author.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)).0
|
replyLabel = item.presentationData.strings.VoiceOver_Chat_ReplyFrom(author.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)).0
|
||||||
@ -603,6 +610,10 @@ final class ChatMessageAccessibilityData {
|
|||||||
} else {
|
} else {
|
||||||
replyLabel = item.presentationData.strings.VoiceOver_Chat_ReplyToYourMessage
|
replyLabel = item.presentationData.strings.VoiceOver_Chat_ReplyToYourMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let (replyMessageLabel, replyMessageValue) = dataForMessage(replyMessage, true)
|
||||||
|
replyLabel += "\(replyLabel): \(replyMessageLabel), \(replyMessageValue)"
|
||||||
|
|
||||||
label = "\(replyLabel) . \(label)"
|
label = "\(replyLabel) . \(label)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -378,7 +378,9 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
|
|||||||
let string = NSAttributedString(string: "", font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor)
|
let string = NSAttributedString(string: "", font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor)
|
||||||
state = .info(string, .generic)
|
state = .info(string, .generic)
|
||||||
} else if let user = peer as? TelegramUser {
|
} else if let user = peer as? TelegramUser {
|
||||||
if servicePeer {
|
if user.isDeleted {
|
||||||
|
state = .none
|
||||||
|
} else if servicePeer {
|
||||||
let string = NSAttributedString(string: "", font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor)
|
let string = NSAttributedString(string: "", font: Font.regular(13.0), textColor: titleTheme.rootController.navigationBar.secondaryTextColor)
|
||||||
state = .info(string, .generic)
|
state = .info(string, .generic)
|
||||||
} else if user.flags.contains(.isSupport) {
|
} else if user.flags.contains(.isSupport) {
|
||||||
|
@ -826,7 +826,7 @@ final class PeerInfoVisualMediaPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScro
|
|||||||
|
|
||||||
self.scrollNode.view.delaysContentTouches = false
|
self.scrollNode.view.delaysContentTouches = false
|
||||||
self.scrollNode.view.canCancelContentTouches = true
|
self.scrollNode.view.canCancelContentTouches = true
|
||||||
self.scrollNode.view.showsVerticalScrollIndicator = true
|
self.scrollNode.view.showsVerticalScrollIndicator = false
|
||||||
if #available(iOS 11.0, *) {
|
if #available(iOS 11.0, *) {
|
||||||
self.scrollNode.view.contentInsetAdjustmentBehavior = .never
|
self.scrollNode.view.contentInsetAdjustmentBehavior = .never
|
||||||
}
|
}
|
||||||
|
@ -993,6 +993,7 @@ func peerInfoHeaderButtons(peer: Peer?, cachedData: CachedPeerData?, isOpenedFro
|
|||||||
var canViewStats = false
|
var canViewStats = false
|
||||||
var hasDiscussion = false
|
var hasDiscussion = false
|
||||||
var hasVoiceChat = false
|
var hasVoiceChat = false
|
||||||
|
var canStartVoiceChat = false
|
||||||
if let cachedChannelData = cachedData as? CachedChannelData {
|
if let cachedChannelData = cachedData as? CachedChannelData {
|
||||||
canViewStats = cachedChannelData.flags.contains(.canViewStats)
|
canViewStats = cachedChannelData.flags.contains(.canViewStats)
|
||||||
}
|
}
|
||||||
@ -1012,6 +1013,9 @@ func peerInfoHeaderButtons(peer: Peer?, cachedData: CachedPeerData?, isOpenedFro
|
|||||||
if channel.flags.contains(.hasVoiceChat) {
|
if channel.flags.contains(.hasVoiceChat) {
|
||||||
hasVoiceChat = true
|
hasVoiceChat = true
|
||||||
}
|
}
|
||||||
|
if !hasVoiceChat && (channel.flags.contains(.isCreator) || channel.hasPermission(.manageCalls)) {
|
||||||
|
canStartVoiceChat = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
switch channel.participationStatus {
|
switch channel.participationStatus {
|
||||||
case .member:
|
case .member:
|
||||||
@ -1043,7 +1047,7 @@ func peerInfoHeaderButtons(peer: Peer?, cachedData: CachedPeerData?, isOpenedFro
|
|||||||
if channel.isVerified || channel.adminRights != nil || channel.flags.contains(.isCreator) {
|
if channel.isVerified || channel.adminRights != nil || channel.flags.contains(.isCreator) {
|
||||||
canReport = false
|
canReport = false
|
||||||
}
|
}
|
||||||
if !canReport && !canViewStats {
|
if !canReport && !canViewStats && !canStartVoiceChat {
|
||||||
displayMore = false
|
displayMore = false
|
||||||
}
|
}
|
||||||
if displayMore {
|
if displayMore {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user