mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-26 05:05:52 +10:00
choosePhotoAction
This commit is contained in:
@@ -149,10 +149,29 @@ class ConversationViewController: BaseViewController {
|
||||
lazy var moreView: ConversationMoreView = ConversationMoreView()
|
||||
|
||||
lazy var moreMessageTypesView: MoreMessageTypesView = {
|
||||
|
||||
let view = MoreMessageTypesView()
|
||||
|
||||
view.pickLocationAction = { [weak self] in
|
||||
self?.performSegueWithIdentifier("presentPickLocation", sender: nil)
|
||||
}
|
||||
|
||||
view.choosePhotoAction = { [weak self] in
|
||||
|
||||
let openCameraRoll: ProposerAction = { [weak self] in
|
||||
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary){
|
||||
if let strongSelf = self {
|
||||
strongSelf.imagePicker.sourceType = .PhotoLibrary
|
||||
strongSelf.presentViewController(strongSelf.imagePicker, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proposeToAccess(.Photos, agreed: openCameraRoll, rejected: {
|
||||
self?.alertCanNotAccessCameraRoll()
|
||||
})
|
||||
}
|
||||
|
||||
return view
|
||||
}()
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ class MoreMessageTypesView: UIView {
|
||||
}()
|
||||
|
||||
|
||||
var choosePhotoAction: (() -> Void)?
|
||||
var pickLocationAction: (() -> Void)?
|
||||
|
||||
|
||||
var tableViewBottomConstraint: NSLayoutConstraint?
|
||||
|
||||
func showInView(view: UIView) {
|
||||
@@ -237,6 +237,10 @@ extension MoreMessageTypesView: UITableViewDataSource, UITableViewDelegate {
|
||||
|
||||
if let row = Row(rawValue: indexPath.row) {
|
||||
switch row {
|
||||
case .PickPhotos:
|
||||
hideAndDo {
|
||||
choosePhotoAction?()
|
||||
}
|
||||
case .Location:
|
||||
hideAndDo {
|
||||
pickLocationAction?()
|
||||
|
||||
Reference in New Issue
Block a user