Event handler

    Event handler


    Article summary

    Shoplive Shortform Notifications are received by the client through the Handler function and process as needed.

    ShopLiveShortform.setHandler(object : ShopLiveShortformHandler() {
    	override fun getOnClickProductListener(): ShopLiveShortformProductListener {
    	    return ShopLiveShortformProductListener { data, product ->
    	        // Something landing customer
        	}
    	}
    
    	override fun getOnClickBannerListener(): ShopLiveShortformUrlListener {
        	return ShopLiveShortformUrlListener { data, url ->
            	// Something landing customer
    	    }
    	}
    
    	override fun onEvent(context: Context, command: String, payload: String?) {
    		// Do something
    	}
            
    	override fun onError(context: Context, error: ShopLiveCommonError) {
    		// Do something
    	}
            
    	override fun onShare(context: Context, data: ShopLiveShortformShareData) {
    		// Do something
    	}
      
    	override fun onCreate() {
    		// Do something
    	}
      
    	override fun onDestroy() {
    		// Do something
    	}
    })

    onEvent

    Shoplive Shortform provides a onEvent(context: Context, command: String, payload: String?) function that allows you to directly handle various events that occur.


    onError

    Shoplive Shortform provides a onError(context: Context, error: ShopLiveCommonError) function that allows direct handling of errors occurring in Shoplive Shortform.

    ShopLiveCommonError

    Property name

    Type

    Description

    code

    Int

    ShopLiveCommonErrorCode

    message

    String?

    Error message

    cause

    Throwable?

    Error cause


    onShare

    You can develop direct sharing functionality in Shoplive Shortform with onShare(context: Context, data: ShopLiveShortformShareData).

    ShopLiveShortformShareData

    Property name

    Type

    Description

    shortsId

    String?

    Shortform unique identifier

    srn

    String?

    ID containing unique information for Shortform

    title

    String?

    Shortform title (for og tag purposes)

    description

    String?

    Shortform description (for og tag purposes)

    thumbnail

    String?

    Shortform thumbnail (for og tag purposes)


    onCreate

    You can develop features required for entering the Shortform detail view with the onCreate().


    onDestroy

    You can develop features required for closing the Shortform detail view with the onDestroy().


    ShopLiveShortformProductListener

    onClick

    With the onClick(data: ShopLiveShortformIdentifier?, product: ShopLiveShortformProductData), you can develop the direct product click feature in Shoplive Shortform. Refer to the Creating a product guide.

    ShopLiveShortformIdentifier

    Property name

    Type

    Description

    shortsId

    String?

    Shortform unique identifier

    srn

    String?

    ID containing unique information for Shortform

    ShopLiveShortformProductData

    Property name

    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

    Long?

    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


    ShopLiveShortformUrlListener

    onClick(data: ShopLiveShortformIdentifier?, url: String)

    With the onClick(data: ShopLiveShortformIdentifier?, url: String),  you can develop a direct product banner click feature in Shoplive Shortform. Refer to the Creating a product banner.

    ShopLiveShortformIdentifier

    Property name

    Type

    Description

    shortsId

    String?

    Shortform unique identifier

    srn

    String?

    ID containing unique information for Shortform