removed unnecessary isThemeReady state

This commit is contained in:
noumantahir 2022-06-17 18:31:11 +05:00
parent 7b87d111eb
commit 2b8f0fcc50

View File

@ -105,7 +105,7 @@ import darkTheme from '../../../themes/darkTheme';
import lightTheme from '../../../themes/lightTheme'; import lightTheme from '../../../themes/lightTheme';
import persistAccountGenerator from '../../../utils/persistAccountGenerator'; import persistAccountGenerator from '../../../utils/persistAccountGenerator';
import parseVersionNumber from '../../../utils/parseVersionNumber'; import parseVersionNumber from '../../../utils/parseVersionNumber';
import { getTimeFromNow, setMomentLocale } from '../../../utils/time'; import { setMomentLocale } from '../../../utils/time';
import parseAuthUrl from '../../../utils/parseAuthUrl'; import parseAuthUrl from '../../../utils/parseAuthUrl';
import { purgeExpiredCache } from '../../../redux/actions/cacheActions'; import { purgeExpiredCache } from '../../../redux/actions/cacheActions';
import { fetchSubscribedCommunities } from '../../../redux/actions/communitiesAction'; import { fetchSubscribedCommunities } from '../../../redux/actions/communitiesAction';
@ -132,7 +132,6 @@ class ApplicationContainer extends Component {
isRenderRequire: true, isRenderRequire: true,
isReady: false, isReady: false,
isIos: Platform.OS !== 'android', isIos: Platform.OS !== 'android',
isThemeReady: false,
appState: AppState.currentState, appState: AppState.currentState,
showWelcomeModal: false, showWelcomeModal: false,
foregroundNotificationData: null, foregroundNotificationData: null,
@ -795,6 +794,7 @@ class ApplicationContainer extends Component {
} }
}; };
//TODO keep settings in redux and get rid of getSettings
_getSettings = async () => { _getSettings = async () => {
const { dispatch, otherAccounts } = this.props; const { dispatch, otherAccounts } = this.props;
@ -810,9 +810,6 @@ class ApplicationContainer extends Component {
if (settings) { if (settings) {
const isDarkMode = Appearance.getColorScheme() === 'dark'; const isDarkMode = Appearance.getColorScheme() === 'dark';
dispatch(isDarkTheme(settings.isDarkTheme !== null ? settings.isDarkTheme : isDarkMode)); dispatch(isDarkTheme(settings.isDarkTheme !== null ? settings.isDarkTheme : isDarkMode));
this.setState({
isThemeReady: true,
});
if (settings.isPinCodeOpen !== '') await dispatch(isPinCodeOpen(settings.isPinCodeOpen)); if (settings.isPinCodeOpen !== '') await dispatch(isPinCodeOpen(settings.isPinCodeOpen));
if (settings.language !== '') dispatch(setLanguage(settings.language)); if (settings.language !== '') dispatch(setLanguage(settings.language));
if (settings.server !== '') dispatch(setApi(settings.server)); if (settings.server !== '') dispatch(setApi(settings.server));
@ -1037,13 +1034,7 @@ class ApplicationContainer extends Component {
isPinCodeRequire, isPinCodeRequire,
rcOffer, rcOffer,
} = this.props; } = this.props;
const { const { isRenderRequire, isReady, showWelcomeModal, foregroundNotificationData } = this.state;
isRenderRequire,
isReady,
isThemeReady,
showWelcomeModal,
foregroundNotificationData,
} = this.state;
return ( return (
children && children &&
@ -1053,7 +1044,6 @@ class ApplicationContainer extends Component {
isPinCodeRequire, isPinCodeRequire,
isReady, isReady,
isRenderRequire, isRenderRequire,
isThemeReady,
locale: selectedLanguage, locale: selectedLanguage,
rcOffer, rcOffer,
toastNotification, toastNotification,