인앱메시지 이벤트 리스너
Interfaces
HackleInAppMessageListener
interface HackleInAppMessageListener {
beforeInAppMessageOpen?(inAppMessage: HackleInAppMessage): void;
afterInAppMessageOpen?(inAppMessage: HackleInAppMessage): void;
beforeInAppMessageClose?(inAppMessage: HackleInAppMessage): void;
afterInAppMessageClose?(inAppMessage: HackleInAppMessage): void;
onInAppMessageClick?(
inAppMessage: HackleInAppMessage,
view: HackleInAppMessageView,
action: HackleInAppMessageAction
): boolean;
}onInAppMessageClick
onInAppMessageClick 메서드가 반환하는 boolean 값을 통해 인앱메시지의 동작을 제어할 수 있습니다.
true를 반환하는 경우 기존 인앱메시지의 액션을 덮어씁니다.가령, 기존 인앱메시지의 클릭 시 액션이
하루 동안 보지 않기였다면 해당 액션은 동작하지 않습니다.
false를 반환하는 경우 기존 인앱메시지의 액션이 그대로 동작합니다.
view.close() 를 onInAppMessageClick 내부에서 호출하는 경우
view.close() 를 리스너 내부에서 호출한 경우 true 를 반환한 것과 동일하게 처리됩니다.
HackleInAppMessage
인앱메시지의 키를 반환합니다.
HackleInAppMessageView
close()를 호출하여 인앱메시지를 리스너 함수 내에서 직접 닫을 수 있습니다.
HackleInAppMessageAction
property
description
close?.hideDurationMillis
메시지를 특정 기간동안 숨김 처리하는 액션인 경우, 해당 기간을 밀리초로 반환합니다.
link?.url
링크가 포함된 경우 링크를 반환합니다. e.g) https://hackle.io
link?.shouldCloseAfterLink
링크 이동 후 닫기 옵션이 ON인 경우 true를 반환합니다.
사용 예제
리스너 등록
리스너 해제
setInAppMessageListener()에 null을 전달하면 등록된 리스너를 해제할 수 있습니다.
마지막 업데이트