Components ᴺᴱᵂ
The OWUIComponents interface is the primary entry point for embedding conversation experiences in your Android app as of SDK version 3.0.0. It replaces the deprecated OWUIFlows and OWUIViews APIs and provides a unified, simplified surface for displaying pre-conversation summaries, full conversations, and routed deep links into specific comment threads or creation flows.
Accessing OWUIComponents
Retrieve the interface from the SDK manager:
val components: OWUIComponents = OpenWeb.manager.ui.componentsMethods
getPreConversation()
Returns a Fragment displaying the pre-conversation summary widget — comment count, top comments, and a prompt to open the full conversation. Embed it in any FragmentActivity or FragmentManager host.
components.getPreConversation(
postId = "POST_ID",
articleSettings = OWArticleSettings(),
conversationNavigation = OWConversationNavigationMode.ConversationFullScreen(),
additionalSettings = OWAdditionalSettings(),
actionCallbacks = null,
completion = object : SpotCallback<Fragment>() {
override fun onSuccess(fragment: Fragment) {
supportFragmentManager.beginTransaction()
.replace(R.id.container, fragment)
.commit()
}
override fun onFailure(exception: SpotException) {
// handle error
}
}
)Parameter notes:
postId— Identifies the content item. Pass both apostIdstring and yourspotId.articleSettings— Describes the article the conversation belongs to and how its header is displayed. See OWArticleSettings.conversationNavigation— Controls how the full conversation opens when the user taps the widget. UseConversationFullScreenfor default SDK-managed navigation, orConversationCustomto intercept the tap and handle navigation yourself viaOWPreConversationActionsCallbacks.additionalSettings— Per-surface appearance and behaviour overrides for the pre-conversation, conversation, comment thread, and comment creation screens. See OWAdditionalSettings.actionCallbacks— Optional. Receives SDK flow events viaOWFlowEventCallbacks— currently fired when the user taps a publisher profile or dismisses the conversation. See OWFlowEventCallbacks.
getConversation()
Returns a Fragment containing the full conversation experience. Embed it directly in your layout when you want the conversation to live inside your own scrollable container or tab structure.
components.getConversation(
postId = "POST_ID",
articleSettings = OWArticleSettings(),
route = null,
additionalSettings = OWAdditionalSettings(),
actionCallbacks = null,
completion = object : SpotCallback<Fragment>() {
override fun onSuccess(fragment: Fragment) {
supportFragmentManager.beginTransaction()
.replace(R.id.container, fragment)
.commit()
}
override fun onFailure(exception: SpotException) {
// handle error
}
}
)Parameter notes:
route— Optional. Pass anOWConversationRouteto open the conversation at a specific location, such as a comment thread or a new comment creation screen. Whennull, the conversation opens at the top.
openConversation()
Launches the conversation as a full-screen SDK-managed activity. Use this method when you do not want to manage the Fragment lifecycle yourself.
components.openConversation(
postId = "POST_ID",
articleSettings = OWArticleSettings(),
route = null,
additionalSettings = OWAdditionalSettings(),
actionCallbacks = null,
completion = object : SpotCallback<Unit>() {
override fun onSuccess(unit: Unit) {
// launched successfully
}
override fun onFailure(exception: SpotException) {
// handle error
}
}
)Note: The completion callback is optional. Omit it if you only need fire-and-forget navigation.
Settings
Every OWUIComponents method takes two settings objects. Both default to sensible values — pass OWArticleSettings() / OWAdditionalSettings() when you don't need to customize anything.
articleSettings(OWArticleSettings) — the article the conversation belongs to and how its header is shown.additionalSettings(OWAdditionalSettings) — per-surface appearance and behaviour for each SDK screen.
// Compact pre-conversation, conversation without pull-to-refresh, floating composer
val additionalSettings = OWAdditionalSettings(
preConversationSettings = OWPreConversationSettings(OWPreConversationStyle.Compact),
conversationSettings = OWConversationSettings(
conversationStyle = OWConversationStyle.Regular,
allowPullToRefresh = false
),
commentCreationSettings = OWCommentCreationSettings(OWCommentCreationStyle.Floating)
)
components.getConversation(
postId = "POST_ID",
additionalSettings = additionalSettings,
completion = completion
)OWAdditionalSettings
A container holding one settings object per SDK surface.
| Property | Purpose |
|---|---|
preConversationSettings | Style of the pre-conversation widget. (OWPreConversationSettings) |
conversationSettings | Style and behaviour of the full conversation. (OWConversationSettings) |
commentThreadSettings | Behaviour of a focused comment thread. (OWCommentThreadSettings) |
commentCreationSettings | Style of the comment editor. (OWCommentCreationSettings) |
OWPreConversationSettings
| Property | Purpose |
|---|---|
preConversationStyle | Layout of the pre-conversation widget. (OWPreConversationStyle, default Regular) |
OWPreConversationStyle values:
| Value | Description |
|---|---|
Regular | Default. Shows up to 2 comments with the summary, guidelines, and question. |
Compact | Condensed layout showing a single comment. |
CtaButtonOnly | Shows only the call-to-action button — no comments or summary. |
CtaWithSummary | Shows the summary and call-to-action button, no comment previews. |
Custom(…) | Fully configurable layout. See parameters below. |
Custom parameters:
| Parameter | Purpose |
|---|---|
numberOfComments | Comment previews to show. Coerced to the range 1–8. (Int, default 2) |
collapsableTextLineLimit | Lines shown before a comment collapses behind "read more". (Int, default 4) |
preConversationSummaryStyle | Summary display. (OWPreConversationSummaryStyle, default Regular) |
communityGuidelinesStyle | Guidelines display. (OWCommunityGuidelinesStyle, default Regular) |
communityQuestionStyle | Community question display. (OWCommunityQuestionsStyle, default Regular) |
OWConversationSettings
| Property | Purpose |
|---|---|
conversationStyle | Layout of the full conversation. (OWConversationStyle, default Regular) |
allowPullToRefresh | Enables pull-to-refresh in the conversation. (Boolean, default true) |
OWConversationStyle values:
| Value | Description |
|---|---|
Regular | Default spacing, with the guidelines and community question shown in full. |
Compact | Condensed spacing and compact guidelines/question. |
Custom(…) | Configurable communityGuidelinesStyle, communityQuestionsStyle, and spacing. |
OWCommentThreadSettings
| Property | Purpose |
|---|---|
allowPullToRefresh | Enables pull-to-refresh in the comment thread. (Boolean, default true) |
OWCommentCreationSettings
| Property | Purpose |
|---|---|
commentCreationStyle | Layout of the comment editor. (OWCommentCreationStyle, default Floating) |
OWCommentCreationStyle values:
| Value | Description |
|---|---|
Floating | Default. Editor floats above the keyboard. |
Regular | Standard full-screen editor. |
Light | Lightweight inline editor. |
Shared Style Enums
OWPreConversationSummaryStyle, OWCommunityGuidelinesStyle, and OWCommunityQuestionsStyle each accept:
| Value | Description |
|---|---|
Regular | Standard display (default). |
Compact | Condensed display. |
None | Hidden. |
OWConversationSpacing (used by OWConversationStyle.Custom):
| Value | Description |
|---|---|
Regular | Default spacing. |
Compact | Condensed spacing. |
Custom(…) | Set betweenComments, belowCommunityGuidelines, and belowCommunityQuestions in dp. |
OWArticleSettings
| Property | Purpose |
|---|---|
articleInformationStrategy | Source of article metadata. (OWArticleInformationStrategy, default Server) |
additionalSettings | Header, read-only, and rating options. (OWArticleAdditionalSettings) |
OWArticleInformationStrategy values:
| Value | Description |
|---|---|
Server | Default. The SDK fetches article metadata from the OpenWeb backend. |
Local(article) | You supply the article metadata locally via an Article instance. |
OWArticleAdditionalSettings properties:
| Property | Purpose |
|---|---|
section | Content section the article belongs to. (String?, default null) |
headerStyle | Article header display. (OWArticleHeaderStyle, default Regular) |
readOnlyMode | Read-only behaviour. (OWReadOnlyMode, default SERVER) |
starRating | Enables the star-rating widget. (Boolean, default false) |
OWArticleHeaderStyle values:
| Value | Description |
|---|---|
Regular | Default. Shows the article header. |
None | Hides the article header. |
OWReadOnlyMode values:
| Value | Description |
|---|---|
SERVER | Default. Follows the read-only state from the server. |
ENABLE | Forces read-only mode on. |
DISABLE | Forces read-only mode off. |
Enumerations and Types
OWConversationNavigationMode
Controls how the full conversation screen is opened from within getPreConversation().
| Subclass | When to use |
|---|---|
ConversationFullScreen(callbacks) | SDK manages navigation; callbacks is an optional OWFlowEventCallbacks for action events. |
ConversationCustom(preConversationActionsCallbacks) | You intercept navigation; implement OWPreConversationActionsCallbacks.openConversationFlow(route) to push your own screen. |
OWConversationRoute
A sealed class that deep-links the conversation to a specific entry point. Pass as the route parameter to getConversation() or openConversation().
| Subclass | Purpose |
|---|---|
OWCommentThreadRoute(commentId: String) | Opens the conversation scrolled to a specific comment thread. |
OWCommentCreationRoute(type: OWCommentCreationType) | Opens the conversation with the comment editor pre-focused. |
OWFlowEventCallbacks
Implement this interface to be notified when the SDK reports a flow-level event. The callback method receives the event type, the source surface that fired it, and the postId it relates to.
val callbacks = object : OWFlowEventCallbacks {
override fun callback(
type: OWFlowActionCallbackType,
source: OWFlowSourceType,
postId: OWPostId
) {
when (type) {
is OWFlowActionCallbackType.OpenPublisherProfile -> {
// user tapped a publisher's profile — use type.context, type.ssoPublisherId, type.type
}
is OWFlowActionCallbackType.ConversationDismissed -> {
// user dismissed the conversation screen
}
}
}
}OWFlowActionCallbackType
A sealed class enumerating the flow events delivered to OWFlowEventCallbacks.
| Subclass | When it fires |
|---|---|
OpenPublisherProfile(context, ssoPublisherId, type) | User tapped a publisher's profile within the conversation. context is an Android Context, ssoPublisherId identifies the publisher, and type is an OWUserProfileType. |
ConversationDismissed | The conversation screen was dismissed by the user. |
OWFlowSourceType
Identifies which UI surface produced the event.
| Value | Surface |
|---|---|
PreConversation | The pre-conversation summary widget. |
Conversation | The full conversation screen. |
CommentThread | A focused comment thread inside the conversation. |
OWCommentCreationType
Pass an instance to OWConversationRoute.OWCommentCreationRoute to control which editor opens.
| Value | Opens |
|---|---|
Comment | The editor for posting a new top-level comment. |
Edit(commentId) | The editor for editing the specified existing comment. |
ReplyTo(commentId) | The editor for posting a reply under the specified comment. |
None | No editor — the conversation opens without focusing an editor. |
OWPreConversationActionsCallbacks
Implement this interface when using ConversationCustom navigation mode to handle conversation open events yourself. The SDK builds the route for you (comment thread, comment creation, etc.); you decide where and how to render it.
The typical pattern is to forward the route into OWUIComponents.openConversation() from your own navigation point:
val navCallbacks = object : OWPreConversationActionsCallbacks {
override fun openConversationFlow(route: OWConversationRoute) {
OpenWeb.manager.ui.components.openConversation(
postId = "POST_ID",
articleSettings = OWArticleSettings(),
route = route,
additionalSettings = OWAdditionalSettings(),
actionCallbacks = null
)
}
}Alternatively, push your own screen and ignore route if you render the conversation entirely outside the SDK.
Note: Migrating from Flows or Views? See the migration guide.
