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!", "no_internet": "No connection!",
"confirm": "Confirm", "confirm": "Confirm",
"removed": "Removed", "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": { "post": {
"reblog_alert": "Are you sure you want to reblog?", "reblog_alert": "Are you sure you want to reblog?",

View File

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