badoo / Chatto

A lightweight framework to build chat applications, made in Swift
MIT License
4.47k stars 590 forks source link

Make KeyboardTracker extendable #113

Open zwang opened 8 years ago

zwang commented 8 years ago

Just want to start a discussion about this.

In our app, we have a different design about chat input bar. Chatto's default ChatInputBar and KeyboardTracker provided a very nice example about how to do things. I want to be able to re-use existing functionalities and also add my own by extending KeyboardTracker. Right now, this is not doable.

So maybe we can make KeyBoardTracker public and add methods to allow user to override/extend on each keyboard events. For example, I made some changes based on what I need at here https://github.com/zwang/Chatto/commit/c6b4230459f753202298f476259d0a3dc3bb2808 (There are some other changes I made for my need too, please ignore them for now). We can make a good default for most of people (which it already does) and also easy to extend if needed.

The use case for the change I made above is we want to show the ChatInputbar only half of the width of screen in landscape mode and when user type on the text input, we resize it to full width. So I need to know when user start editing, etc and also be able to adjust the inputContainerTrailingConstraint (I created a reference to it and made it public) constraints based on keyboard events.

diegosanchezr commented 8 years ago

They KeyboardTracker is a bit unstable at this point so it may be not a good idea to expose it as public API. We consider your feedback and we may introduce API to completely disable it so you can drag-drop your own implementation without conflicts.

zwang commented 8 years ago

Thank you for the consideration. Looking forward to know more about the plan. :)