2

I am using the library Chatto (https://github.com/badoo/Chatto) for a chat window and initializing a view controller that inherits from it's BaseChatViewController.

The issue that i'm having is that while the scroll view can scroll all the way to the top and bottom of the conversation, the place where the scroll bar stops is inset about the same size as the nav bar on the top and the tab bar on the bottom.

The Chatto demo app doesn't appear to have this issue, so I'm wondering if there is something I should be doing differently in my app.

enter image description here

Here is the viewController

import Chatto
import ChattoAdditions
import RxSwift
import UIKit

class ConversationViewController: BaseChatViewController {

  var viewModel: ConversationViewModel!

  private let disposeBag = DisposeBag()

  override func viewDidLoad() {

    super.viewDidLoad()

    title = viewModel.title

  }

  override func viewWillAppear(_ animated: Bool) {

    super.viewWillAppear(animated)

    loadViewModel()

  }

  override func createChatInputView() -> UIView {

    return viewModel.chatInputView

  }

  override func createPresenterBuilders() -> [ChatItemType: [ChatItemPresenterBuilderProtocol]] {

    return viewModel.presenterBuilders

  }

}

// MARK: - MessagesSelectorDelegate

extension ConversationViewController: MessagesSelectorDelegate {

  func messagesSelector(_: MessagesSelectorProtocol, didSelectMessage _: MessageModelProtocol) {

    enqueueModelUpdate(updateType: .normal)

  }

  func messagesSelector(_: MessagesSelectorProtocol, didDeselectMessage _: MessageModelProtocol) {

    enqueueModelUpdate(updateType: .normal)

  }

}

// MARK: - Helpers

extension ConversationViewController {

  private func loadViewModel() {

    ActivityIndicator.shared.show(on: view)

    viewModel.load()
      .subscribe { [weak self] event in

        guard let self = self else {

          Log.error(
            "The ConversationViewController, while reacting to it's viewModel loading, was unable to unwrap self"
          )

          return

        }

        ActivityIndicator.shared.hide()

        switch event {

        case .completed:

          return

        case let .error(error):

          Log.error(error)

          self.presentErrorAlert(error)

        }

      }
      .disposed(by: disposeBag)

  }

}
koen
  • 5,383
  • 7
  • 50
  • 89
Brandt
  • 333
  • 3
  • 11
  • Please share any relevant code as a [example]. See also [ask] – koen Jan 23 '20 at 18:16
  • I've added the viewController which inherits from the libraries' BaseChatViewController. I am using Swinject to initialize it with all it's dependencies. The VC is pushed/shown from the previous VCs navigationController which is the root view for the tab. – Brandt Jan 24 '20 at 22:08
  • Where is the code where you set up your scroll view, are you using a storyboard? Could be something with incorrect auto layout settings. Does your scroll view have the inside on the right side? It's difficult to see from the picture. – koen Jan 25 '20 at 14:00
  • @koen not using a storyboard or nib, it is simply inheriting from their BaseChatViewController the same as DemoChatViewController in their demo app. – Brandt Mar 27 '20 at 23:35

0 Answers0