mattermost-mobile/app/components/autocomplete/index.ts
Daniel Espino García bcb78c499c
[Gekidou] [MM-39682] Add autocomplete and emoji suggestion (#5931)
* Add autocomplete and emoji suggestion

* Address feedback and minor fixes

* Remove unneeded constants and fix max height to be aware of the header.

* Address feedback

* Refactor PostDraft and correctly position Autocomplete

* Set min char for emoji search at 2

* Replace searchCustomEmojis from setTimeout to debounce

* Remove comments

* simplify prop

* Change naming of certain variables

* remove unnecesary fragment

* Improve Autocomplete height calculation

* Address feedback

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2022-02-22 11:30:22 +01:00

22 lines
897 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 {switchMap} from 'rxjs/operators';
import {MM_TABLES, SYSTEM_IDENTIFIERS} from '@constants/database';
import Autocomplete from './autocomplete';
import type {WithDatabaseArgs} from '@typings/database/database';
import type SystemModel from '@typings/database/models/servers/system';
const enhanced = withObservables([], ({database}: WithDatabaseArgs) => ({
isAppsEnabled: database.get<SystemModel>(MM_TABLES.SERVER.SYSTEM).findAndObserve(SYSTEM_IDENTIFIERS.CONFIG).pipe(
switchMap((cfg) => of$(cfg.value.FeatureFlagAppsEnabled === 'true')),
),
}));
export default withDatabase(enhanced(Autocomplete));