Emoji settings

This commit is contained in:
morethanwords 2021-05-31 22:14:39 +03:00
parent 1bc10aed4e
commit 032296046b
5 changed files with 38 additions and 9 deletions

View File

@ -2043,7 +2043,7 @@ export default class ChatBubbles {
let canHaveTail = true;
if(totalEntities && !messageMedia) {
if(totalEntities && !messageMedia && rootScope.settings.emoji.big) {
let emojiEntities = totalEntities.filter((e) => e._ === 'messageEntityEmoji');
let strLength = messageMessage.length;
let emojiStrLength = emojiEntities.reduce((acc: number, curr: any) => acc + curr.length, 0);

View File

@ -72,10 +72,8 @@ const POSTING_MEDIA_NOT_ALLOWED = 'Posting media content isn\'t allowed in this
type ChatInputHelperType = 'edit' | 'webpage' | 'forward' | 'reply';
let selId = 0;
export default class ChatInput {
public static AUTO_COMPLETE_REG_EXP = /(\s|^)((?::|.)(?!.*:).*|(?:(?:@|\/)(?:[\S]*)))$/;
private static AUTO_COMPLETE_REG_EXP = /(\s|^)((?::|.)(?!.*:).*|(?:(?:@|\/)(?:[\S]*)))$/;
public messageInput: HTMLElement;
public messageInputField: InputField;
private fileInput: HTMLInputElement;
@ -132,8 +130,8 @@ export default class ChatInput {
private lockRedo = false;
private canRedoFromHTML = '';
readonly undoHistory: string[] = [];
readonly executedHistory: string[] = [];
private readonly undoHistory: string[] = [];
private readonly executedHistory: string[] = [];
private canUndoFromHTML = '';
private autocompleteHelperController: AutocompleteHelperController;
@ -435,7 +433,8 @@ export default class ChatInput {
}, {passive: false, capture: true}); */
this.listenerSetter.add(rootScope, 'settings_updated', () => {
if(this.stickersHelper) {
if(this.stickersHelper || this.emojiHelper) {
this.previousQuery = undefined;
this.checkAutocomplete();
/* if(!rootScope.settings.stickers.suggest) {
this.stickersHelper.checkEmoticon('');
@ -1221,7 +1220,7 @@ export default class ChatInput {
const matches = value.match(ChatInput.AUTO_COMPLETE_REG_EXP);
if(!matches) {
delete this.previousQuery;
this.previousQuery = undefined;
this.autocompleteHelperController.hideOtherHelpers();
return;
}
@ -1289,7 +1288,7 @@ export default class ChatInput {
// console.log('found commands', found, filtered);
});
}
} else { // emoji
} else if(rootScope.settings.emoji.suggest) { // emoji
if(!value.match(/^\s*:(.+):\s*$/)) {
foundHelper = this.emojiHelper;
this.appEmojiManager.getBothEmojiKeywords().then(() => {

View File

@ -170,6 +170,25 @@ export default class AppGeneralSettingsTab extends SliderSuperTab {
container.append(gifsCheckboxField.label, videosCheckboxField.label);
}
{
const container = section('Emoji');
const suggestCheckboxField = new CheckboxField({
text: 'GeneralSettings.EmojiPrediction',
name: 'suggest-emoji',
stateKey: 'settings.emoji.suggest',
withRipple: true
});
const bigCheckboxField = new CheckboxField({
text: 'GeneralSettings.BigEmoji',
name: 'emoji-big',
stateKey: 'settings.emoji.big',
withRipple: true
});
container.append(suggestCheckboxField.label, bigCheckboxField.label);
}
{
const container = section('Telegram.InstalledStickerPacksController');

View File

@ -436,6 +436,7 @@ const lang = {
"Of": "%1$d of %2$d",
"NoResult": "No results",
"Updating": "Updating...",
"Emoji": "Emoji",
// * macos
"AccountSettings.Filters": "Chat Folders",
@ -668,6 +669,8 @@ const lang = {
"NewPoll.OptionsAddOption": "Add an Option",
"NewPoll.MultipleChoice": "Multiple Answers",
"NewPoll.Quiz": "Quiz Mode",
"GeneralSettings.BigEmoji": "Large Emoji",
"GeneralSettings.EmojiPrediction": "Suggest Emoji",
"GroupPermission.Delete": "Delete Exception",
"Schedule.SendToday": "Send today at %@",
"Schedule.SendDate": "Send on %@ at %@",

View File

@ -74,6 +74,10 @@ export type State = {
suggest: boolean,
loop: boolean
},
emoji: {
suggest: boolean,
big: boolean
},
background?: Background, // ! DEPRECATED
themes: Theme[],
theme: Theme['name'],
@ -119,6 +123,10 @@ export const STATE_INIT: State = {
suggest: true,
loop: true
},
emoji: {
suggest: true,
big: true
},
themes: [{
name: 'day',
background: {