Check server identifier before login (#7206)

* Check server identifier before login

* Update text

* Update message
This commit is contained in:
Daniel Espino García
2023-04-13 15:48:25 +02:00
committed by GitHub
parent d7b075a52c
commit c2bb87dd37
4 changed files with 19 additions and 14 deletions

View File

@@ -19,11 +19,14 @@ const BORDER_FOCUSED_WIDTH = 2;
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
container: {
height: DEFAULT_INPUT_HEIGHT + (2 * BORDER_DEFAULT_WIDTH),
width: '100%',
},
errorContainer: {
flexDirection: 'row',
// Hack to properly place text in flexbox
borderColor: 'transparent',
borderWidth: 1,
},
errorIcon: {
color: theme.errorTextColor,
@@ -174,13 +177,8 @@ const FloatingTextInput = forwardRef<FloatingTextInputRef, FloatingTextInputProp
const onPressAction = !isKeyboardInput && editable && onPress ? onPress : undefined;
const combinedContainerStyle = useMemo(() => {
const res: StyleProp<ViewStyle> = [styles.container];
if (multiline) {
res.push({height: 100 + (2 * BORDER_DEFAULT_WIDTH)});
}
res.push(containerStyle);
return res;
}, [styles, containerStyle, multiline]);
return [styles.container, containerStyle];
}, [styles, containerStyle]);
const combinedTextInputContainerStyle = useMemo(() => {
const res: StyleProp<TextStyle> = [styles.textInput];

View File

@@ -47,9 +47,6 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
fullWidth: {
width: '100%',
},
error: {
marginBottom: 18,
},
chooseText: {
alignSelf: 'flex-start',
color: changeOpacity(theme.centerChannelColor, 0.64),
@@ -166,7 +163,7 @@ const ServerForm = ({
return (
<View style={styles.formContainer}>
<View style={[styles.fullWidth, urlError?.length ? styles.error : undefined]}>
<View style={styles.fullWidth}>
<FloatingTextInput
autoCorrect={false}
autoCapitalize={'none'}
@@ -193,7 +190,7 @@ const ServerForm = ({
value={url}
/>
</View>
<View style={[styles.fullWidth, displayNameError?.length ? styles.error : undefined]}>
<View style={styles.fullWidth}>
<FloatingTextInput
autoCorrect={false}
autoCapitalize={'none'}

View File

@@ -317,7 +317,16 @@ const Server = ({
return;
}
const server = await getServerByIdentifier(data.config!.DiagnosticId);
if (!data.config?.DiagnosticId) {
setUrlError(formatMessage({
id: 'mobile.diagnostic_id.empty',
defaultMessage: 'A DiagnosticId value is missing for this server. Contact your system admin to review this value and restart the server.',
}));
setConnecting(false);
return;
}
const server = await getServerByIdentifier(data.config.DiagnosticId);
setConnecting(false);
if (server && server.lastActiveAt > 0) {

View File

@@ -504,6 +504,7 @@
"mobile.custom_status.clear_after": "Clear After",
"mobile.custom_status.clear_after.title": "Clear Custom Status After",
"mobile.custom_status.modal_confirm": "Done",
"mobile.diagnostic_id.empty": "A DiagnosticId value is missing for this server. Contact your system admin to review this value and restart the server.",
"mobile.direct_message.error": "We couldn't open a DM with {displayName}.",
"mobile.display_settings.clockDisplay": "Clock Display",
"mobile.display_settings.crt": "Collapsed Reply Threads",