Fix avatar loading issues

This commit is contained in:
Reckless_Satoshi 2022-10-26 02:47:50 -07:00
parent cafc63bc05
commit b4205761fe
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
4 changed files with 11 additions and 7 deletions

View File

@ -112,7 +112,7 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
coordinatorVersion: versionInfo.coordinatorVersion,
clientVersion: versionInfo.clientVersion,
});
if (!robot.nickname && data.nickname) {
if (!robot.nickname && data.nickname && !robot.loading) {
setRobot({
...robot,
nickname: data.nickname,

View File

@ -44,7 +44,9 @@ class UserGenPage extends Component {
componentDidMount() {
// Checks in parent HomePage if there is already a nick and token
// Displays the existing one
if (this.props.robot.token) {
if (this.props.robot.nickname != null) {
this.setState({ inputToken: this.props.robot.token });
} else if (this.props.robot.token) {
this.setState({ inputToken: this.props.robot.token });
this.getGeneratedUser(this.props.robot.token);
} else {
@ -80,6 +82,7 @@ class UserGenPage extends Component {
? this.props.setRobot({
...this.props.robot,
avatarLoaded: true,
loading: false,
nickname: data.nickname ?? this.props.robot.nickname,
activeOrderId: data.active_order_id ?? null,
referralCode: data.referral_code ?? this.props.referralCode,
@ -91,6 +94,7 @@ class UserGenPage extends Component {
...this.props.robot,
nickname: data.nickname,
token: token,
loading: false,
activeOrderId: data.active_order_id ? data.active_order_id : null,
lastOrderId: data.last_order_id ? data.last_order_id : null,
referralCode: data.referral_code,

View File

@ -110,18 +110,18 @@ class UnsafeAlert extends Component {
<Alert severity='warning' sx={{ maxHeight: '120px' }}>
<AlertTitle>{t('You are not using RoboSats privately')}</AlertTitle>
<Trans i18nKey='phone_unsafe_alert'>
You will not be able to complete a trade. Use{' '}
<a>You will not be able to complete a trade. Use </a>
<Link href='https://www.torproject.org/download/' target='_blank'>
Tor Browser
</Link>{' '}
and visit the{' '}
</Link>
<a> and visit the </a>
<Link
href='http://robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion'
target='_blank'
>
Onion
</Link>{' '}
site.
<a> site.</a>
</Trans>
<div style={{ width: '100%' }}></div>
<div align='center'>

View File

@ -41,7 +41,7 @@ export const defaultRobot: Robot = {
tgEnabled: false,
tgBotName: 'unknown',
tgToken: 'unknown',
loading: true,
loading: false,
avatarLoaded: false,
copiedToken: false,
};