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)
|
||||
|> deliverOnMainQueue
|
||||
let shouldBeActive = combineLatest(MediaManager.globalAudioSession.isPlaybackActive() |> deliverOnMainQueue, self.chatDisplayNode.historyNode.hasVisiblePlayableItemNodes)
|
||||
|> mapToSignal { [weak self] isPlaybackActive, hasVisiblePlayableItemNodes -> Signal<Bool, NoError> in
|
||||
if hasVisiblePlayableItemNodes && !isPlaybackActive {
|
||||
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 {
|
||||
return
|
||||
}
|
||||
strongSelf.videoUnmuteTooltipController?.dismiss()
|
||||
strongSelf.chatDisplayNode.playFirstMediaWithSound()
|
||||
})
|
||||
|
||||
|
@ -1493,14 +1493,16 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
var hasUnconsumed = false
|
||||
self.historyNode.forEachVisibleItemNode { itemNode in
|
||||
if let itemNode = itemNode as? ChatMessageItemView, let (action, _, _, isUnconsumed, _) = itemNode.playMediaWithSound() {
|
||||
if case let .visible(fraction) = itemNode.visibility {
|
||||
hasUnconsumed = isUnconsumed
|
||||
if case let .visible(fraction) = itemNode.visibility, fraction > 0.7 {
|
||||
actions.insert((fraction, isUnconsumed, action), at: 0)
|
||||
if !hasUnconsumed && isUnconsumed {
|
||||
hasUnconsumed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (fraction, isUnconsumed, action) in actions {
|
||||
if fraction > 0.7 && (!hasUnconsumed || isUnconsumed) {
|
||||
for (_, isUnconsumed, action) in actions {
|
||||
if (!hasUnconsumed || isUnconsumed) {
|
||||
action()
|
||||
break
|
||||
}
|
||||
|
@ -751,11 +751,11 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
|
||||
func playMediaWithSound() -> (action: () -> Void, soundEnabled: Bool, isVideoMessage: Bool, isUnread: Bool, badgeNode: ASDisplayNode?)? {
|
||||
if let item = self.item {
|
||||
var notConsumed = false
|
||||
var isUnconsumed = false
|
||||
for attribute in item.message.attributes {
|
||||
if let attribute = attribute as? ConsumableContentMessageAttribute {
|
||||
if !attribute.consumed {
|
||||
notConsumed = true
|
||||
isUnconsumed = true
|
||||
}
|
||||
break
|
||||
}
|
||||
@ -782,7 +782,7 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
}
|
||||
})
|
||||
}
|
||||
}, false, true, !notConsumed, nil)
|
||||
}, false, true, isUnconsumed, nil)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user