* update js dependencies * update react-native libraries * update watermelonDB * update RN to 0.72.7 * update fastlane * fix remove_markdown/at_mention import * update mattermost libraries * update fastlane deps * remove haptic-feedback patch * update okhttp to 4.12.0 and patch netinfo to accurately identify VPN connections * create ImaegStyles intersection type
32 lines
1.4 KiB
TypeScript
32 lines
1.4 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {withDatabase, withObservables} from '@nozbe/watermelondb/react';
|
|
import {of as of$} from 'rxjs';
|
|
import {switchMap} from 'rxjs/operators';
|
|
|
|
import {Preferences} from '@constants';
|
|
import {queryAllCustomEmojis} from '@queries/servers/custom_emoji';
|
|
import {queryEmojiPreferences} from '@queries/servers/preference';
|
|
import {observeConfigBooleanValue} from '@queries/servers/system';
|
|
|
|
import EmojiSuggestion from './emoji_suggestion';
|
|
|
|
import type {WithDatabaseArgs} from '@typings/database/database';
|
|
import type CustomEmojiModel from '@typings/database/models/servers/custom_emoji';
|
|
|
|
const emptyEmojiList: CustomEmojiModel[] = [];
|
|
const enhanced = withObservables([], ({database}: WithDatabaseArgs) => {
|
|
const isCustomEmojisEnabled = observeConfigBooleanValue(database, 'EnableCustomEmoji');
|
|
return {
|
|
customEmojis: isCustomEmojisEnabled.pipe(
|
|
switchMap((enabled) => (enabled ? queryAllCustomEmojis(database).observe() : of$(emptyEmojiList))),
|
|
),
|
|
skinTone: queryEmojiPreferences(database, Preferences.EMOJI_SKINTONE).
|
|
observeWithColumns(['value']).pipe(
|
|
switchMap((prefs) => of$(prefs?.[0]?.value ?? 'default')),
|
|
),
|
|
};
|
|
});
|
|
|
|
export default withDatabase(enhanced(EmojiSuggestion));
|