mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 12:51:42 +03:00
Merge branch 'master' of https://github.com/esteemapp/esteem-mobile into feature/boost
This commit is contained in:
commit
fae7a5ffc9
@ -207,7 +207,8 @@
|
||||
"removed": "Removed",
|
||||
"same_user": "This user already added to list",
|
||||
"unknow_error": "An error occurred",
|
||||
"error": "Error"
|
||||
"error": "Error",
|
||||
"fetch_error": "Fetching data from server failed, please try again or notify us at info@esteem.app"
|
||||
},
|
||||
"post": {
|
||||
"reblog_alert": "Are you sure you want to reblog?",
|
||||
|
16
src/index.js
16
src/index.js
@ -1,7 +1,19 @@
|
||||
import React from 'react';
|
||||
import { Provider, connect } from 'react-redux';
|
||||
import { PersistGate } from 'redux-persist/integration/react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { IntlProvider, addLocaleData } from 'react-intl';
|
||||
|
||||
import en from 'react-intl/locale-data/en';
|
||||
import id from 'react-intl/locale-data/id';
|
||||
import ru from 'react-intl/locale-data/ru';
|
||||
import de from 'react-intl/locale-data/de';
|
||||
import it from 'react-intl/locale-data/it';
|
||||
import hu from 'react-intl/locale-data/hu';
|
||||
import tr from 'react-intl/locale-data/tr';
|
||||
import ko from 'react-intl/locale-data/ko';
|
||||
import lt from 'react-intl/locale-data/lt';
|
||||
import pt from 'react-intl/locale-data/pt';
|
||||
import fa from 'react-intl/locale-data/fa';
|
||||
|
||||
import { flattenMessages } from './utils/flattenMessages';
|
||||
import messages from './config/locales';
|
||||
@ -9,6 +21,8 @@ import messages from './config/locales';
|
||||
import Application from './screens/application';
|
||||
import { store, persistor } from './redux/store/store';
|
||||
|
||||
addLocaleData([...en, ...ru, ...de, ...id, ...it, ...hu, ...tr, ...ko, ...pt, ...lt, ...fa]);
|
||||
|
||||
const _renderApp = ({ locale }) => (
|
||||
<PersistGate loading={null} persistor={persistor}>
|
||||
<IntlProvider locale={locale} messages={flattenMessages(messages[locale])}>
|
||||
|
@ -7,24 +7,11 @@ import get from 'lodash/get';
|
||||
import AppCenter from 'appcenter';
|
||||
import changeNavigationBarColor from 'react-native-navigation-bar-color';
|
||||
import { connect } from 'react-redux';
|
||||
import { addLocaleData } from 'react-intl';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import { NavigationActions } from 'react-navigation';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import EStyleSheet from 'react-native-extended-stylesheet';
|
||||
|
||||
// Languages
|
||||
import en from 'react-intl/locale-data/en';
|
||||
import id from 'react-intl/locale-data/id';
|
||||
import ru from 'react-intl/locale-data/ru';
|
||||
import de from 'react-intl/locale-data/de';
|
||||
import it from 'react-intl/locale-data/it';
|
||||
import hu from 'react-intl/locale-data/hu';
|
||||
import tr from 'react-intl/locale-data/tr';
|
||||
import ko from 'react-intl/locale-data/ko';
|
||||
import lt from 'react-intl/locale-data/lt';
|
||||
import pt from 'react-intl/locale-data/pt';
|
||||
import fa from 'react-intl/locale-data/fa';
|
||||
|
||||
// Constants
|
||||
import AUTH_TYPE from '../../../constants/authType';
|
||||
import ROUTES from '../../../constants/routeNames';
|
||||
@ -79,8 +66,6 @@ import { encryptKey } from '../../../utils/crypto';
|
||||
import darkTheme from '../../../themes/darkTheme';
|
||||
import lightTheme from '../../../themes/lightTheme';
|
||||
|
||||
addLocaleData([...en, ...ru, ...de, ...id, ...it, ...hu, ...tr, ...ko, ...pt, ...lt, ...fa]);
|
||||
|
||||
class ApplicationContainer extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -208,11 +193,11 @@ class ApplicationContainer extends Component {
|
||||
if (get(result, 'title')) {
|
||||
content = result;
|
||||
} else {
|
||||
this._handleAlert('No existing post');
|
||||
this._handleAlert('deep_link.no_existing_post');
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this._handleAlert('No existing post');
|
||||
this._handleAlert('deep_link.no_existing_post');
|
||||
});
|
||||
|
||||
routeName = ROUTES.SCREENS.POST;
|
||||
@ -221,7 +206,7 @@ class ApplicationContainer extends Component {
|
||||
profile = await getUser(author);
|
||||
|
||||
if (!profile) {
|
||||
this._handleAlert('No existing user');
|
||||
this._handleAlert('deep_link.no_existing_user');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -243,8 +228,13 @@ class ApplicationContainer extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_handleAlert = (title = null, text = null) => {
|
||||
Alert.alert(title, text);
|
||||
_handleAlert = (text = null, title = null) => {
|
||||
const { intl } = this.props;
|
||||
|
||||
Alert.alert(
|
||||
intl.formatMessage({ id: title || 'alert.warning' }),
|
||||
intl.formatMessage({ id: text || 'alert.unknow_error' }),
|
||||
);
|
||||
};
|
||||
|
||||
_handleAppStateChange = nextAppState => {
|
||||
@ -345,10 +335,6 @@ class ApplicationContainer extends Component {
|
||||
if (isConnected !== status) {
|
||||
dispatch(setConnectivityStatus(status));
|
||||
}
|
||||
|
||||
// TODO: solve this work arround
|
||||
// NetInfo.isConnected.removeEventListener('connectionChange', this._handleConntectionChange);
|
||||
// NetInfo.isConnected.addEventListener('connectionChange', this._handleConntectionChange);
|
||||
};
|
||||
|
||||
_onBackPress = () => {
|
||||
@ -450,7 +436,7 @@ class ApplicationContainer extends Component {
|
||||
};
|
||||
|
||||
_fetchUserDataFromDsteem = async realmObject => {
|
||||
const { dispatch } = this.props;
|
||||
const { dispatch, intl } = this.props;
|
||||
|
||||
await getUser(realmObject.username)
|
||||
.then(accountData => {
|
||||
@ -461,9 +447,9 @@ class ApplicationContainer extends Component {
|
||||
this._connectNotificationServer(accountData.name);
|
||||
})
|
||||
.catch(err => {
|
||||
this._handleAlert();
|
||||
Alert.alert(
|
||||
`Fetching data from server failed, please try again or notify us at info@esteem.app
|
||||
\n${err.message.substr(0, 20)}`,
|
||||
`${intl.formatMessage({ id: 'alert.fetch_error' })} \n${err.message.substr(0, 20)}`,
|
||||
);
|
||||
});
|
||||
};
|
||||
@ -515,6 +501,7 @@ class ApplicationContainer extends Component {
|
||||
otherAccounts,
|
||||
currentAccount: { name, local },
|
||||
dispatch,
|
||||
intl,
|
||||
} = this.props;
|
||||
|
||||
removeUserData(name)
|
||||
@ -543,8 +530,7 @@ class ApplicationContainer extends Component {
|
||||
})
|
||||
.catch(err => {
|
||||
Alert.alert(
|
||||
`Fetching data from server failed, please try again or notify us at info@esteem.app
|
||||
\n${err.substr(0, 20)}`,
|
||||
`${intl.formatMessage({ id: 'alert.fetch_error' })} \n${err.message.substr(0, 20)}`,
|
||||
);
|
||||
});
|
||||
};
|
||||
@ -632,4 +618,4 @@ export default connect(
|
||||
...bindActionCreators({ fetchGlobalProperties }, dispatch),
|
||||
},
|
||||
}),
|
||||
)(ApplicationContainer);
|
||||
)(injectIntl(ApplicationContainer));
|
||||
|
Loading…
Reference in New Issue
Block a user