Add a full Conversation

Show the full conversation screen directly in your iOS app.

This approach allows you to open a full Conversation screen directly without displaying a Pre-Conversation View Controller.



Requirement

    OpenWeb iOS SDK



Implementation

Use the following steps to add a Conversation:

  1. Create an instance of SpotImSDKFlowCoordinator. Make sure to have a strong reference, otherwise the instance of SpotImSDKFlowCoordinator will be deallocated.
SpotIm.createSpotImFlowCoordinator(loginDelegate: self) { [weak self] result in
    guard let self = self else { return }                                                     
        switch result {
            case .success(let coordinator):
            self.spotIMCoordinator = coordinator
            case .failure(let error):
            print(error)
        }
}

  1. Create and define SpotImArticleMetadata.
let articleMetadata = SpotImArticleMetadata(url: "URL TO THE ARTICLE PAGE                                           ON THE WEB", 
                      title: "ARTICLE TITLE", 
                      subtitle: "ARTICLE SUBTITLE", 
                      thumbnailUrl: "URL TO ARTICLE THUMBNAIL IMAGE")

  1. Present the full Conversation modally or push the full Conversation to the host app navigator controller. In either scenario, call openFullConversationViewController on the SpotImSDKFlowCoordinator instance.
self.coordinator.openFullConversationViewController(
  postId: self.postId,
  articleMetadata: self.metadata,
  presentationalMode: .present(viewController: self),
    completion: completionHandler)

// Method signature:
public func openFullConversationViewController(postId: String,
                                   articleMetadata: SpotImArticleMetadata,
                                   presentationalMode: SPViewControllerPresentationalMode,
                                   selectedCommentId: String? = nil,
                                   completion: SPShowFullConversationCompletionHandler? = nil)

// SPViewControllerPresentationalMode enum
public enum SPViewControllerPresentationalMode {
    case present(viewController: UIViewController)
    case push(navigationController: UINavigationController)
}
self.coordinator.openFullConversationViewController(
  postId: self.postId,
  articleMetadata: self.metadata,
  presentationalMode: .push(navigationController: self.navigationController!)
    completion: completionHandler)

// Same method as on the "Present Conversation modally" tab but with .push mode

  1. (Optional) Customize the Conversation.