Skip to content

Commit

Permalink
VC-1429 - Crash: ExceptionsManagerModule.java line 83 (#632)
Browse files Browse the repository at this point in the history
* VC-1429 - Crash:  ExceptionsManagerModule.java line 83

https://jesusfilmmedia.atlassian.net/browse/VC-1429

* Send logs and warnings to crashlytics

* Update src/domain/Common/LanguageSwitch/index.tsx

Co-authored-by: Tataihono Nikora <tataihono.nikora@gmail.com>

* Update src/domain/Common/LanguageSwitch/index.tsx

Co-authored-by: Tataihono Nikora <tataihono.nikora@gmail.com>

* Update src/domain/Adventures/AdvLanguageSwitch/index.tsx

Co-authored-by: Tataihono Nikora <tataihono.nikora@gmail.com>

Co-authored-by: Vlad Mitkovsky <vlad@mitkovsky.com>
Co-authored-by: Tataihono Nikora <tataihono.nikora@gmail.com>
  • Loading branch information
3 people authored Apr 20, 2021
1 parent ccacb43 commit 95285d0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/actions/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function checkCurrentLanguage(prefLang = '') {
return async (dispatch, getState): void => {
const languageStored = getState().auth.language;
const languageCurrent =
prefLang.toUpperCase() || i18next.language.toUpperCase();
prefLang.toUpperCase() || i18next?.language?.toUpperCase() || 'EN';

if (prefLang !== i18next.language) {
i18next.changeLanguage(prefLang.toLowerCase());
Expand Down
2 changes: 1 addition & 1 deletion src/domain/Adventures/AdvLanguageSwitch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const AdvLanguageSwitch = (): ReactElement => {
}, [currentLang]);

const fillLanguages = (): void => {
const appLang = i18next.language.toUpperCase();
const appLang = i18next?.language?.toUpperCase() || 'EN';
availableTranslations.map(lang => {
const stepLang = lang.toUpperCase();
if (appLang === stepLang || (stepLang === 'EN' && appLang === 'EN-US')) {
Expand Down
4 changes: 2 additions & 2 deletions src/domain/Common/LanguageSwitch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const LanguageSwitch = (): ReactElement => {
useEffect(() => {
// Prepare list of languages for selector removing 'en-US' used
// for development purposes only.
const appLang = i18next.language.toUpperCase();
const appLang = i18next?.language?.toUpperCase() || 'EN';

availableTranslations.map(lang => {
const stepLang = lang.toUpperCase();
Expand All @@ -52,7 +52,7 @@ const LanguageSwitch = (): ReactElement => {

const newLangSelected = (option: Option): void => {
// Change current language for app UI.
const appLang = i18next.language.toUpperCase();
const appLang = i18next?.language?.toUpperCase() || 'EN';
const newSelectOptions: Option[] = selectOptions;
selectOptions.map((value, index) => {
if (
Expand Down
7 changes: 7 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import moment from 'moment';
import { useEffect, useRef } from 'react';
import { Keyboard } from 'react-native';
import Orientation from 'react-native-orientation-locker';
import crashlytics from '@react-native-firebase/crashlytics';

export {
difference,
Expand Down Expand Up @@ -248,6 +249,9 @@ export function registerLogs() {
if (ENABLE_LOGS) {
console.log.apply(console, args);
}
} else {
const args = getArgs(arguments, true);
crashlytics().log(args);
}
};

Expand All @@ -257,6 +261,9 @@ export function registerLogs() {
if (ENABLE_WARN) {
console.warn.apply(console, args);
}
} else {
const args = getArgs(arguments, true);
crashlytics().log(args);
}
};
}

0 comments on commit 95285d0

Please sign in to comment.