eBay / NMessenger

A fast, lightweight messenger component built on AsyncDisplaykit and written in Swift
Other
2.42k stars 272 forks source link

Disable sending image button issue #169

Open talis00051 opened 6 years ago

talis00051 commented 6 years ago

Is there a way to disable the Photo or Gallery button in the input view?

dodikk commented 6 years ago

@talis00051 , I'm afraid it's not. Feel free adding the missing @IBOutlet open weak var plusButton to

https://github.com/eBay/NMessenger/blob/master/nMessenger/Source/Messenger/Components/InputBarView/NMessengerBarView.swift

dodikk commented 6 years ago

@talis00051 , actually, my fork has it, so you can give it a try https://github.com/dodikk/NMessenger/blob/latest-fixes/nMessenger/Source/Messenger/Components/InputBarView/NMessengerBarView.swift#L28

P.S. It's not swift 4 compatible yet. Sorry.

talis00051 commented 6 years ago

Sorry, but how to disable the photo button after added this line? btw I am using swift 3 only, haha

dodikk commented 6 years ago

An IBOutlet for button by @talis00051 https://github.com/eBay/NMessenger/pull/171

dodikk commented 6 years ago

Sorry, but how to disable the photo button after added this line?

@talis00051 , Have you tried this?

let castedBarView = super.inputBarView as! NMessengerBarView
castedBarView.plusButton.isEnabled = false
dodikk commented 6 years ago

@talis00051 , the example above is an ugly prototype. I suggest retaining a reference to NMessengerBarView in func getInputBar().

public override func getInputBar() -> InputBarView
{
   let barView = /*load from your own nib or from a default one */
   // more customizations
   //   

    self._castedBarView = barView
}
talis00051 commented 6 years ago

Thank you! I have finally disabled it.