Open comment creation page directly

OpenWeb allows you to open a comment creation screen with the full conversation screen below directly.

Implementation

Use the following guidance to implement this feature.


  1. Initialize the SDK and create an instance of SpotImSDKFlowCoordinator as described in
    Add and initialize the OpenWeb iOS SDK and SpotImSDKFlowCoordinator

  1. Create and set 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. Open the comment creation screen by calling openNewCommentViewController on the SpotImSDKFlowCoordinator instance.
openNewCommentViewController(
  postId: self.postId,
  articleMetadata: self.metadata,
  fullConversationPresentationalMode: .push(navigationController: self.navigationController!),
  completion: completionHandler)

// Method signature:
public func openNewCommentViewController(postId: String,
                             articleMetadata: SpotImArticleMetadata,
                             fullConversationPresentationalMode: SPViewControllerPresentationalMode,
                             completion: SPOpenNewCommentCompletionHandler? = nil)

// SPViewControllerPresentationalMode enum
public enum SPViewControllerPresentationalMode {
    case present(viewController: UIViewController)
    case push(navigationController: UINavigationController)
}

Notice the fullConversationPresentationalMode. It is used to determine whether the full conversation below will be pushed or presented. Options are: .push or .present

In case the conversation is in readOnlyMode, only the conversation will be shown and the new comment screen won't open.


Did this page help you?