Open comment creation page directly
Show the create a comment screen directly in your iOS app.
This approach allows you to open a comment creation screen. When implemented, a user sees the comment creation screen directly above the full Conversation screen.
If the Conversation is in
readOnlyMode, only the Conversation will be shown and the new comment screen will not open.
Requirement
Implementation
Use the following steps to configure the Conversation:
- Create an instance of
SpotImSDKFlowCoordinator. Make sure to have a strong reference, otherwise the instance ofSpotImSDKFlowCoordinatorwill 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)
}
}- 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
openNewCommentViewControlleron theSpotImSDKFlowCoordinatorinstance.
Notice the
fullConversationPresentationalMode. It is used to determine whether the full Conversation below will be pushed (.push) or presented (.present).
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)
}- (Optional) Customize the Conversation.
Updated about 1 month ago
