diff --git a/app/views/ProfileView/interfaces.ts b/app/definitions/IProfileViewInterfaces.ts similarity index 96% rename from app/views/ProfileView/interfaces.ts rename to app/definitions/IProfileViewInterfaces.ts index 0fe592f32..491f7b201 100644 --- a/app/views/ProfileView/interfaces.ts +++ b/app/definitions/IProfileViewInterfaces.ts @@ -1,7 +1,7 @@ import { StackNavigationProp } from '@react-navigation/stack'; import React from 'react'; -import { ProfileStackParamList } from '../../stacks/types'; +import { ProfileStackParamList } from '../stacks/types'; export interface IUser { id: string; diff --git a/app/definitions/rest/v1/users.ts b/app/definitions/rest/v1/users.ts index b72f4821a..3b92eaef0 100644 --- a/app/definitions/rest/v1/users.ts +++ b/app/definitions/rest/v1/users.ts @@ -1,3 +1,4 @@ +import { IParams } from '../../IProfileViewInterfaces'; import type { ITeam } from '../../ITeam'; import type { IUser } from '../../IUser'; import { INotificationPreferences, IUserPreferences, IUserRegistered } from '../../IUser'; @@ -37,4 +38,9 @@ export type UsersEndpoints = { 'users.setStatus': { POST: (params: { status: string; message: string }) => {}; }; + 'users.updateOwnBasicInfo': { + POST: (params: { data: IParams | Pick; customFields?: { [key: string | number]: string } }) => { + user: IUser; + }; + }; }; diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 8eabe4566..99eea86f4 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -3,6 +3,7 @@ import { TEAM_TYPE } from '../../../definitions/ITeam'; import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType'; import { SubscriptionType, INotificationPreferences, IRoomNotifications } from '../../../definitions'; import { ISpotlight } from '../../../definitions/ISpotlight'; +import { IParams } from '../../../definitions/IProfileViewInterfaces'; export const createChannel = ({ name, @@ -545,10 +546,8 @@ export const saveRoomSettings = ( // RC 0.55.0 sdk.methodCallWrapper('saveRoomSettings', rid, params); -export const saveUserProfile = (data: any, customFields?: any): any => +export const saveUserProfile = (data: IParams | Pick, customFields?: { [key: string | number]: string }) => // RC 0.62.2 - // TODO: missing definitions from server - // @ts-ignore sdk.post('users.updateOwnBasicInfo', { data, customFields }); export const saveUserPreferences = (data: Partial) => diff --git a/app/views/ProfileView/index.tsx b/app/views/ProfileView/index.tsx index fc409002d..d7ecbc399 100644 --- a/app/views/ProfileView/index.tsx +++ b/app/views/ProfileView/index.tsx @@ -31,7 +31,15 @@ import { withTheme } from '../../theme'; import { getUserSelector } from '../../selectors/login'; import SafeAreaView from '../../containers/SafeAreaView'; import styles from './styles'; -import { IAvatar, IAvatarButton, INavigationOptions, IParams, IProfileViewProps, IProfileViewState, IUser } from './interfaces'; +import { + IAvatar, + IAvatarButton, + INavigationOptions, + IParams, + IProfileViewProps, + IProfileViewState, + IUser +} from '../../definitions/IProfileViewInterfaces'; class ProfileView extends React.Component { private name: any; diff --git a/app/views/RoomInfoEditView/index.tsx b/app/views/RoomInfoEditView/index.tsx index d79af6d40..6f8b8a274 100644 --- a/app/views/RoomInfoEditView/index.tsx +++ b/app/views/RoomInfoEditView/index.tsx @@ -34,7 +34,7 @@ import log, { events, logEvent } from '../../utils/log'; import { MessageTypeValues } from '../../utils/messageTypes'; import random from '../../utils/random'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; -import { IAvatar } from '../ProfileView/interfaces'; +import { IAvatar } from '../../definitions/IProfileViewInterfaces'; import sharedStyles from '../Styles'; import styles from './styles'; import SwitchContainer from './SwitchContainer';