Composer: Various fixes for emoji keywords
This commit is contained in:
parent
d15dc909e2
commit
e355ea4d08
@ -18,7 +18,7 @@ import {
|
|||||||
} from '../../../api/types';
|
} from '../../../api/types';
|
||||||
import { LangCode } from '../../../types';
|
import { LangCode } from '../../../types';
|
||||||
|
|
||||||
import { EDITABLE_INPUT_ID, SCHEDULED_WHEN_ONLINE } from '../../../config';
|
import { BASE_EMOJI_KEYWORD_LANG, EDITABLE_INPUT_ID, SCHEDULED_WHEN_ONLINE } from '../../../config';
|
||||||
import { IS_VOICE_RECORDING_SUPPORTED, IS_SINGLE_COLUMN_LAYOUT, IS_IOS } from '../../../util/environment';
|
import { IS_VOICE_RECORDING_SUPPORTED, IS_SINGLE_COLUMN_LAYOUT, IS_IOS } from '../../../util/environment';
|
||||||
import {
|
import {
|
||||||
selectChat,
|
selectChat,
|
||||||
@ -31,7 +31,6 @@ import {
|
|||||||
selectEditingMessage,
|
selectEditingMessage,
|
||||||
selectIsChatWithSelf,
|
selectIsChatWithSelf,
|
||||||
selectChatUser,
|
selectChatUser,
|
||||||
selectEmojiKeywords,
|
|
||||||
} from '../../../modules/selectors';
|
} from '../../../modules/selectors';
|
||||||
import {
|
import {
|
||||||
getAllowedAttachmentOptions,
|
getAllowedAttachmentOptions,
|
||||||
@ -233,11 +232,13 @@ const Composer: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
}, [isReady, chatId, loadScheduledHistory, lastSyncTime, threadId]);
|
}, [isReady, chatId, loadScheduledHistory, lastSyncTime, threadId]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadEmojiKeywords({ language: 'en' });
|
if (lastSyncTime && isReady) {
|
||||||
if (language !== 'en') {
|
loadEmojiKeywords({ language: BASE_EMOJI_KEYWORD_LANG });
|
||||||
loadEmojiKeywords({ language });
|
if (language !== BASE_EMOJI_KEYWORD_LANG) {
|
||||||
|
loadEmojiKeywords({ language });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [loadEmojiKeywords, language]);
|
}, [loadEmojiKeywords, language, lastSyncTime, isReady]);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (!appendixRef.current) return;
|
if (!appendixRef.current) return;
|
||||||
@ -939,8 +940,8 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
const messageWithActualBotKeyboard = isChatWithBot && selectNewestMessageWithBotKeyboardButtons(global, chatId);
|
const messageWithActualBotKeyboard = isChatWithBot && selectNewestMessageWithBotKeyboardButtons(global, chatId);
|
||||||
const scheduledIds = selectScheduledIds(global, chatId);
|
const scheduledIds = selectScheduledIds(global, chatId);
|
||||||
const { language } = global.settings.byKey;
|
const { language } = global.settings.byKey;
|
||||||
const baseEmojiKeywords = selectEmojiKeywords(global, 'en');
|
const baseEmojiKeywords = global.emojiKeywords[BASE_EMOJI_KEYWORD_LANG];
|
||||||
const emojiKeywords = language !== 'en' ? selectEmojiKeywords(global, language) : undefined;
|
const emojiKeywords = language !== BASE_EMOJI_KEYWORD_LANG ? global.emojiKeywords[language] : undefined;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
editingMessage: selectEditingMessage(global, chatId, threadId, messageListType),
|
editingMessage: selectEditingMessage(global, chatId, threadId, messageListType),
|
||||||
|
|||||||
@ -112,9 +112,10 @@ export const STICKER_SIZE_FOLDER_SETTINGS = 80;
|
|||||||
export const RECENT_STICKERS_LIMIT = 20;
|
export const RECENT_STICKERS_LIMIT = 20;
|
||||||
export const MEMOJI_STICKER_ID = 'MEMOJI_STICKER';
|
export const MEMOJI_STICKER_ID = 'MEMOJI_STICKER';
|
||||||
|
|
||||||
|
export const BASE_EMOJI_KEYWORD_LANG = 'en';
|
||||||
|
|
||||||
export const MENU_TRANSITION_DURATION = 200;
|
export const MENU_TRANSITION_DURATION = 200;
|
||||||
export const SLIDE_TRANSITION_DURATION = 450;
|
export const SLIDE_TRANSITION_DURATION = 450;
|
||||||
export const LAYERS_TRANSITION_DURATION = 450;
|
|
||||||
|
|
||||||
export const CONTENT_TYPES_FOR_QUICK_UPLOAD = 'image/png,image/gif,image/jpeg,video/mp4,video/avi,video/quicktime';
|
export const CONTENT_TYPES_FOR_QUICK_UPLOAD = 'image/png,image/gif,image/jpeg,video/mp4,video/avi,video/quicktime';
|
||||||
|
|
||||||
|
|||||||
@ -141,7 +141,6 @@ function updateCache() {
|
|||||||
'contactList',
|
'contactList',
|
||||||
'topPeers',
|
'topPeers',
|
||||||
'recentEmojis',
|
'recentEmojis',
|
||||||
'emojiKeywords',
|
|
||||||
'push',
|
'push',
|
||||||
'shouldShowContextMenuHint',
|
'shouldShowContextMenuHint',
|
||||||
]),
|
]),
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import {
|
|||||||
rebuildStickersForEmoji,
|
rebuildStickersForEmoji,
|
||||||
} from '../../reducers';
|
} from '../../reducers';
|
||||||
import searchWords from '../../../util/searchWords';
|
import searchWords from '../../../util/searchWords';
|
||||||
import { selectEmojiKeywords, selectStickerSet } from '../../selectors';
|
import { selectStickerSet } from '../../selectors';
|
||||||
|
|
||||||
const ADDED_SETS_THROTTLE = 500;
|
const ADDED_SETS_THROTTLE = 500;
|
||||||
const ADDED_SETS_THROTTLE_CHUNK = 50;
|
const ADDED_SETS_THROTTLE_CHUNK = 50;
|
||||||
@ -112,8 +112,8 @@ addReducer('toggleStickerSet', (global, actions, payload) => {
|
|||||||
|
|
||||||
addReducer('loadEmojiKeywords', (global, actions, payload: { language: LangCode }) => {
|
addReducer('loadEmojiKeywords', (global, actions, payload: { language: LangCode }) => {
|
||||||
const { language } = payload;
|
const { language } = payload;
|
||||||
let currentEmojiKeywords = selectEmojiKeywords(global, language);
|
|
||||||
|
|
||||||
|
let currentEmojiKeywords = global.emojiKeywords[language];
|
||||||
if (currentEmojiKeywords && currentEmojiKeywords.isLoading) {
|
if (currentEmojiKeywords && currentEmojiKeywords.isLoading) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ addReducer('loadEmojiKeywords', (global, actions, payload: { language: LangCode
|
|||||||
});
|
});
|
||||||
|
|
||||||
global = getGlobal();
|
global = getGlobal();
|
||||||
currentEmojiKeywords = selectEmojiKeywords(global, language);
|
currentEmojiKeywords = global.emojiKeywords[language];
|
||||||
|
|
||||||
if (!emojiKeywords) {
|
if (!emojiKeywords) {
|
||||||
setGlobal({
|
setGlobal({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user