-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Customizing typing indicators. #201
Comments
Hmm.. Making the [textViewController.typingIndicatorView insertUsername:@"some user"]; Bah. Maybe a subclass must be required for backwards compatibility of the API. |
Thanks @sveinhal for bringing this up. I've been wanting to decouple the
I don't think it would be necessary to subclass @interface SLKTypingIndicatorView : UIView <SLKTypingIndicatorProtocol> These would be the required accessors to conform to // To let its parent controller (aka SLKTextViewController) know is visibility state and allow backwards compatibility.
@property (nonatomic, readwrite, getter = isVisible) BOOL visible;
// To allow a good auto-layout compatibility
- (CGSize)intrinsicContentSize; I think this should make the changes pretty straightforward, and also, deliver a simple to use API to any user that would like to extend the built-in typing indicator by creating its own approach. What do you think? |
Is API backwards compatibility a requirement? If so, some people may have called |
… or we break source code compatibility. |
Good point. I will think about this, since I wouldn't like to add all the properties and methods to the new protocol. Any suggestions? |
+1 on this, would love to see some flexibility here. I think as this project gets more popular, it might make sense to think more about generalizing a little outside of the context of messaging, which I think might inevitably call for some breaking API changes. Though no easy answer to how to go about deprecating/breaking a new major release. I'd like to use it as just a generic indicator view, semantically detached from a concept of user typing. So in that sense the current api of |
Suggestion: Add a general |
Sounds like a good plan! |
Ok. I'll make a first take on an implementation, and create a pull request :-) |
Hi, @dzenbot
I created an issue before creating a pull request, because I want to discuss solutions before submitting anything. I am willing to produce the code necessary to close this issue, once consensus has been reached.
I want to customize the typing indicators to show small avatars instead of the user name list as the current design encourages. The
SLKTextViewController
currently instantiates and hold a reference to aSLKTypingIndicatorView
. However, except for anisVisible
and ancanResignByTouch
property the view controller couldn't really care much what kind ofUIView
subclass this view is (and long as it knows when to show/hide the view).I'm thinking that we could extend the view controller to also have a method called
registerClassForTypingIndicatorView:
similar toregisterClassForTextView:
. But I'm not sure it's necessary to have it be a subclass ofSLKTypingIndicatorView
? I think that the view controller can observe changes to thehidden
property instead of relying on the custom notifications. This also uses hidden rather than visible, which is more cocoa-y. And for thecanResignByTouch
property, we can either have the custom class implement a protocol, or move the logic to be a property of the view controller instead.Alternatively, we could require that the custom class must be a subclass, but personally, I'm not really using any of its features.
What do you think?
The text was updated successfully, but these errors were encountered: