_renderMessage()

in react/features/authentication/components/native/LoginDialog.js [198:255]


    _renderMessage() {
        const {
            _connecting: connecting,
            _error: error,
            _progress: progress,
            _styles: styles,
            t
        } = this.props;

        let messageKey;
        let messageIsError = false;
        const messageOptions = {};

        if (progress && progress < 1) {
            messageKey = 'connection.FETCH_SESSION_ID';
        } else if (error) {
            const { name } = error;

            if (name === JitsiConnectionErrors.PASSWORD_REQUIRED) {
                // Show a message that the credentials are incorrect only if the
                // credentials which have caused the connection to fail are the
                // ones which the user sees.
                const { credentials } = error;

                if (credentials
                        && credentials.jid
                            === toJid(
                                this.state.username,
                                this.props._configHosts)
                        && credentials.password === this.state.password) {
                    messageKey = 'dialog.incorrectPassword';
                    messageIsError = true;
                }
            } else if (name) {
                messageKey = 'dialog.connectErrorWithMsg';
                messageOptions.msg = `${name} ${error.message}`;
                messageIsError = true;
            }
        } else if (connecting) {
            messageKey = 'connection.CONNECTING';
        }

        if (messageKey) {
            const message = t(messageKey, messageOptions);
            const messageStyles = [
                styles.dialogText,
                messageIsError ? styles.errorMessage : styles.progressMessage
            ];

            return (
                <Text style = { messageStyles }>
                    { message }
                </Text>
            );
        }

        return null;
    }