VoiceOver fixes

This commit is contained in:
Ilya Laktyushin 2021-01-02 09:42:53 +03:00
parent a706c210de
commit 78a463a6d2
12 changed files with 4316 additions and 4285 deletions

View File

@ -2319,8 +2319,6 @@ Unused sets are archived when you add more.";
"Notification.CallCanceledShort" = "Cancelled";
"Notification.CallFormat" = "%1$@, %2$@"; // 1 - time, 2 - duration
"Call.ConnectionErrorTitle" = "Unable to Call";
"Call.ConnectionErrorMessage" = "Please check your internet connection and try again.";
@ -5801,3 +5799,14 @@ Sorry for the inconvenience.";
"VoiceChat.StatusMutedForYou" = "muted for you";
"VoiceChat.StatusMutedYou" = "put you on mute";
"VoiceOver.DismissContextMenu" = "Dismiss Context Menu";
"Call.VoiceOver.VoiceCallOutgoing" = "Outgoing Voice Call";
"Call.VoiceOver.VideoCallOutgoing" = "Outgoing Video Call";
"Call.VoiceOver.VoiceCallIncoming" = "Incoming Voice Call";
"Call.VoiceOver.VideoCallIncoming" = "Incoming Video Call";
"Call.VoiceOver.VoiceCallMissed" = "Missed Voice Call";
"Call.VoiceOver.VideoCallMissed" = "Missed Video Call";
"Call.VoiceOver.VoiceCallCanceled" = "Cancelled Voice Call";
"Call.VoiceOver.VideoCallCanceled" = "Cancelled Video Call";

View File

