Listen to user actions

Implementation

You can listen to user actions through the VFActionsCallbacks object.

let callbacks: VFActionsCallbacks = { type in
   switch type {
       case .seeMoreCommentsPressed:
            break
       default:
            break
   }
}
        
guard let preCommentsViewController = VFPreviewCommentsViewController.new(containerId: articleViewModel.story.containerId, articleMetadata: articleViewModel.articleMetadata, loginDelegate: self, settings: settings) else {
	return
}
        
preCommentsViewController.setActionCallbacks(callbacks: callbacks)
let callbacks: VFActionsCallbacks = { type in
	switch type {
		case .closeNewCommentPressed:
		break
		default:
		break
  }
}
        
guard let newCommentViewController = VFNewCommentViewController.new(newCommentActionType: actionType, containerId: containerId, articleMetadata: articleMetadata, loginDelegate: self, settings: settings) else{
	return
}
newCommentViewController.setActionCallbacks(callbacks: callbacks)
let callbacks: VFActionsCallbacks = { type in
    switch type {
        default:
           break
    }
}
        
guard let profileViewController = VFProfileViewController.new(userUUID: userUUID, presentationType: presentationType, loginDelegate: self, settings: settings) else{
    return
}
profileViewController.setActionCallbacks(callbacks: callbacks)

VFActionCallbackType

VFActionCallbackTypeDescription
closeNewCommentPressedClose new comment button pressed
seeMoreCommentsPressed()See more comments button pressed
writeNewCommentPressed(let actionType)New comment box pressed
openProfilePressed(let userUUID)Open profile view pressed
closeProfilePressedClose profile button pressed
trendingArticlePressed(let metadata, let containerId)Trending article pressed
notificationPressed(let presentationType)Notification pressed

What’s Next