Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChatBubbleView update() method impossible to override #12

Open
arthef opened this issue Apr 17, 2020 · 5 comments
Open

ChatBubbleView update() method impossible to override #12

arthef opened this issue Apr 17, 2020 · 5 comments

Comments

@arthef
Copy link

arthef commented Apr 17, 2020

Hi,
I tried to reimplement the update method to put a custom content in the chat message, customize the chat bubble view and other things.
I am mostly interested in reimplementing the part within "if(changed) {...}" part, hoping to leave the rest of the code unchanged/copied.
However, the update() method uses lots of private fields and methods and most of the code in the class is private. This makes it nearly impossible to extended and customize some parts only.

I would suggest to change the access modifier to protected for most of the class members and/or split the update() method into smaller piece of code located in separate methods. This would allow for easier extensibility and flexibility in the future.

@shannah
Copy link
Owner

shannah commented Apr 17, 2020

I'm reluctant to open it up too much as it can make it difficult to maintain/evolve the class. What kinds of customizations did you want to do? I might be able to make some more prices protected methods that would allow you to perform particular types of customizations. My hope is that most customizations of this component are achieved using actions, and the view model.

@arthef
Copy link
Author

arthef commented Apr 17, 2020

Hi,
As mentioned before. I would like to customize content of the bubble chat view. Like, including avatar and name of the chat which isOwn == true and possibly some other things in the future.

Maybe if you could take out the part of the update() method within "if(changed) {....}" to a separate method "draw(...)" or something, then I could overload the method and add some custom content into the bubble chat view.

@shannah
Copy link
Owner

shannah commented Apr 17, 2020

Using inheritance for that type of change is risky as it would likely conflict with later changes that add features to the core class later. Better to either copy the class and make changes like that, and/or modify the class and submit a pull request.

@arthef
Copy link
Author

arthef commented Apr 17, 2020

Ok, thanks. I will think of the best way to do customizations then.

@shannah
Copy link
Owner

shannah commented Apr 17, 2020

If I get around to implementing it, I think I will opt for the view property approach. I.e. define a view property that defines the avatar settings for the bubbles. It could be a boolean, or maybe an enum type (e.g. AlwaysIncludeAvatar,IncludeAvatarOnOther,IncludeAvatarOnOwn,NeverIncludeAvatar).

I'm not sure if I've documented view properties yet...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants