From 041cbd6ce63b862fa1236c231e1bc93275be25b3 Mon Sep 17 00:00:00 2001 From: u-e Date: Sun, 31 Mar 2019 14:15:36 +0300 Subject: [PATCH 1/2] added persian language --- src/config/locales/index.js | 2 + src/constants/options/language.js | 2 + .../container/applicationContainer.js | 50 ++++++++++--------- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/config/locales/index.js b/src/config/locales/index.js index ba1dadee1..b61b3daf8 100644 --- a/src/config/locales/index.js +++ b/src/config/locales/index.js @@ -9,6 +9,7 @@ export default { 'ko-KR': require('./ko-KR.json'), 'lt-LT': require('./lt-LT.json'), 'pt-PT': require('./pt-PT.json'), + 'fa-IR': require('./fa-IR.json'), }; export const locales = [ @@ -22,4 +23,5 @@ export const locales = [ { id: 'ko-KR', name: 'Korean' }, { id: 'lt-LT', name: 'Lithuanian' }, { id: 'pt-PT', name: 'Porteguese' }, + { id: 'fa-IR', name: 'Persian' }, ]; diff --git a/src/constants/options/language.js b/src/constants/options/language.js index 1fe1d87c3..e3f516e65 100644 --- a/src/constants/options/language.js +++ b/src/constants/options/language.js @@ -8,6 +8,7 @@ export default [ 'Porteguese', 'Russian', 'Turkish', + 'Persian', ]; export const VALUE = [ @@ -20,4 +21,5 @@ export const VALUE = [ 'pt-PT', 'ru-RU', 'tr-TR', + 'fa-IR', ]; diff --git a/src/screens/application/container/applicationContainer.js b/src/screens/application/container/applicationContainer.js index b69de5072..b723d0d4a 100644 --- a/src/screens/application/container/applicationContainer.js +++ b/src/screens/application/container/applicationContainer.js @@ -1,7 +1,6 @@ +/* eslint-disable */ import React, { Component } from 'react'; -import { - Platform, BackHandler, Alert, NetInfo, -} from 'react-native'; +import { Platform, BackHandler, Alert, NetInfo } from 'react-native'; import { connect } from 'react-redux'; import { addLocaleData } from 'react-intl'; import Config from 'react-native-config'; @@ -20,6 +19,8 @@ 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 he from 'react-intl/locale-data/he'; // Constants import AUTH_TYPE from '../../../constants/authType'; @@ -71,7 +72,7 @@ import { import ApplicationScreen from '../screen/applicationScreen'; import { Launch } from '../..'; -addLocaleData([...en, ...ru, ...de, ...id, ...it, ...hu, ...tr, ...ko, ...pt, ...lt]); +addLocaleData([...en, ...ru, ...de, ...id, ...it, ...hu, ...tr, ...ko, ...pt, ...lt, ...fa]); class ApplicationContainer extends Component { constructor() { @@ -87,7 +88,7 @@ class ApplicationContainer extends Component { const { isIos } = this.state; let isConnected; - await NetInfo.isConnected.fetch().then((_isConnected) => { + await NetInfo.isConnected.fetch().then(_isConnected => { isConnected = _isConnected; }); @@ -104,9 +105,7 @@ class ApplicationContainer extends Component { }; componentWillReceiveProps(nextProps) { - const { - isDarkTheme: _isDarkTheme, selectedLanguage, isLogingOut, isConnected, - } = this.props; + const { isDarkTheme: _isDarkTheme, selectedLanguage, isLogingOut, isConnected } = this.props; if (_isDarkTheme !== nextProps.isDarkTheme || selectedLanguage !== nextProps.selectedLanguage) { this.setState({ isRenderRequire: false }, () => this.setState({ isRenderRequire: true })); @@ -136,7 +135,7 @@ class ApplicationContainer extends Component { await this._getUserData(); }; - _handleConntectionChange = (status) => { + _handleConntectionChange = status => { const { dispatch, isConnected } = this.props; if (isConnected !== status) { @@ -170,19 +169,19 @@ class ApplicationContainer extends Component { let realmData = []; let currentUsername; - await getAuthStatus().then((res) => { + await getAuthStatus().then(res => { ({ currentUsername } = res); if (res) { - getUserData().then(async (userData) => { + getUserData().then(async userData => { if (userData.length > 0) { realmData = userData; userData.forEach((accountData, index) => { if ( - !accountData.accessToken - && !accountData.masterKey - && !accountData.postingKey - && !accountData.activeKey - && !accountData.memoKey + !accountData.accessToken && + !accountData.masterKey && + !accountData.postingKey && + !accountData.activeKey && + !accountData.memoKey ) { realmData.splice(index, 1); if (realmData.length === 0) { @@ -213,7 +212,7 @@ class ApplicationContainer extends Component { await switchAccount(realmObject[0].username); } await getUser(realmObject[0].username) - .then(async (accountData) => { + .then(async accountData => { dispatch(login(true)); const isExistUser = await getExistUser(); @@ -227,7 +226,7 @@ class ApplicationContainer extends Component { } this._connectNotificationServer(accountData.name); }) - .catch((err) => { + .catch(err => { Alert.alert(err); }); } @@ -239,15 +238,18 @@ class ApplicationContainer extends Component { _getSettings = () => { const { dispatch } = this.props; - getSettings().then((response) => { + getSettings().then(response => { if (response) { if (response.isDarkTheme !== '') dispatch(isDarkTheme(response.isDarkTheme)); if (response.language !== '') dispatch(setLanguage(response.language)); if (response.server !== '') dispatch(setApi(response.server)); - if (response.upvotePercent !== '') dispatch(setUpvotePercent(Number(response.upvotePercent))); + if (response.upvotePercent !== '') + dispatch(setUpvotePercent(Number(response.upvotePercent))); if (response.isDefaultFooter !== '') dispatch(isDefaultFooter(response.isDefaultFooter)); if (response.notification !== '') { - dispatch(changeNotificationSettings({ type: 'notification', action: response.notification })); + dispatch( + changeNotificationSettings({ type: 'notification', action: response.notification }), + ); dispatch(changeAllNotificationSettings(response)); Push.setEnabled(response.notification); @@ -261,7 +263,7 @@ class ApplicationContainer extends Component { }); }; - _connectNotificationServer = (username) => { + _connectNotificationServer = username => { const { dispatch, unreadActivityCount } = this.props; const ws = new WebSocket(`${Config.ACTIVITY_WEBSOCKET_URL}?user=${username}`); @@ -299,10 +301,10 @@ class ApplicationContainer extends Component { .catch(() => {}); }; - _switchAccount = async (targetAccountUsername) => { + _switchAccount = async targetAccountUsername => { const { dispatch } = this.props; - await switchAccount(targetAccountUsername).then((accountData) => { + await switchAccount(targetAccountUsername).then(accountData => { const realmData = getUserDataWithUsername(targetAccountUsername); const _currentAccount = accountData; _currentAccount.username = accountData.name; From 121e022737f8c46ced548726fd5009afc5db320e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?u=C4=9Fur=20erdal?= Date: Sun, 31 Mar 2019 14:16:46 +0300 Subject: [PATCH 2/2] Update applicationContainer.js --- src/screens/application/container/applicationContainer.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/screens/application/container/applicationContainer.js b/src/screens/application/container/applicationContainer.js index b723d0d4a..900dbc397 100644 --- a/src/screens/application/container/applicationContainer.js +++ b/src/screens/application/container/applicationContainer.js @@ -1,4 +1,3 @@ -/* eslint-disable */ import React, { Component } from 'react'; import { Platform, BackHandler, Alert, NetInfo } from 'react-native'; import { connect } from 'react-redux';