parley-messaging / ios-library

Parley iOS app library
MIT License
2 stars 2 forks source link

Add possibility to show ParleyView when Parley.State is unconfigured and know when state changes to configuring #131

Closed nlamah closed 3 weeks ago

nlamah commented 4 weeks ago

Describe the Bug When the ParleyView is added to the viewStack too long before initialize is called on Parley on runtime the app will crash on forcefully unwrapped value messagesManager. However in code it seems possible to that the view could deal with 'unconfigured` Parley, so is that considered a bug?

In case the view is added to the view stack on the completion of the configure function the view suffers from reloading the tableView when being presented which looks messy.

Would it be and idea to fix the bug that the chatView can be presented before Parley is initialised and show until 'configured' or 'failure' state the loading indicator?

Steps To Reproduce See the branch in my Fork for the intended way a viewController is presented 'add-parleyview-after-parley-is-configured'

https://github.com/nlamah/parley-ios-library/pull/3

Expected behaviour A loader is shown, because the state is configuring until the state is configured, and the tableView is loaded, including the delay for the scroll to bottom https://github.com/parley-messaging/ios-library/blob/master/Sources/Parley/Views/ParleyView.swift#L528.

Screenshots

https://github.com/parley-messaging/ios-library/assets/2762698/dc35c3a5-da31-4076-b2cd-a8280e9a8e4f

alexkok commented 4 weeks ago

Thanks for reporting. Hmm, yeah the ParleyView is intended to be displayable at all states. Having Parley configured or not should not crash indeed.

Maybe some recent change caused this, have to check what causes this.

The scroll to bottom is visible probably due to the chat being loaded, but the scroll being animated.

nlamah commented 3 weeks ago

@alexkok This issue is blocking for our release.

It causes that sometimes the latest sometimes the last messages are not visible when opening the view. The chance that it happens is bigger on the newer devices with a home indicator (without a home button).

https://github.com/parley-messaging/ios-library/assets/2762698/cbda7cd1-7910-4e04-81d5-b997b0365e0d

alexkok commented 3 weeks ago

Thanks for reporting and the suggested PR @nlamah

We decided to fix it slightly different: making the messagesManager optional to reflect this neatly for future versions (see #134).

alexkok commented 3 weeks ago

Fixed in 4.1.4 🚀