Skip to main content

delegates

Delegates

LORA Short Video SDK provides various delegates to listen to events when tapping on an item, product CTA, or when errors occur.

public protocol BLShortVideoErrorDelegate: AnyObject {
/// Callback when any error occur
/// - Parameters:
/// - view: ShortVideoView
/// - error: ShortVideoError error
func shortVideoView(view: ShortVideoView, onError error: ShortVideoError)
}

public protocol BLShortVideoItemDelegate: AnyObject {
/// Callback when short video item is clicked
/// - Parameters:
/// - view: ShortVideoView
/// - videoId: videoId
func shortVideoView(view: ShortVideoView, itemDidClick videoId: String)
}

public protocol BLShortVideoShareItemDelegate: NSObject {
/// Callback when share button is clicked
/// - Parameters:
/// - videoId: videoId
/// - handle: if handle completion is `true`, nothing happen otherwise it'll show default system share
func shortVideoItemDidShare(videoId: String, handle: @escaping (Bool) -> Void)
}

public protocol BLShortVideoProductItemCTADelegate: AnyObject {
/// Callback when product item call to action button is clicked
/// - Parameter product: product object
func shortVideoViewProductItemCTADidClick(product: BLShortVideoProduct)
}

public protocol BLShortVideoSubmitPollErrorDelegate: AnyObject {
/// Callback when any error occur
/// - Parameters:
/// - errorCode: Error code
func onSubmitPollError(errorCode: Int)
}

public protocol BLShortVideoSubmitQnAErrorDelegate: AnyObject {
/// Callback when any error occur during submit default answer
/// - Parameters:
/// - errorCode: Error code
func onSubmitDefaultAnswerError(errorCode: Int)

/// Callback when any error occur during submit followup answer
/// - Parameters:
/// - errorCode: Error code
func onSubmitFollowupAnswerError(errorCode: Int)
}