In Shoplive Player, notifications such as user UI events or state changes are conveyed to the client through handler (delegate) functions, and the necessary processing is performed.
delegate
Declare a function to receive handler events of the Shoplive iOS SDK, and it is a property that connects events with the Shoplive iOS SDK.
@objc var delegate: ShopLiveSDKDelegate? { get set }
When the Shoplive Player status changes, a ShopLiveViewTrackEvent is passed through as a command.
ShopLiveViewTrackEvent
@objc public enum ShopLiveViewTrackEvent : Int, CaseIterable {
case viewWillDisAppear
case viewDidDisAppear
case pipWillAppear
case pipDidAppear
case fullScreenWillAppear
case fullScreenDidAppear
public var name : String {
switch self {
case .viewWillDisAppear:
return "viewWillDisAppear"
case .viewDidDisAppear:
return "viewDidDisAppear"
case .pipWillAppear:
return "pipWillAppear"
case .pipDidAppear:
return "pipDidAppear"
case .fullScreenWillAppear:
return "fullScreenWillAppear"
case .fullScreenDidAppear:
return "fullScreenDidAppear"
}
}
}
Parameter name
Type
Description
viewWillDisAppear
CaseIterable
Shoplive Player starts changing to closed state
viewDidDisAppear
CaseIterable
Shoplive Player has changed to closed status.
pipWillAppear
CaseIterable
Shoplive Player starts changing to PIP mode state
pipDidAppear
CaseIterable
Shoplive Player has changed to PIP mode status.
fullScreenWillAppear
CaseIterable
Shoplive Player starts changing to full screen mode
fullScreenDidAppear
CaseIterable
Shoplive Player has changed to full screen mode.
payload
Delivers the status of the previous Shoplive Player as a payload.
Parameter name
Type
Description
currentStyle
Any?
The name (String) of the current PresentationStyle
lastStyle
Any?
The name (String) of the previous PresentationStyle
isPreview
Any?
The value is true if window style is Preview, false if window style is InAppPip
viewHiddenActionType
Any?
ShopLiveViewHiddenActionType (Optional String)
ShopLiveViewHiddenActionType
Case
Description
onSwipeOut
on swipe out
onBtnTapped
on back button click
onClose
on calling the close() function
onError
on exiting due to error
onRestoringPip
on exited when restoring from OSPIP by error
onNavigationHandleClose
when the user defined nextActionTypeOnHandleNavigation as .CLOSE
Deprecated
Parameter name
Type
Description
willShopLiveOn
CaseIterable
Shoplive Player starts changing to full screen
didShopLiveOn
CaseIterable
Shoplive Player has changed to full screen
willShopLiveOff
CaseIterable
Shoplive Player starts changing to PIP mode or shutdown state
didShopLiveOff
CaseIterable
Shoplive Player changes to PIP mode or exit status complete
payload
Convey the previous Shoplive Player status as a payload.
This status is for setting whether or not the coupon to be visible when coupon processing is completed.
@objc public enum ShopLiveResultStatus: Int, CaseIterable {
case SHOW // SHOW coupon
case HIDE // HIDE coupon
case KEEP // KEEP the status of coupon visibility
public var name: String {
switch self {
case .SHOW:
return "SHOW"
case .HIDE:
return "HIDE"
case .KEEP:
return "KEEP"
}
}
}
Set the type of notification message that appears when coupon processing is completed.
@objc public enum ShopLiveResultAlertType: Int, CaseIterable {
case ALERT // Alert
case TOAST // Toast
public var name: String {
switch self {
case .ALERT:
return "ALERT"
case .TOAST:
return "TOAST"
}
}
}
@objc public class ShopLiveCouponResult: NSObject {
var success: Bool
var coupon: String = ""
var message: String?
var couponStatus: ShopLiveResultStatus
var alertType: ShopLiveResultAlertType
public init(couponId: String, success: Bool, message: String?, status: ShopLiveResultStatus, alertType: ShopLiveResultAlertType) {
self.coupon = couponId
self.success = success
self.message = message
self.couponStatus = status
self.alertType = alertType
}
}
@objc public class ShopLiveCustomActionResult: NSObject {
var success: Bool
var id: String = ""
var message: String?
var couponStatus: ShopLiveResultStatus
var alertType: ShopLiveResultAlertType
public init(id: String, success: Bool, message: String?, status: ShopLiveResultStatus, alertType: ShopLiveResultAlertType) {
self.id = id
self.success = success
self.message = message
self.couponStatus = status
self.alertType = alertType
}
}
handleDownloadCoupon
When a coupon is selected (tapped) on Shoplive, the coupon information is transmitted to the client. The coupon status in the Shoplive Player is set through the result callback, which sends back the client's coupon processing result to the Shoplive iOS SDK.
In the popup, the click event is set to custom, and when the popup is selected (tapped), the popup information is transmitted. The popup's id, type (COUPON, BANNER, NOTICE), and payload are transmitted.