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.
- Initialize the SDK and create an instance of
SpotImSDKFlowCoordinator
as described in
Add and initialize the OpenWeb iOS SDK and SpotImSDKFlowCoordinator
- 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")
- Open the comment creation screen by calling
openNewCommentViewController
on theSpotImSDKFlowCoordinator
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.
Updated about 2 months ago
Did this page help you?