Deprecated

This hook is deprecated and will be replaced by the 'uikit-tools' package.

UseGroupChannelMessages

Description

interface for group channel messages hook

  • Receive new messages from other users & should count new messages -> append to state(newMessages)
  • onTopReached -> prev() -> fetch prev messages and append to state(messages)
  • onBottomReached -> next() -> fetch next messages and append to state(messages)

Hierarchy

  • UseGroupChannelMessages
  • Parameters

    Returns {
        deleteMessage: ((message) => Promise<void>);
        hasNext: (() => boolean);
        hasPrev: (() => boolean);
        loading: boolean;
        messages: SendbirdMessage[];
        newMessages: SendbirdMessage[];
        next: (() => Promise<void>);
        prev: (() => Promise<void>);
        refresh: (() => Promise<void>);
        refreshing: boolean;
        resendMessage: ((failedMessage) => Promise<void>);
        resetNewMessages: (() => void);
        resetWithStartingPoint: ((startingPoint, callback?) => void);
        sendFileMessage: ((params, onPending?) => Promise<FileMessage>);
        sendUserMessage: ((params, onPending?) => Promise<UserMessage>);
        updateFileMessage: ((messageId, params) => Promise<FileMessage>);
        updateUserMessage: ((messageId, params) => Promise<UserMessage>);
    }

    • deleteMessage: ((message) => Promise<void>)
        • (message): Promise<void>
        • Delete message

          Parameters

          • message: FileMessage | UserMessage

            sent or failed message

          Returns Promise<void>

    • hasNext: (() => boolean)
        • (): boolean
        • Check if there are more next messages to fetch

          Returns boolean

    • hasPrev: (() => boolean)
        • (): boolean
        • Check if there are more prev messages to fetch

          Returns boolean

    • loading: boolean

      Loading state, only available on first render

    • messages: SendbirdMessage[]

      Get messages, this state is for render For example, if a user receives a new messages while searching for an old message for this case, new messages will be included here.

      Returns

    • newMessages: SendbirdMessage[]

      A new message means a message that meets the below conditions

      • Not admin message
      • Not updated message
      • Not current user's message
    • next: (() => Promise<void>)
        • (): Promise<void>
        • Fetch next messages to state

          Returns Promise<void>

    • prev: (() => Promise<void>)
        • (): Promise<void>
        • Fetch prev messages to state

          Returns Promise<void>

    • refresh: (() => Promise<void>)
        • (): Promise<void>
        • Refresh, clear and reload messages from latest

          Returns Promise<void>

    • refreshing: boolean

      Refreshing state, status is changes when the refresh is called.

    • resendMessage: ((failedMessage) => Promise<void>)
        • (failedMessage): Promise<void>
        • Resend failed message

          Parameters

          • failedMessage: FileMessage | UserMessage

            failed message to resend

          Returns Promise<void>

    • resetNewMessages: (() => void)
        • (): void
        • Reset new messages

          Returns void

    • resetWithStartingPoint: ((startingPoint, callback?) => void)
        • (startingPoint, callback?): void
        • reset message list with starting point

          Parameters

          • startingPoint: number
          • Optional callback: (() => void)
              • (): void
              • Returns void

          Returns void

    • sendFileMessage: ((params, onPending?) => Promise<FileMessage>)
        • (params, onPending?): Promise<FileMessage>
        • Send file message

          Parameters

          • params: FileMessageCreateParams

            file message params

          • Optional onPending: ((message, error?) => void)
              • (message, error?): void
              • Parameters

                • message: FileMessage
                • Optional error: SendbirdError

                Returns void

          Returns Promise<FileMessage>

          pending message

    • sendUserMessage: ((params, onPending?) => Promise<UserMessage>)
        • (params, onPending?): Promise<UserMessage>
        • Send user message

          Parameters

          • params: UserMessageCreateParams

            user message params

          • Optional onPending: ((message, error?) => void)
              • (message, error?): void
              • Parameters

                • message: UserMessage
                • Optional error: SendbirdError

                Returns void

          Returns Promise<UserMessage>

          pending message

    • updateFileMessage: ((messageId, params) => Promise<FileMessage>)
        • (messageId, params): Promise<FileMessage>
        • Update file message

          Parameters

          • messageId: number
          • params: FileMessageUpdateParams

            file message params

          Returns Promise<FileMessage>

          updated message

    • updateUserMessage: ((messageId, params) => Promise<UserMessage>)
        • (messageId, params): Promise<UserMessage>
        • Update user message

          Parameters

          • messageId: number
          • params: UserMessageUpdateParams

            user message params

          Returns Promise<UserMessage>

          updated message

Generated using TypeDoc