badoo / badoo/Chatto

Could you make it possible to update chatItemPresenter factory after BaseChatViewController's viewDidLoad?

Open
#471 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Swift
Stars
4.6k
Forks
588
PR merge metrics
No merged PRs in 30d

Description

I am working on a functionality that would require changing `chatItemPresenter` font after some user interaction on the view controller.

This is completely easy but the chatViewController is only asked to set the `presenterFactory` (ChatItemPresenterFactoryProtocol) once on the `viewDidLoad` execution which means it will not change unless we re-show it completely again.

I tried to access baseChatViewController's `presenterFactory` from its subclass but it's not a public property so it failed. I then thought of overriding public method `createPresenterForChatItem(_ chatItem: ChatItemProtocol)` but it is declared in `baseChatViewController's` extension which makes it impossible.

So therefore I would like to ask if one of the following would be possible to add in one of the upcoming releases:

1. Adding a public method that could trigger reloading presenterFactory for a chatViewController that could contain parts like:
``self.presenterFactory = self.createPresenterFactory()
self.presenterFactory.configure(withCollectionView: self.collectionView)``
that we could trigger on-demand after baseChatViewController's viewDidLoad.
2. Moving `public func createPresenterForChatItem(_ chatItem: ChatItemProtocol)` outside of extension declaration.
3. Making chatViewController's `presenterFactory` public.

I am of course aware options 2 and 3 aren't perhaps the most wanted but at least allowing trigger option 1. on developer demand might help some users among which I founded myself already.

Thank you in advance!

Contributor guide

Open the contributing guide

Research direction

Start with BaseChatViewController's viewDidLoad, presenterFactory setup, and createPresenterForChatItem(_:) to understand how presenters are created and configured. Decide which requested public API best supports refreshing the presenter factory after viewDidLoad, then verify that a chat item’s font can change after user interaction without showing the controller again.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.