Skip to content

Commit 49b3de1

Browse files
committed
adding live chat to readme
1 parent 62b31cb commit 49b3de1

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,62 @@ feedView.setFeedViewInteractionListener(new FastCommentsFeedView.OnFeedViewInter
153153
feedView.load();
154154
```
155155

156+
## Live Chat Integration
157+
158+
Add a real-time chat interface to your app:
159+
160+
```kotlin
161+
// Add LiveChatView to your layout XML
162+
// <com.fastcomments.sdk.LiveChatView
163+
// android:id="@+id/liveChatView"
164+
// android:layout_width="match_parent"
165+
// android:layout_height="match_parent" />
166+
167+
// Create a configuration for the SDK
168+
val config = CommentWidgetConfig().apply {
169+
tenantId = "your-tenant-id"
170+
urlId = "chat-room-identifier"
171+
pageTitle = "Chat Room Name"
172+
}
173+
LiveChatView.setupLiveChatConfig(config)
174+
175+
// Optional: Add user authentication
176+
val userData = SimpleSSOUserData(
177+
"User Name",
178+
179+
"https://path-to-avatar.jpg"
180+
)
181+
val sso = FastCommentsSSO(userData)
182+
config.sso = sso.prepareToSend()
183+
184+
// Initialize the SDK
185+
val sdk = FastCommentsSDK().configure(config)
186+
187+
// Set up the live chat view
188+
val liveChatView = findViewById<LiveChatView>(R.id.liveChatView)
189+
liveChatView.setSDK(sdk)
190+
liveChatView.load()
191+
192+
// Don't forget lifecycle handling
193+
override fun onResume() {
194+
super.onResume()
195+
sdk.refreshLiveEvents()
196+
}
197+
198+
override fun onDestroy() {
199+
super.onDestroy()
200+
sdk.cleanup()
201+
}
202+
```
203+
156204
## Example Projects
157205

158206
Check out these demo implementations:
159207

160208
- [Basic Comments Example](app/src/main/java/com/fastcomments/MainActivity.kt)
161209
- [Secure SSO Implementation](app/src/main/java/com/fastcomments/SecureSSOExampleActivity.kt)
162210
- [Feed Integration Example](app/src/main/java/com/fastcomments/FeedExampleActivity.java)
211+
- [Live Chat Example](app/src/main/java/com/fastcomments/LiveChatExampleActivity.kt)
163212
- [Comments Dialog Implementation](app/src/main/java/com/fastcomments/CommentsDialog.java)
164213

165214
## Configuration Options

0 commit comments

Comments
 (0)