mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-11 13:56:10 +10:00
playOrPauseAudioAction for FeedVoiceContainerView
This commit is contained in:
@@ -327,6 +327,12 @@ class FeedSocialWorkCell: FeedBasicCell {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
voiceContainerView.playOrPauseAudioAction = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
strongSelf.playOrPauseAudioAction?(strongSelf)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -387,11 +393,6 @@ class FeedSocialWorkCell: FeedBasicCell {
|
||||
|
||||
// MARK: Actions
|
||||
|
||||
@IBAction func playOrPauseAudio(sender: UIButton) {
|
||||
|
||||
playOrPauseAudioAction?(self)
|
||||
}
|
||||
|
||||
func tapDribbbleMedia(sender: UITapGestureRecognizer) {
|
||||
|
||||
guard let feed = feed, attachment = feed.attachment else {
|
||||
|
||||
@@ -10,6 +10,8 @@ import UIKit
|
||||
|
||||
class FeedVoiceContainerView: UIView {
|
||||
|
||||
var playOrPauseAudioAction: (() -> Void)?
|
||||
|
||||
var audioPlaying: Bool = false {
|
||||
willSet {
|
||||
if newValue != audioPlaying {
|
||||
@@ -34,6 +36,8 @@ class FeedVoiceContainerView: UIView {
|
||||
button.setImage(UIImage(named: "icon_play"), forState: .Normal)
|
||||
button.tintColor = UIColor.lightGrayColor()
|
||||
button.tintAdjustmentMode = .Normal
|
||||
|
||||
button.addTarget(self, action: "playOrPauseAudio:", forControlEvents: .TouchUpInside)
|
||||
return button
|
||||
}()
|
||||
|
||||
@@ -95,5 +99,9 @@ class FeedVoiceContainerView: UIView {
|
||||
|
||||
NSLayoutConstraint.activateConstraints([playButtonCenterY])
|
||||
}
|
||||
|
||||
@objc private func playOrPauseAudio(sender: UIButton) {
|
||||
playOrPauseAudioAction?()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user