mattermost-mobile/app/screens/thread/index.tsx
Christopher Poile 67342246eb
MM-45754 - Calls: Add current call bar to thread screen (#6628)
* remove isCallsPluginEnabled; add current call bar to thread screen

* popTo thread/call screen; updateProps in dismissAllModalsAndPopToScreen

* remove unneeded withServerUrl; only updateProps if needed
2022-10-25 21:34:51 -04:00

28 lines
918 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {withDatabase} from '@nozbe/watermelondb/DatabaseProvider';
import withObservables from '@nozbe/with-observables';
import {of as of$} from 'rxjs';
import {distinctUntilChanged, switchMap} from 'rxjs/operators';
import {observeCurrentCall} from '@calls/state';
import {observePost} from '@queries/servers/post';
import Thread from './thread';
import type {WithDatabaseArgs} from '@typings/database/database';
const enhanced = withObservables(['rootId'], ({database, rootId}: WithDatabaseArgs & {rootId: string}) => {
const isInACall = observeCurrentCall().pipe(
switchMap((call) => of$(Boolean(call))),
distinctUntilChanged(),
);
return {
rootPost: observePost(database, rootId),
isInACall,
};
});
export default withDatabase(enhanced(Thread));