Did you find this summary helpful?
Thank you for your feedback
Handler Notifications generated by Shoplive Shortform are delivered to the client through the ShopLiveShortformReceiveHandlerDelegate
function and process as needed.
protocol ShopLiveShortformReceiveHandlerDelegate : AnyObject {
@objc optional func handleShare(shareMetadata : ShopLiveShareMetaData)
@objc optional func onError(error: Error)
@objc optional func onEvent(command: String, payload: String?)
@objc optional func onDidDisAppear()
@objc optional func onDidAppear()
@objc optional func handleProductItem(shortsId : String, shortsSrn : String, product : ProductData)
@objc optional func handleProductBanner(shortsId : String, shortsSrn : String, scheme : String, shortsDetail : ShortsDetailData)
}
//Adopting the handler.
class ViewController : ShopLiveShortformReceiveHandlerDelegate {
override func viewDidLoad(){
super.viewDidLoad()
ShopLiveShortform.Delegate.setDelegate(self)
}
}
onEvent(command: String, payload: String?) Shoplive Shortform provides a messageCallback function that allows you to handle various events directly
Shortform Events
onError(error: Error) Provides a messageCallback function that allows direct handling of errors occurring in Shoplive Shortform.
ShopLiveCommonError
Field
Type
Description
code
Int
Shoplive Error code
message
String?
Error message
error
Error?
origin Error provided by operating system(if exists)
class ViewController : UIViewController, ShopLiveShortformReceiveHandlerDelegate {
func onError(error : Error) {
if let error = error as? ShopLiveCommonError {
if let code = error.code {
//do something
}
if let message = error.message {
//do something
}
if let error = error.error {
//do something
}
}
}
}
handleShare(shareMetaData: ShopLiveShareMetaData) Developing direct sharing functionality in Shoplive Shortform.
field
type
description
shortsId
String?
Shortform unique identifier
shortsSrn
String?
ID containing unique information for Shortform
title
String?
Shortform title (for og tag purposes)
descriptions
String?
Shortform description (for og tag purposes)
thumbnail
String?
Shortform thumbnail (for og tag purposes)
class ViewController : ShopLiveShortformReceiveHandlerDelegate {
func handleShare(shareMetaData: ShopLiveShareMetaData) {
//Do something
}
}
onDidAppear() You can receive the Shoplive Shortform's ‘Full-type screen’ open event.
class ViewController : ShopLiveShortformReceiveHandlerDelegate {
func onDidAppear() {
//ex) stop ListView player when entering Shortform detail
builder?.disablePlayVideos()
}
}
onDidDisAppear() You can receive the Shoplive Shortform's ‘Full-type screen’ close event.
class ViewController : ShopLiveShortformReceiveHandlerDelegate {
func onDidDisAppear(shareUrl: String) {
//ex) play ListView players when ListView reappeared
builder?.enablePlayVideos()
}
}
handleProductItem(shortsId : String, shortsSrn : String, product : Product) You can develop a direct product click feature in Shoplive Shortform.
class ViewController : ShopLiveShortformNativeHandlerDelegate {
func handleProductItem(shortsId : String, shortsSrn : String, product : Product) {
//ex) Show preview when product is clicked with sku
ShopLiveShortform.showPreview(requestData: ShopLiveShortformRelatedData(sku: product.sku))
}
}
field
type
description
brand
String?
Brand information of the product
currency
String?
Currency of the product
description
String?
Description of the product
discountPrice
Double?
Discounted price of the product
discountRate
Double?
Discount percentage of the product
imageUrl
String?
Product image URL
name
String?
Product name
originalPrice
Double?
Regular price of the product
productId
String?
Unique ID of the product, automatically issued upon product registration
showPrice
Boolean
Displayed price of the product
sku
String?
Unique SKU information of the product
url
String?
URL of the product's detailed page
handleProductBanner(shortsid : String, shortsSrn : String, scheme : String, shortsDetail : ShortsDetail) You can develop a direct product banner click feature in Shoplive Shortform.
class ViewController : ShopLiveShortformNativeHandlerDelegate {
func handleProductBanner(shortsid : String, shortsSrn : String, scheme : String, shortsDetail : ShortsDetail) { {
}
}