diff --git a/app/views/ThreadMessagesView/index.tsx b/app/views/ThreadMessagesView/index.tsx index 234968509..e71d47c50 100644 --- a/app/views/ThreadMessagesView/index.tsx +++ b/app/views/ThreadMessagesView/index.tsx @@ -35,8 +35,10 @@ import styles from './styles'; import { IApplicationState, IBaseScreen, IMessage, SubscriptionType, TSubscriptionModel, TThreadModel } from '../../definitions'; import { getUidDirectMessage, debounce, isIOS } from '../../lib/methods/helpers'; import { Services } from '../../lib/services'; +import UserPreferences from '../../lib/methods/userPreferences'; const API_FETCH_COUNT = 50; +const THREADS_FILTER = 'threadsFilter'; interface IThreadMessagesViewState { loading: boolean; @@ -216,8 +218,18 @@ class ThreadMessagesView extends React.Component { + initFilter = () => + new Promise(resolve => { + const savedFilter = UserPreferences.getString(THREADS_FILTER); + if (savedFilter) { + this.setState({ currentFilter: savedFilter as Filter }, () => resolve()); + } + resolve(); + }); + + init = async () => { const { subscription } = this.state; + await this.initFilter(); if (!subscription) { return this.load(); } @@ -414,13 +426,6 @@ class ThreadMessagesView extends React.Component { - const { messages, subscription } = this.state; - const displayingThreads = this.getFilteredThreads(messages, subscription); - this.setState({ displayingThreads }); - }; - showFilterDropdown = () => this.setState({ showFilterDropdown: true }); closeFilterDropdown = () => this.setState({ showFilterDropdown: false }); @@ -429,6 +434,7 @@ class ThreadMessagesView extends React.Component {