Class EditMessageManager

    • Constructor Detail

    • Method Detail

      • onInit

         void onInit(Context context, String appKey)

        SDK initialization. Users can register custom messages, message templates, and initialize their own modules in this method.

        Parameters:
        context - Context.
        appKey - Unique application key.
      • onAttachedToExtension

         void onAttachedToExtension(Fragment fragment, NCExtension extension)

        After entering a conversation, Extension loads all registered modules. Modules can hold and use the Extension. Note: if a module holds an Extension object, it must release it in the onDetachedFromExtension callback to avoid memory leaks.

        Parameters:
        fragment - The fragment where the Extension object resides.
        extension - The Extension object.
      • onDetachedFromExtension

         void onDetachedFromExtension()

        Called when leaving a conversation; Extension releases all loaded modules. Note: if a module holds an Extension object, it must release it in this callback to avoid memory leaks.

      • onReceivedMessage

         void onReceivedMessage(Message message)

        After the SDK receives a message, it routes the message to the corresponding module via this method. Users can selectively handle received messages based on their registered message types.

        Parameters:
        message - The message entity.
      • getPluginModules

         List<IPluginModule> getPluginModules(ChannelType channelType)

        Users can configure plugins in the "+" area based on different conversations. One or multiple plugins can be configured; the extension displays all returned plugins. Note: if no plugins are configured, this method does not need to be implemented.

        Parameters:
        channelType - Channel type.
        Returns:

        Plugin list.

      • getEmoticonTabs

         List<IEmoticonTab> getEmoticonTabs()

        Multiple or single emoticon tabs can be configured in a conversation. Once configured, this tab will be displayed in all conversations. Note: if no emoticons are configured, this method does not need to be implemented.

        Returns:

        Emoticon tab list.

      • exitEditMode

         void exitEditMode()

        Exits edit message state, clears edit message configuration, and retrieves draft.

      • isEditMessageState

         boolean isEditMessageState()

        Whether currently in edit message state.

      • editMessage

         void editMessage(EditText editText, ErrorHandler callback)
      • onTextChanged

         void onTextChanged(Context context, ChannelType type, String targetId, int cursorPos, int count, String text)

        Callback when input field text changes.

        Parameters:
        context - context
        type - channel type
        targetId - target ID
        cursorPos - cursor position
        count - text change count
        text - text content
      • onSendToggleClick

         void onSendToggleClick(Message message)

        Pre-processing when the Extension module's send button is clicked. Other modules can set additional information to Extension through this callback.

        Parameters:
        message - the initial message built when the Extension module's send button is clicked.
      • onDeleteClick

         void onDeleteClick(ChannelType type, String targetId, EditText editText, int cursorPos)
      • addMentionBlocks

         void addMentionBlocks(EditText editText, List<MentionBlock> mentionBlocks)

        Rebinds the MentionList for the EditText in NCMentionManager. MentionBlock: the starting position of "@name" in the input field. Must be called after NCExtensionViewModel#setEditTextWidget rebinds the EditText.