-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix User can not validate an account in Desktop app #19125
Changes from 2 commits
f91caa5
0e86010
eb9df25
0fce612
c439f67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {View} from 'react-native'; | ||
import TextLink from '../TextLink'; | ||
import Text from '../Text'; | ||
import Icon from '../Icon'; | ||
import * as Illustrations from '../Icon/Illustrations'; | ||
import * as Expensicons from '../Icon/Expensicons'; | ||
import colors from '../../styles/colors'; | ||
import styles from '../../styles/styles'; | ||
import withLocalize, {withLocalizePropTypes} from '../withLocalize'; | ||
|
||
const propTypes = { | ||
openLinkInBrowser: PropTypes.func.isRequired, | ||
|
||
...withLocalizePropTypes, | ||
}; | ||
|
||
const DeeplinkRedirectLoadingIndicator = (props) => ( | ||
<View style={styles.deeplinkWrapperContainer}> | ||
<View style={styles.deeplinkWrapperMessage}> | ||
<View style={styles.mb2}> | ||
<Icon | ||
width={200} | ||
height={164} | ||
src={Illustrations.RocketBlue} | ||
/> | ||
</View> | ||
<Text style={[styles.textHeadline, styles.textXXLarge]}>{props.translate('deeplinkWrapper.launching')}</Text> | ||
<View style={[styles.mt2, styles.fontSizeNormal, styles.textAlignCenter]}> | ||
<Text>{props.translate('deeplinkWrapper.redirectedToDesktopApp')}</Text> | ||
<Text> | ||
{props.translate('deeplinkWrapper.youCanAlso')} <TextLink onPress={props.openLinkInBrowser}>{props.translate('deeplinkWrapper.openLinkInBrowser')}</TextLink>. | ||
</Text> | ||
</View> | ||
</View> | ||
<View style={styles.deeplinkWrapperFooter}> | ||
<Icon | ||
width={154} | ||
height={34} | ||
fill={colors.green} | ||
src={Expensicons.ExpensifyWordmark} | ||
/> | ||
</View> | ||
</View> | ||
); | ||
|
||
DeeplinkRedirectLoadingIndicator.propTypes = propTypes; | ||
DeeplinkRedirectLoadingIndicator.displayName = 'DeeplinkRedirectLoadingIndicator'; | ||
|
||
export default withLocalize(DeeplinkRedirectLoadingIndicator); |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -8,6 +8,7 @@ import CONFIG from '../../CONFIG'; | |||||
import * as Browser from '../../libs/Browser'; | ||||||
import ONYXKEYS from '../../ONYXKEYS'; | ||||||
import * as Authentication from '../../libs/Authentication'; | ||||||
import DeeplinkRedirectLoadingIndicator from './DeeplinkRedirectLoadingIndicator'; | ||||||
|
||||||
const propTypes = { | ||||||
/** Children to render. */ | ||||||
|
@@ -37,8 +38,10 @@ class DeeplinkWrapper extends PureComponent { | |||||
this.state = { | ||||||
appInstallationCheckStatus: | ||||||
this.isMacOSWeb() && CONFIG.ENVIRONMENT !== CONST.ENVIRONMENT.DEV ? CONST.DESKTOP_DEEPLINK_APP_STATE.CHECKING : CONST.DESKTOP_DEEPLINK_APP_STATE.NOT_INSTALLED, | ||||||
isOpenLinkInBrowser: false, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NAB: rename to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated PR for above suggestion. Thank you |
||||||
}; | ||||||
this.focused = true; | ||||||
this.openLinkInBrowser = this.openLinkInBrowser.bind(this); | ||||||
} | ||||||
|
||||||
componentDidMount() { | ||||||
|
@@ -118,11 +121,25 @@ class DeeplinkWrapper extends PureComponent { | |||||
return !Browser.isMobile() && typeof navigator === 'object' && typeof navigator.userAgent === 'string' && /Mac/i.test(navigator.userAgent) && !/Electron/i.test(navigator.userAgent); | ||||||
} | ||||||
|
||||||
openLinkInBrowser() { | ||||||
this.setState({isOpenLinkInBrowser: true}); | ||||||
} | ||||||
|
||||||
deeplinkNeedRedirectLoadingIndicator() { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NAB: rename for clarity that it returns a boolean
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated PR for above suggestion. Thank you |
||||||
const validateLoginUrlPattern = '/v($|(//*))'; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copied from previous deeplink pattern 8b9ad23#diff-4a06a628c4f2fa783e590af0b888f09723c061691252843b9e5270df3ae95d45L23-L24 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /v($|(//*)) @hoangzinh this can be move to CONST file -> REGEX There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated PR for above suggestion |
||||||
const routeRegex = new RegExp(validateLoginUrlPattern); | ||||||
return routeRegex.test(window.location.pathname); | ||||||
} | ||||||
|
||||||
render() { | ||||||
if (this.state.appInstallationCheckStatus === CONST.DESKTOP_DEEPLINK_APP_STATE.CHECKING) { | ||||||
return <FullScreenLoadingIndicator style={styles.flex1} />; | ||||||
} | ||||||
|
||||||
if (this.state.appInstallationCheckStatus === CONST.DESKTOP_DEEPLINK_APP_STATE.INSTALLED && this.deeplinkNeedRedirectLoadingIndicator() && !this.state.isOpenLinkInBrowser) { | ||||||
return <DeeplinkRedirectLoadingIndicator openLinkInBrowser={this.openLinkInBrowser} />; | ||||||
} | ||||||
|
||||||
return this.props.children; | ||||||
} | ||||||
} | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,6 +170,9 @@ export default { | |
launching: 'Launching Expensify', | ||
expired: 'Your session has expired.', | ||
signIn: 'Please sign in again.', | ||
redirectedToDesktopApp: "We've redirected you to the desktop app.", | ||
youCanAlso: 'You can also', | ||
openLinkInBrowser: 'open this link in your browser', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hoangzinh has this been approved by any internal person? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nah, I copied those text from previous PR https://github.com/Expensify/App/pull/16383/files#diff-22037c1e4dbdea8803b450b3fce06e6c475762a31ecf84b34dc264ba0e443637L158-L163 Basicallly this PR reimplement what we had before. So do I need to ask on Slack again? Or we can make decision here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hoangzinh thanks for confirming, sound good! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah i think this is fine |
||
}, | ||
validateCodeModal: { | ||
successfulSignInTitle: 'Abracadabra,\nyou are signed in!', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,6 +169,9 @@ export default { | |
launching: 'Cargando Expensify', | ||
expired: 'Tu sesión ha expirado.', | ||
signIn: 'Por favor, inicia sesión de nuevo.', | ||
redirectedToDesktopApp: 'Te hemos redirigido a la aplicación de escritorio.', | ||
youCanAlso: 'También puedes', | ||
openLinkInBrowser: 'abrir este enlace en tu navegador', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same with translations |
||
}, | ||
validateCodeModal: { | ||
successfulSignInTitle: 'Abracadabra,\n¡sesión iniciada!', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from previous redirect indicator https://github.com/Expensify/App/pull/16383/files#diff-ccbc9d5854dd4a9fa4e90ff053092cf02d44d109a75426d36b8ea72afd3613feL123-L156