Configuration
Although initialization of Config requires two mandatory string parameters (Moments Token & User Payload), there are additional configurations that you can do as well, which are shown below:
Camera Configurations
There is one camera configuration that can be changed, which is setMaxRecordDuration.
setMaxRecordDurationallows you to set different video record durations. You may use it as shown below:
let config = MomentsConfig.Builder()
.setInteractiveConfig(config: interactiveConfigs)
.setCameraConfig(config: MomentsCameraConfig.Builder()
.setMaxRecordDuration(duration: MaxRecordDuration.full)
.build())
.build(momentsToken:MOMENTS_TOKEN, userPayload: USER_PAYLOAD)
Record Durations
QUARTERenables your users to record videos up to 15 seconds for a Single Moments Story.
HALFenables your users to record videos up to 30 seconds for a Single Moments Story.
FULLenables your users to record videos up to 60 seconds for a Single Moments Story.
Warning
Camera configuration does not change the maximum Moments Story record duration, which is 120 seconds.
Interactive Configurations
There are two interactive configurations that can be changed, which are setLinkCTAConfigand setTextConfig.
setLinkCTAConfigallows you to set different states for the link CTA usage in Moments Story.setTextConfigallows you to set different fonts for texts that can be added to Moments Story.
let linkCTAConfig = MomentsLinkCTAConfig.Builder()
.setMomentsLinkCTAState(LinkCTAState.All)
.setMomentsLinkItems(items: [MomentsLinkItem(name: "In-app Link_1", link = "In-app URL_1"),
MomentsLinkItem(name: "In-app Link_2", link = "In-app URL_2")])
.setLinkTextColor(color: UIColor)
.build()
let momentsTextConfig = MomentsTextConfig.Builder()
.setCustomFonts(fonts: "Your_Custom_Fonts")
.build()
let interactiveConfigs = MomentsInteractiveConfig.Builder()
.setTextConfig(config: momentsTextConfig)
.setLinkCTAConfig(config: linkCTAConfig)
.build()
States of Link CTA
If you set
LinkCTAStateasInApp, only in-app linking is enabled.If you set
LinkCTAStateasOutlink, only out-linking is enabled.If you set
LinkCTAStateasAll, all linking options are enabled.If you set
LinkCTAStateasDisabled, all linking options are disabled.
After configuring MomentsInteractiveConfig you may use it as shown below:
let config = MomentsConfig.Builder()
.setInteractiveConfig(config: interactiveConfigs)
.build(momentsToken:MOMENTS_TOKEN, userPayload: USER_PAYLOAD)
Warning
If you'd like to set a custom font, please make sure that you're using the same font for the Storlyly SDK as you can see here.
Theme Configurations
There are three theme configurations that can be changed, which are setAnalyticsViewType, setFont and setIconStyling.
setAnalyticsViewTypeallows you to use your own custom analytics view for Likes and Views.setFontallows you to set a custom font in all Moments-related screens.setIconStylingallows you to set custom icons for Moments Stories.
let config = MomentsConfig.Builder()
.setMomentsTheme(theme: MomentsThemeConfig.Builder()
.setFont(font: UIFont.italicSystemFont(ofSize: 16))
.setAnalyticsViewType(isCustom: true)
.setIconStyling(iconStyling: MomentsIconStylingConfig.Builder().build())
.build())
.build(momentsToken:MOMENTS_TOKEN, userPayload: USER_PAYLOAD)
Updated over 1 year ago
