Login screen fixed for offline mode

This commit is contained in:
Mustafa Buyukcelebi 2019-07-17 13:09:58 +03:00
parent 5ef3253618
commit 8a513ecd0c
2 changed files with 23 additions and 4 deletions

View File

@ -203,7 +203,9 @@
"no_internet": "No connection!",
"confirm": "Confirm",
"removed": "Removed",
"same_user": "This user already added to list"
"same_user": "This user already added to list",
"unknow_error": "An error occurred",
"error": "Error"
},
"post": {
"reblog_alert": "Are you sure you want to reblog?",

View File

@ -108,13 +108,29 @@ class LoginContainer extends PureComponent {
};
_getAccountsWithUsername = async username => {
const validUsers = await lookupAccounts(username);
return validUsers;
const { intl, isConnected } = this.props;
if (isConnected) {
return null;
}
try {
const validUsers = await lookupAccounts(username);
return validUsers;
} catch (error) {
Alert.alert(
intl.formatMessage({ id: 'alert.error' }),
intl.formatMessage({ d: 'alert.unknow_error' }),
);
}
};
_handleSignUp = () => {
const { intl } = this.props;
Linking.openURL('https://signup.steemit.com/?ref=esteem').catch(err =>
alert('An error occurred', err),
Alert.alert(intl.formatMessage({ id: 'alert.error' }), err.message),
);
};
@ -137,6 +153,7 @@ const mapStateToProps = state => ({
account: state.accounts,
notificationDetails: state.application.notificationDetails,
notificationSettings: state.application.isNotificationOpen,
isConnected: state.application.isConnected,
});
export default injectIntl(connect(mapStateToProps)(LoginContainer));