Various improvements

This commit is contained in:
Ilya Laktyushin
2023-02-06 18:28:18 +04:00
parent a5bd955643
commit 78b02192cf
7 changed files with 180 additions and 63 deletions

View File

@@ -687,41 +687,41 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
}
strongSelf.context.sharedContext.mediaManager.playlistControl(.setBaseRate(baseRate), type: type)
var hasTooltip = false
strongSelf.forEachController({ controller in
if let controller = controller as? UndoOverlayController {
hasTooltip = true
controller.dismissWithCommitAction()
}
return true
})
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
let slowdown: Bool?
if baseRate == .x1 {
slowdown = true
} else if baseRate == .x2 {
slowdown = false
} else {
slowdown = nil
}
if let slowdown = slowdown {
strongSelf.present(
UndoOverlayController(
presentationData: presentationData,
content: .audioRate(
slowdown: slowdown,
text: slowdown ? presentationData.strings.Conversation_AudioRateTooltipNormal : presentationData.strings.Conversation_AudioRateTooltipSpeedUp
),
elevatedLayout: false,
animateInAsReplacement: hasTooltip,
action: { action in
return true
}
),
in: .current
)
}
// var hasTooltip = false
// strongSelf.forEachController({ controller in
// if let controller = controller as? UndoOverlayController {
// hasTooltip = true
// controller.dismissWithCommitAction()
// }
// return true
// })
//
// let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
// let slowdown: Bool?
// if baseRate == .x1 {
// slowdown = true
// } else if baseRate == .x2 {
// slowdown = false
// } else {
// slowdown = nil
// }
// if let slowdown = slowdown {
// strongSelf.present(
// UndoOverlayController(
// presentationData: presentationData,
// content: .audioRate(
// slowdown: slowdown,
// text: slowdown ? presentationData.strings.Conversation_AudioRateTooltipNormal : presentationData.strings.Conversation_AudioRateTooltipSpeedUp
// ),
// elevatedLayout: false,
// animateInAsReplacement: hasTooltip,
// action: { action in
// return true
// }
// ),
// in: .current
// )
// }
})
}
mediaAccessoryPanel.togglePlayPause = { [weak self] in