Moments Events
Moments Events
This section shows you how to observe Storyly Moments' basic functionality events. In order to get a notification about these basic events, you should override the following function in MomentsListener
, which you have registered in Quick Start.
fun storylyMomentsEvent(event: StorylyMomentsEvent, momentsStoryGroup: MomentsStoryGroup?, stories:List<MomentsStory>?) {}
Tip
You can check what kind of events are sent in Storyly Moments from API docs with their explanation.
onStoryCreatorOpen Event
This event will let you know that your users intend to create a Story. In order to be notified about this event, override the following function in your listener:
fun onStoryCreatorOpen()
onStoryCreatorClose Event
This event will notify you when the user closes the Story creator. In order to be notified about this event, override the following function in your listener:
fun onStoryCreatorClose()
onUserStoriesOpen Event
This event will let you know that your users intend to view their Stories. In order to be notified about this event, override the following function in your listener:
fun onUserStoriesOpen()
onUserStoriesClose Event
This event will notify you when the user closes the preview of their own Stories. In order to be notified about this event, override the following function in your listener:
fun onUserStoriesClose()
onUserActionClicked Method
This method will let you handle the CTA URL of user-generated Stories. To be notified about this method, override the following function in your listener:
fun onUserActionClicked(story: MomentsStory) {
//Log.d("TAG", "onUserActionClicked: ${story.media.actionUrl} ")
}
onUserStoriesLoaded Event
This event will let you know that your loading of user Stories is successful. momentsStoryGroup
parameter denotes loaded user Story Group information. In order to be notified about this event, override the following function in your listener:
fun onUserStoriesLoaded(momentsStoryGroup: MomentsStoryGroup?)
onUserStoriesLoadFailed Event
This event will let you know that your loading of user Stories loading is failed.errorMessage
parameter denotes the fail reason of the loading. In order to be notified about this event, override the following function in your listener:
fun onUserStoriesLoadFailed(errorMessage: String)
storyHeaderClicked Event
This event will let you know that the user clicked the header icon of a Storyly Moments Story. In order to be notified about this event, override the following function in your listener:
fun storyHeaderClicked(momentsStoryGroup: MomentsStoryGroup?,
story: MomentsStory?)
storyAnalyticsClicked Event
This event will let you know that the user clicked on an analytic button of a Storyly Moments Story. You can show your custom view on this callback for impressions and likes.
fun storyAnalyticsClicked(momentsStory: MomentsStory?,
stats: MomentsAnalytics?,
analyticsType: AnalyticsType,
showCustomAnalyticsView: ((View) -> Unit))
Warning
You should set
isCustomAnalyticsView
to true inMomentsThemeConfig
in order to use this function.When your view is ready, you should call
showCustomAnalyticsView
to show your custom analytics view.
onLinkCTAPreviewURLClicked
This event will let you know that the user clicked the CTA Link preview on the CTA editor. You can show your custom web view on this callback.
fun onLinkCTAPreviewURLClicked(url: String, showCustomLinkPreviewView: ((View) -> Unit))
Warning
You should set
isCustomPreviewView
to true inMomentsLinkCTAConfig
in order to use this function.When your view is ready, you should call
showCustomLinkPreviewView
to show your custom link preview.
onPreModeration Event
This event will let you pre-moderate the content before going live. With this callback, you can prevent harmful text or URL content from going live.
fun onPreModeration(preModerationList: List<PreModeration?>, onCompletion: (() -> Unit)) {
onCompletion() //Call when pre moderation is completed.
}
Below, you can find an example of usage:
Updated 5 months ago