Skip to content

Commit

Permalink
Merge pull request #374 from DiscipleTools/development
Browse files Browse the repository at this point in the history
v1.5 merge
  • Loading branch information
zdmc23 authored Jul 12, 2020
2 parents b3ad337 + cf05d4c commit 0de24e9
Show file tree
Hide file tree
Showing 20 changed files with 779 additions and 411 deletions.
17 changes: 3 additions & 14 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import Reactotron from 'reactotron-react-native';

import AppNavigator from './navigation/AppNavigator';
import { store, persistor } from './store/store';
// import i18n from './languages';
// This import is added to enable momentJS library (do not delete)
import moment from './languages/moment';
import sharedTools from './shared';

// notifications

Expand All @@ -29,16 +27,7 @@ const styles = StyleSheet.create({
});

// App
let unsubscribe, handle;
let onlyExecuteLastCall = (parameter, functionName, timeout) => {
if (handle) {
clearTimeout(handle);
}
handle = setTimeout(function () {
handle = 0;
functionName(parameter);
}, timeout);
};
let unsubscribe;
class App extends React.Component {
constructor() {
super();
Expand All @@ -55,7 +44,7 @@ class App extends React.Component {
});
// add network connectivity handler
unsubscribe = NetInfo.addEventListener((state) =>
onlyExecuteLastCall(state.isConnected, this.handleConnectivityChange, 1000),
sharedTools.onlyExecuteLastCall(state.isConnected, this.handleConnectivityChange, 1000),
);

if (__DEV__) {
Expand Down
13 changes: 4 additions & 9 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
"name": "D.T",
"slug": "discipletoolsapp",
"privacy": "public",
"platforms": [
"ios",
"android"
],
"version": "1.4.0",
"platforms": ["ios", "android"],
"version": "1.5.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"splash": {
Expand All @@ -18,17 +15,15 @@
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"assetBundlePatterns": ["**/*"],
"ios": {
"bundleIdentifier": "tools.disciple.app",
"supportsTablet": true
},
"android": {
"package": "tools.disciple.app",
"googleServicesFile": "./google-services.json",
"versionCode": 140
"versionCode": 150
},
"description": ""
}
Expand Down
65 changes: 26 additions & 39 deletions languages/index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
import { I18nManager } from 'react-native';
import * as Localization from 'expo-localization';
import i18n from 'i18n-js';

// Intl fix
import 'intl';
// Imports by supported languages (When adding or removing a new language, modify this imports and imports of 'languages/moment.js' file)
import 'intl/locale-data/jsonp/en';
import 'intl/locale-data/jsonp/ar';
import 'intl/locale-data/jsonp/bn';
import 'intl/locale-data/jsonp/es';
import 'intl/locale-data/jsonp/fa';
import 'intl/locale-data/jsonp/fr';
import 'intl/locale-data/jsonp/id';
import 'intl/locale-data/jsonp/nl';
import 'intl/locale-data/jsonp/pt';
import 'intl/locale-data/jsonp/ru';
import 'intl/locale-data/jsonp/sw';
import 'intl/locale-data/jsonp/tr';
import 'intl/locale-data/jsonp/zh';
// This import is added to enable momentJS library (do not delete)
import moment from './moment';

import * as en from './en.json';
import * as ar from './ar.json';
import * as bn from './bn.json';
import * as es from './es.json';
import * as fr from './fr.json';
Expand All @@ -31,38 +16,40 @@ import * as sw from './sw.json';
import * as tr from './tr.json';
import * as zhCn from './zhCn.json';
import * as zhTw from './zhTw.json';
import * as ar from './ar.json';
import * as fa from './fa.json';

i18n.fallbacks = true;
//i18n.fallbacks = true;
// Locale codes names as expo-localization -> Localization.locale format (device)
i18n.translations = {
en,
bn,
es,
fr,
id,
nl,
'en-US': en,
ar,
'bn-BD': bn,
'es-ES': es,
'fa-IR': fa,
'fr-FR': fr,
'id-ID': id,
'nl-NL': nl,
'pt-BR': ptBR,
ru,
'ru-RU': ru,
sw,
tr,
'zh-hans': zhCn,
'zh-hant': zhTw,
ar,
fa,
'tr-TR': tr,
'zh-CN': zhCn,
'zh-TW': zhTw,
};
i18n.locale = Localization.locale;
i18n.isRTL = I18nManager.isRTL;

I18nManager.allowRTL(true);

// Do not try to set I18nManager.isRTL here as it will have no effect.
// To change RTL, use I18nManager.forceRTL(bool) and then refresh the app
// to see the direction changed.

i18n.setLocale = function setLocale(locale) {
Localization.locale = locale;
this.locale = Localization.locale;
i18n.setLocale = function setLocale(locale, isRTL) {
this.locale = locale;
// Enable/Disable RTL
I18nManager.allowRTL(isRTL);
I18nManager.forceRTL(isRTL);
// Update momentJS locale
let momentLocale =
locale.substring(0, 2) === 'zh' ? locale.toLowerCase() : locale.substring(0, 2);
moment.locale(momentLocale);
};

export default i18n;
64 changes: 32 additions & 32 deletions languages/locales.js
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
export default [
{
code: 'en',
code: 'en-US',
name: 'English',
direction: 'ltr',
rtl: false,
},
{
code: 'bn',
code: 'ar',
name: 'عربي',
rtl: true,
},
{
code: 'bn-BD',
name: 'বাংলা',
direction: 'ltr',
rtl: true,
},
{
code: 'es',
code: 'es-ES',
name: 'Español',
direction: 'ltr',
rtl: false,
},
{
code: 'fa-IR',
name: 'فارسی',
rtl: true,
},
{
code: 'fr',
code: 'fr-FR',
name: 'Français',
direction: 'ltr',
rtl: false,
},
{
code: 'id',
code: 'id-ID',
name: 'bahasa Indonesia',
direction: 'ltr',
rtl: false,
},
{
code: 'nl',
code: 'nl-NL',
name: 'Nederlands',
direction: 'ltr',
rtl: false,
},
{
code: 'pt-BR',
name: 'Português',
direction: 'ltr',
rtl: false,
},
{
code: 'ru',
code: 'ru-RU',
name: 'русский язык',
direction: 'ltr',
rtl: false,
},
{
code: 'sw',
name: 'Kiswahili',
direction: 'ltr',
rtl: true,
},
{
code: 'tr',
code: 'tr-TR',
name: 'Türkçe',
direction: 'ltr',
rtl: false,
},
{
code: 'zh-hans',
code: 'zh-CN',
name: '汉语',
direction: 'ltr',
rtl: false,
},
{
code: 'zh-hant',
code: 'zh-TW',
name: '漢語',
direction: 'ltr',
},
{
code: 'ar',
name: 'عربي',
direction: 'rtl',
},
{
code: 'fa',
name: 'فارسی',
direction: 'rtl',
rtl: false,
},
];
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@
"react-native-gesture-handler": "~1.6.1",
"react-native-keyboard-aware-scroll-view": "^0.9.1",
"react-native-material-selectize": "^1.18.0",
"react-native-mentions": "^1.1.4",
"react-native-modal-filter-picker": "^2.0.0",
"react-native-parsed-text": "0.0.22-beta.3",
"react-native-progress-bar-animated": "^1.0.6",
"react-native-reanimated": "~1.7.0",
"react-native-safe-area-context": "0.7.3",
Expand Down
Loading

0 comments on commit 0de24e9

Please sign in to comment.