@ -255,7 +255,6 @@ class CallListCallItemNode: ItemListRevealOptionsItemNode {
for media in item.topMessage.media {
if let action = media as? TelegramMediaAction {
if case let .phoneCall(_, _, _, isVideoValue) = action.action {
break
isVideo = isVideoValue
}
}
@ -369,6 +368,8 @@ class CallListCallItemNode: ItemListRevealOptionsItemNode {
var titleAttributedString: NSAttributedString?
var statusAttributedString: NSAttributedString?
var statusAccessibilityString = ""
var titleColor = item.presentationData.theme.list.itemPrimaryTextColor
var hasMissed = false
var hasIncoming = false
@ -431,19 +432,26 @@ class CallListCallItemNode: ItemListRevealOptionsItemNode {
if hasMissed {
statusAttributedString = NSAttributedString(string: item.presentationData.strings.Notification_CallMissedShort, font: statusFont, textColor: item.presentationData.theme.list.itemSecondaryTextColor)
statusAccessibilityString = isVideo ? item.presentationData.strings.Call_VoiceOver_VideoCallMissed : item.presentationData.strings.Call_VoiceOver_VoiceCallMissed
} else if hasIncoming && hasOutgoing {
statusAttributedString = NSAttributedString(string: item.presentationData.strings.Notification_CallOutgoingShort + ", " + item.presentationData.strings.Notification_CallIncomingShort, font: statusFont, textColor: item.presentationData.theme.list.itemSecondaryTextColor)
statusAccessibilityString = isVideo ? (item.presentationData.strings.Call_VoiceOver_VideoCallOutgoing + ", " + item.presentationData.strings.Call_VoiceOver_VideoCallIncoming) : (item.presentationData.strings.Call_VoiceOver_VoiceCallOutgoing + ", " + item.presentationData.strings.Call_VoiceOver_VoiceCallIncoming)
} else if hasIncoming {
if let callDuration = callDuration, callDuration != 0 {
statusAttributedString = NSAttributedString(string: item.presentationData.strings.Notification_CallTimeFormat(item.presentationData.strings.Notification_CallIncomingShort, callDurationString(strings: item.presentationData.strings, duration: callDuration)).0, font: statusFont, textColor: item.presentationData.theme.list.itemSecondaryTextColor)
statusAccessibilityString = item.presentationData.strings.Notification_CallTimeFormat(isVideo ? item.presentationData.strings.Call_VoiceOver_VideoCallIncoming : item.presentationData.strings.Call_VoiceOver_VoiceCallIncoming, callDurationString(strings: item.presentationData.strings, duration: callDuration)).0
} else {
statusAttributedString = NSAttributedString(string: item.presentationData.strings.Notification_CallIncomingShort, font: statusFont, textColor: item.presentationData.theme.list.itemSecondaryTextColor)
statusAccessibilityString = isVideo ? item.presentationData.strings.Call_VoiceOver_VideoCallIncoming : item.presentationData.strings.Call_VoiceOver_VoiceCallIncoming
}
} else {
if let callDuration = callDuration, callDuration != 0 {
statusAttributedString = NSAttributedString(string: item.presentationData.strings.Notification_CallTimeFormat(item.presentationData.strings.Notification_CallOutgoingShort, callDurationString(strings: item.presentationData.strings, duration: callDuration)).0, font: statusFont, textColor: item.presentationData.theme.list.itemSecondaryTextColor)
statusAccessibilityString = item.presentationData.strings.Notification_CallTimeFormat(isVideo ? item.presentationData.strings.Call_VoiceOver_VideoCallOutgoing : item.presentationData.strings.Call_VoiceOver_VoiceCallOutgoing, callDurationString(strings: item.presentationData.strings, duration: callDuration)).0
} else {
statusAttributedString = NSAttributedString(string: item.presentationData.strings.Notification_CallOutgoingShort, font: statusFont, textColor: item.presentationData.theme.list.itemSecondaryTextColor)
statusAccessibilityString = isVideo ? item.presentationData.strings.Call_VoiceOver_VideoCallOutgoing : item.presentationData.strings.Call_VoiceOver_VoiceCallOutgoing
}
}
}
@ -610,9 +618,8 @@ class CallListCallItemNode: ItemListRevealOptionsItemNode {
strongSelf.updateLayout(size: nodeLayout.contentSize, leftInset: params.leftInset, rightInset: params.rightInset)
strongSelf.accessibilityArea.accessibilityTraits = .button
strongSelf.accessibilityArea.accessibilityLabel = titleAttributedString?.string
strongSelf.accessibilityArea.accessibilityValue = statusAttributedString?.string
strongSelf.accessibilityArea.accessibilityValue = statusAccessibilityString
strongSelf.accessibilityArea.frame = CGRect(origin: CGPoint(), size: nodeLayout.contentSize)
strongSelf.infoButtonNode.accessibilityLabel = item.presentationData.strings.Conversation_Info

View File

@ -427,6 +427,8 @@ public func chatListFilterPresetListController(context: AccountContext, mode: Ch
}
let controller = ItemListController(context: context, state: signal)
controller.isOpaqueWhenInOverlay = true
controller.blocksBackgroundWhenInOverlay = true
switch mode {
case .default:
controller.navigationPresentation = .default

View File

@ -1113,8 +1113,6 @@ public func createPollController(context: AccountContext, peer: Peer, isQuiz: Bo
dismissInputImpl = { [weak controller] in
controller?.view.endEditing(true)
}
controller.isOpaqueWhenInOverlay = true
controller.blocksBackgroundWhenInOverlay = true
controller.acceptsFocusWhenInOverlay = true
controller.experimentalSnapScrollToItem = true
controller.alwaysSynchronous = true

View File

@ -184,6 +184,9 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
self.withoutBlurDimNode.alpha = 0.0
self.dismissNode = ASDisplayNode()
self.dismissNode.isAccessibilityElement = true
self.dismissNode.accessibilityLabel = presentationData.strings.VoiceOver_DismissContextMenu
self.dismissNode.accessibilityTraits = .button
self.clippingNode = ASDisplayNode()
self.clippingNode.clipsToBounds = true

View File

@ -99,7 +99,7 @@ private final class NavigationControllerNode: ASDisplayNode {
}
override func accessibilityPerformEscape() -> Bool {
print("escape")
let _ = self.controller?.popViewController(animated: true)
return true
}
}

View File

@ -519,6 +519,7 @@ final class ChatMessageAccessibilityData {
result += "\n\(dateString)"
if !isIncoming && item.read {
result += "\n"
if announceIncomingAuthors {
result += item.presentationData.strings.VoiceOver_Chat_SeenByRecipients
} else {

View File

@ -4,7 +4,7 @@ import TelegramPresentationData
final class PeerInfoScreenSelectableBackgroundNode: ASDisplayNode {
private let backgroundNode: ASDisplayNode
private let buttonNode: HighlightTrackingButtonNode
private let button: HighlightTrackingButton
let bringToFrontForHighlight: () -> Void
@ -12,7 +12,7 @@ final class PeerInfoScreenSelectableBackgroundNode: ASDisplayNode {
var pressed: (() -> Void)? {
didSet {
self.buttonNode.isUserInteractionEnabled = self.pressed != nil
self.button.isUserInteractionEnabled = self.pressed != nil
}
}
@ -23,15 +23,16 @@ final class PeerInfoScreenSelectableBackgroundNode: ASDisplayNode {
self.backgroundNode.isLayerBacked = true
self.backgroundNode.alpha = 0.0
self.buttonNode = HighlightTrackingButtonNode()
self.button = HighlightTrackingButton()
self.button.isAccessibilityElement = false
super.init()
self.addSubnode(self.backgroundNode)
self.addSubnode(self.buttonNode)
self.view.addSubview(self.button)
self.buttonNode.addTarget(self, action: #selector(self.buttonPressed), forControlEvents: .touchUpInside)
self.buttonNode.highligthedChanged = { [weak self] highlighted in
self.button.addTarget(self, action: #selector(self.buttonPressed), for: .touchUpInside)
self.button.highligthedChanged = { [weak self] highlighted in
self?.updateIsHighlighted(highlighted)
}
}
@ -57,6 +58,6 @@ final class PeerInfoScreenSelectableBackgroundNode: ASDisplayNode {
func update(size: CGSize, theme: PresentationTheme, transition: ContainedViewLayoutTransition) {
self.backgroundNode.backgroundColor = theme.list.itemHighlightedBackgroundColor
transition.updateFrame(node: self.backgroundNode, frame: CGRect(origin: CGPoint(), size: size))
transition.updateFrame(node: self.buttonNode, frame: CGRect(origin: CGPoint(), size: size))
transition.updateFrame(view: self.button, frame: CGRect(origin: CGPoint(), size: size))
}
}

View File

@ -1449,6 +1449,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
self.scrollNode = ASScrollNode()
self.scrollNode.view.delaysContentTouches = false
self.scrollNode.canCancelAllTouchesInViews = true
self.headerNode = PeerInfoHeaderNode(context: context, avatarInitiallyExpanded: avatarInitiallyExpanded, isOpenedFromChat: isOpenedFromChat, isSettings: isSettings)
self.paneContainerNode = PeerInfoPaneContainerNode(context: context, peerId: peerId)
@ -2679,7 +2680,9 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
membersUpdated = true
}
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: self.didSetReady && membersUpdated ? .animated(duration: 0.3, curve: .spring) : .immediate)
let infoUpdated = false // previousData != nil && (previousData?.cachedData == nil) != (data.cachedData == nil)
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: self.didSetReady && (membersUpdated || infoUpdated) ? .animated(duration: 0.3, curve: .spring) : .immediate)
}
}

View File

@ -423,8 +423,6 @@ public func pollResultsController(context: AccountContext, messageId: MessageId,
dismissImpl = { [weak controller] in
controller?.dismiss()
}
controller.isOpaqueWhenInOverlay = true
controller.blocksBackgroundWhenInOverlay = true
controller.acceptsFocusWhenInOverlay = true
return controller