diff --git a/src/libs/PolicyUtils.js b/src/libs/PolicyUtils.js index 22b5d8635f72..cd15ea19a160 100644 --- a/src/libs/PolicyUtils.js +++ b/src/libs/PolicyUtils.js @@ -92,6 +92,15 @@ function isExpensifyTeam(email) { return emailDomain === CONST.EXPENSIFY_PARTNER_NAME || emailDomain === CONST.EMAIL.GUIDES_DOMAIN; } +/** + * @param {string} email + * @returns {boolean} + */ +function isExpensifyGuideTeam(email) { + const emailDomain = Str.extractEmailDomain(email); + return emailDomain === CONST.EMAIL.GUIDES_DOMAIN; +} + /** * Checks if the current user is an admin of the policy. * @@ -132,6 +141,7 @@ export { getPolicyBrickRoadIndicatorStatus, shouldShowPolicy, isExpensifyTeam, + isExpensifyGuideTeam, isPolicyAdmin, getClientPolicyMemberEmailsToAccountIDs, }; diff --git a/src/pages/signin/LoginForm.js b/src/pages/signin/LoginForm.js index e4efb80cc0a1..88df88155eed 100644 --- a/src/pages/signin/LoginForm.js +++ b/src/pages/signin/LoginForm.js @@ -25,6 +25,8 @@ import DotIndicatorMessage from '../../components/DotIndicatorMessage'; import * as CloseAccount from '../../libs/actions/CloseAccount'; import CONST from '../../CONST'; import isInputAutoFilled from '../../libs/isInputAutoFilled'; +import * as PolicyUtils from '../../libs/PolicyUtils'; +import Log from '../../libs/Log'; const propTypes = { /** Should we dismiss the keyboard when transitioning away from the page? */ @@ -65,6 +67,13 @@ const defaultProps = { blurOnSubmit: false, }; +/** + * Enables experimental "memory only keys" mode in Onyx + */ +const setEnableMemoryOnlyKeys = () => { + window.enableMemoryOnlyKeys(); +}; + function LoginForm(props) { const input = useRef(); const [login, setLogin] = useState(''); @@ -125,6 +134,12 @@ function LoginForm(props) { return; } + // If the user has entered a guide email, then we are going to enable an experimental Onyx mode to help with performance + if (PolicyUtils.isExpensifyGuideTeam(loginTrim)) { + Log.info('Detected guide email in login field, setting memory only keys.'); + setEnableMemoryOnlyKeys(); + } + setFormError(null); // Check if this login has an account associated with it or not