Link Search Menu Expand Document

Chat Restoring Work in progress

Table of contents


Overview

A key player in chat restoring is the ChatController.


How to create and restore chats

  • Create chat using the ChatController.Builder

    This will create a new ChatController instance and will automatically starts a chat according to the provided account.

    val chatController = ChatController.Builder(context).apply {
                              conversationSettings(...)
                              chatEventListener(...)
                              ...
                          }.build(account, ChatLoadedListener{})
    
  • Create and restore chats using existing ChatController instance

    • Start a new chat

    chatController.startChat(account)
    All current open chats will be released.
    Released but not closed, the embedding App should close open chats, when done.

    • Restore a chat

    chatController.restoreChat(Fragment?, AccountInfo?)

    Usages:

    • On Activity restoring, restore the chat with a restored chat fragment:
      // Restore and continue current active chat (if available) with provided fragment:
      chatController.restoreChat(fragment = chatFragment)      
      
      // start a new chat session with provided account and fragment:
      chatController.restoreChat(fragment = chatFragment, account = account)
      
    • Continue with an active chat after its UI was removed:
      // continue current active chat:
      chatController.restoreChat()
      
    • Start a new chat-
      // If account is provided, will be considered as starting a new chat:
      chatController.restoreChat(account)