mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
Fixed volume button to unmute action for round videos
Fixed video unmute tooltip
This commit is contained in:
parent
bd4b2544f4
commit
0fef406f8c
@ -3265,8 +3265,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let shouldBeActive = combineLatest(MediaManager.globalAudioSession.isPlaybackActive(), self.chatDisplayNode.historyNode.hasVisiblePlayableItemNodes)
|
let shouldBeActive = combineLatest(MediaManager.globalAudioSession.isPlaybackActive() |> deliverOnMainQueue, self.chatDisplayNode.historyNode.hasVisiblePlayableItemNodes)
|
||||||
|> deliverOnMainQueue
|
|
||||||
|> mapToSignal { [weak self] isPlaybackActive, hasVisiblePlayableItemNodes -> Signal<Bool, NoError> in
|
|> mapToSignal { [weak self] isPlaybackActive, hasVisiblePlayableItemNodes -> Signal<Bool, NoError> in
|
||||||
if hasVisiblePlayableItemNodes && !isPlaybackActive {
|
if hasVisiblePlayableItemNodes && !isPlaybackActive {
|
||||||
return Signal<Bool, NoError> { [weak self] subscriber in
|
return Signal<Bool, NoError> { [weak self] subscriber in
|
||||||
@ -3287,6 +3286,7 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
|||||||
guard let strongSelf = self, strongSelf.traceVisibility() && isTopmostChatController(strongSelf) else {
|
guard let strongSelf = self, strongSelf.traceVisibility() && isTopmostChatController(strongSelf) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
strongSelf.videoUnmuteTooltipController?.dismiss()
|
||||||
strongSelf.chatDisplayNode.playFirstMediaWithSound()
|
strongSelf.chatDisplayNode.playFirstMediaWithSound()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1493,14 +1493,16 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
var hasUnconsumed = false
|
var hasUnconsumed = false
|
||||||
self.historyNode.forEachVisibleItemNode { itemNode in
|
self.historyNode.forEachVisibleItemNode { itemNode in
|
||||||
if let itemNode = itemNode as? ChatMessageItemView, let (action, _, _, isUnconsumed, _) = itemNode.playMediaWithSound() {
|
if let itemNode = itemNode as? ChatMessageItemView, let (action, _, _, isUnconsumed, _) = itemNode.playMediaWithSound() {
|
||||||
if case let .visible(fraction) = itemNode.visibility {
|
if case let .visible(fraction) = itemNode.visibility, fraction > 0.7 {
|
||||||
hasUnconsumed = isUnconsumed
|
|
||||||
actions.insert((fraction, isUnconsumed, action), at: 0)
|
actions.insert((fraction, isUnconsumed, action), at: 0)
|
||||||
|
if !hasUnconsumed && isUnconsumed {
|
||||||
|
hasUnconsumed = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (fraction, isUnconsumed, action) in actions {
|
for (_, isUnconsumed, action) in actions {
|
||||||
if fraction > 0.7 && (!hasUnconsumed || isUnconsumed) {
|
if (!hasUnconsumed || isUnconsumed) {
|
||||||
action()
|
action()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -751,11 +751,11 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
|||||||
|
|
||||||
func playMediaWithSound() -> (action: () -> Void, soundEnabled: Bool, isVideoMessage: Bool, isUnread: Bool, badgeNode: ASDisplayNode?)? {
|
func playMediaWithSound() -> (action: () -> Void, soundEnabled: Bool, isVideoMessage: Bool, isUnread: Bool, badgeNode: ASDisplayNode?)? {
|
||||||
if let item = self.item {
|
if let item = self.item {
|
||||||
var notConsumed = false
|
var isUnconsumed = false
|
||||||
for attribute in item.message.attributes {
|
for attribute in item.message.attributes {
|
||||||
if let attribute = attribute as? ConsumableContentMessageAttribute {
|
if let attribute = attribute as? ConsumableContentMessageAttribute {
|
||||||
if !attribute.consumed {
|
if !attribute.consumed {
|
||||||
notConsumed = true
|
isUnconsumed = true
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -782,7 +782,7 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, false, true, !notConsumed, nil)
|
}, false, true, isUnconsumed, nil)
|
||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user