slackhq / SlackTextViewController

⛔️**DEPRECATED** ⛔️ A drop-in UIViewController subclass with a growing text input view and other useful messaging features
https://slack.com/
MIT License
8.32k stars 1.08k forks source link

Paging support? #602

Closed tethridge closed 7 years ago

tethridge commented 7 years ago

I haven't been able to find any information about how the SlackTextViewController handles a large history of messages. Is there any documentation or a sample that describes how to page in history as the user scrolls back in time?

hamchapman commented 7 years ago

I couldn't find anything about how to best do this either and so I've got something like this now:

override func scrollViewDidScroll(_ scrollView: UIScrollView) {
    let scrollViewHeight = scrollView.frame.size.height
    let scrollContentSizeHeight = scrollView.contentSize.height
    let scrollOffset = scrollView.contentOffset.y

    if scrollOffset + scrollViewHeight >= scrollContentSizeHeight {
        fetchOlderMessages()
    }
    super.scrollViewDidScroll(scrollView)
}

slk_isAtTop didn't work for me as it always seemed to return true no matter what.

tethridge commented 7 years ago

I found a library that seems to work alright. It doesn't show the UIActivityIndicator row when the scrollview is reversed (as it is by default). It shows as you're dragging, but not if you let go of the screen.

I haven't spent the time to figure out why the inset isn't working. It may be due to the insets that the Slack VC sets that is overriding the intended functionality.

https://github.com/icodesign/ICSPullToRefresh.Swift

Thanks for the help though!