mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-13 14:56:03 +10:00
subscribeAction
This commit is contained in:
@@ -813,6 +813,15 @@ class ConversationViewController: BaseViewController {
|
||||
}
|
||||
|
||||
delay(1) { [weak self] in
|
||||
|
||||
self?.subscribeView.subscribeAction = { [weak self] in
|
||||
if let groupID = self?.conversation.withGroup?.groupID {
|
||||
joinGroup(groupID: groupID, failureHandler: nil, completion: {
|
||||
println("subscribe OK")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
self?.subscribeView.show()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,15 +34,23 @@ class SubscribeView: UIView {
|
||||
button.setTitle(NSLocalizedString("Subscribe", comment: ""), forState: .Normal)
|
||||
button.setTitleColor(UIColor.yepTintColor(), forState: .Normal)
|
||||
button.contentEdgeInsets = UIEdgeInsets(top: 8, left: 15, bottom: 8, right: 15)
|
||||
|
||||
button.addTarget(self, action: "subscribe:", forControlEvents: .TouchUpInside)
|
||||
|
||||
return button
|
||||
}()
|
||||
|
||||
lazy var dismissButton: UIButton = {
|
||||
let button = UIButton()
|
||||
button.setImage(UIImage(named: "icon_subscribe_close"), forState: .Normal)
|
||||
|
||||
button.addTarget(self, action: "dismiss:", forControlEvents: .TouchUpInside)
|
||||
|
||||
return button
|
||||
}()
|
||||
|
||||
var subscribeAction: (() -> Void)?
|
||||
|
||||
override func didMoveToSuperview() {
|
||||
|
||||
makeUI()
|
||||
@@ -110,9 +118,21 @@ class SubscribeView: UIView {
|
||||
func hide() {
|
||||
|
||||
UIView.animateWithDuration(0.25, delay: 0.0, options: .CurveEaseInOut, animations: { [weak self] in
|
||||
self?.bottomConstraint?.constant = -SubscribeView.height
|
||||
self?.bottomConstraint?.constant = SubscribeView.height
|
||||
self?.superview?.layoutIfNeeded()
|
||||
}, completion: { _ in })
|
||||
}
|
||||
|
||||
func subscribe(sender: BorderButton) {
|
||||
|
||||
subscribeAction?()
|
||||
|
||||
hide()
|
||||
}
|
||||
|
||||
func dismiss(sender: UIButton) {
|
||||
|
||||
hide()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user