Skip to content

Commit

Permalink
fix: add Name field to SetUsernameView (#6144)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjinendra3 authored Feb 20, 2025
1 parent 2d06cd3 commit 4c48ae7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/lib/services/restApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ export const saveRoomSettings = (
sdk.methodCallWrapper('saveRoomSettings', rid, params);

export const saveUserProfile = (
data: IProfileParams | Pick<IProfileParams, 'username'>,
data: IProfileParams | Pick<IProfileParams, 'username' | 'name'>,
customFields?: { [key: string | number]: string }
) =>
// RC 0.62.2
Expand Down
28 changes: 25 additions & 3 deletions app/views/SetUsernameView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ const styles = StyleSheet.create({

interface ISubmit {
username: string;
name: string;
}

const schema = yup.object().shape({
username: yup.string().required()
username: yup.string().required(),
name: yup.string().required()
});

const SetUsernameView = () => {
Expand Down Expand Up @@ -67,13 +69,13 @@ const SetUsernameView = () => {
init();
}, []);

const submit = async ({ username }: ISubmit) => {
const submit = async ({ username, name }: ISubmit) => {
if (!isValid) {
return;
}
setLoading(true);
try {
await Services.saveUserProfile({ username });
await Services.saveUserProfile({ username, name });
dispatch(loginRequest({ resume: token }));
} catch (e: any) {
showErrorAlert(e.message, I18n.t('Oops'));
Expand Down Expand Up @@ -103,6 +105,26 @@ const SetUsernameView = () => {
clearButtonMode='while-editing'
containerStyle={sharedStyles.inputLastChild}
/>
<Text
style={[
sharedStyles.loginTitle,
sharedStyles.textBold,
styles.loginTitle,
{ color: colors.fontTitlesLabels, marginBottom: 10 }
]}>
{I18n.t('Name')}
</Text>
<ControlledFormTextInput
control={control}
name='name'
autoFocus
placeholder={I18n.t('Name')}
returnKeyType='send'
onSubmitEditing={handleSubmit(submit)}
testID='set-name-view-input'
clearButtonMode='while-editing'
containerStyle={sharedStyles.inputLastChild}
/>
<Button
title={I18n.t('Register')}
type='primary'
Expand Down

0 comments on commit 4c48ae7

Please sign in to comment.