diff --git a/src/CONST.js b/src/CONST.js index dc0d35129a02..8895bb0f3f3a 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -2532,6 +2532,7 @@ const CONST = { SCAN: 'scan', DISTANCE: 'distance', }, + STATUS_TEXT_MAX_LENGTH: 100, }; export default CONST; diff --git a/src/pages/ProfilePage.js b/src/pages/ProfilePage.js index 6500eef0548f..11e006c8d8fa 100755 --- a/src/pages/ProfilePage.js +++ b/src/pages/ProfilePage.js @@ -36,6 +36,7 @@ import * as Illustrations from '../components/Icon/Illustrations'; import variables from '../styles/variables'; import ROUTES from '../ROUTES'; import * as ValidationUtils from '../libs/ValidationUtils'; +import Permissions from '../libs/Permissions'; const matchType = PropTypes.shape({ params: PropTypes.shape({ @@ -133,6 +134,11 @@ function ProfilePage(props) { // If the API returns an error for some reason there won't be any details and isLoading will get set to false, so we want to show a blocking screen const shouldShowBlockingView = !hasMinimumDetails && !isLoading; + const statusEmojiCode = lodashGet(details, 'status.emojiCode', ''); + const statusText = lodashGet(details, 'status.text', ''); + const hasStatus = !!statusEmojiCode && Permissions.canUseCustomStatus(props.betas); + const statusContent = `${statusEmojiCode} ${statusText}`; + return ( )} + {hasStatus && ( + + + {props.translate('statusPage.status')} + + {statusContent} + + )} + {login ? ( { @@ -42,7 +42,7 @@ function StatusPage({draftStatus, currentUserPersonalDetails}) { User.updateCustomStatus({text: defaultText, emojiCode: defaultEmoji, clearAfter: endOfDay.toISOString()}); User.clearDraftCustomStatus(); - Navigation.goBack(ROUTES.SETTINGS); + Navigation.goBack(ROUTES.SETTINGS_PROFILE); }, [defaultText, defaultEmoji]); const clearStatus = () => { @@ -78,7 +78,7 @@ function StatusPage({draftStatus, currentUserPersonalDetails}) { Navigation.navigate(ROUTES.SETTINGS_STATUS_SET)} diff --git a/src/pages/settings/Profile/CustomStatus/StatusSetPage.js b/src/pages/settings/Profile/CustomStatus/StatusSetPage.js index a3c4aae83bb1..7074ce45a7bb 100644 --- a/src/pages/settings/Profile/CustomStatus/StatusSetPage.js +++ b/src/pages/settings/Profile/CustomStatus/StatusSetPage.js @@ -42,7 +42,7 @@ function StatusSetPage({draftStatus, currentUserPersonalDetails}) { const defaultText = lodashGet(draftStatus, 'text') || lodashGet(currentUserPersonalDetails, 'status.text', ''); const onSubmit = (value) => { - User.updateDraftCustomStatus({text: value.statusText, emojiCode: value.emojiCode}); + User.updateDraftCustomStatus({text: value.statusText.trim(), emojiCode: value.emojiCode}); Navigation.goBack(ROUTES.SETTINGS_STATUS); }; @@ -55,7 +55,7 @@ function StatusSetPage({draftStatus, currentUserPersonalDetails}) {
@@ -74,7 +74,7 @@ function StatusSetPage({draftStatus, currentUserPersonalDetails}) { accessibilityLabel={INPUT_IDS.STATUS_TEXT} accessibilityRole={CONST.ACCESSIBILITY_ROLE.TEXT} defaultValue={defaultText} - maxLength={100} + maxLength={CONST.STATUS_TEXT_MAX_LENGTH} autoFocus shouldDelayFocus />