chore: fix IPreference interface and organize import

This commit is contained in:
GleidsonDaniel 2022-01-13 18:45:55 -03:00
parent 3cc5a7b656
commit e153f55f7d
1 changed files with 12 additions and 20 deletions

View File

@ -1,31 +1,23 @@
import { StackNavigationProp } from '@react-navigation/stack';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { Switch } from 'react-native'; import { Switch } from 'react-native';
import { RadioButton } from 'react-native-ui-lib'; import { RadioButton } from 'react-native-ui-lib';
import { StackNavigationProp } from '@react-navigation/stack';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { setPreference } from '../actions/sortPreferences'; import { setPreference } from '../actions/sortPreferences';
import RocketChat from '../lib/rocketchat';
import StatusBar from '../containers/StatusBar';
import I18n from '../i18n';
import * as List from '../containers/List';
import { useTheme } from '../theme';
import { themes } from '../constants/colors'; import { themes } from '../constants/colors';
import * as HeaderButton from '../containers/HeaderButton';
import SafeAreaView from '../containers/SafeAreaView';
import { ICON_SIZE } from '../containers/List/constants';
import log, { events, logEvent } from '../utils/log';
import { DisplayMode, SortBy } from '../constants/constantDisplayMode'; import { DisplayMode, SortBy } from '../constants/constantDisplayMode';
import * as HeaderButton from '../containers/HeaderButton';
import * as List from '../containers/List';
import { ICON_SIZE } from '../containers/List/constants';
import SafeAreaView from '../containers/SafeAreaView';
import StatusBar from '../containers/StatusBar';
import { IPreferences } from '../definitions';
import I18n from '../i18n';
import RocketChat from '../lib/rocketchat';
import { SettingsStackParamList } from '../stacks/types'; import { SettingsStackParamList } from '../stacks/types';
import { useTheme } from '../theme';
interface IParam { import log, { events, logEvent } from '../utils/log';
sortBy: SortBy;
groupByType: boolean;
showFavorites: boolean;
showUnread: boolean;
showAvatar: boolean;
displayMode: DisplayMode;
}
interface IDisplayPrefsView { interface IDisplayPrefsView {
navigation: StackNavigationProp<SettingsStackParamList, 'DisplayPrefsView'>; navigation: StackNavigationProp<SettingsStackParamList, 'DisplayPrefsView'>;
@ -53,7 +45,7 @@ const DisplayPrefsView = (props: IDisplayPrefsView): JSX.Element => {
} }
}, []); }, []);
const setSortPreference = async (param: Partial<IParam>) => { const setSortPreference = async (param: Partial<IPreferences>) => {
try { try {
dispatch(setPreference(param)); dispatch(setPreference(param));
await RocketChat.saveSortPreference(param); await RocketChat.saveSortPreference(param);