forked from Ivasoft/mattermost-mobile
* Started with Channel Post List * Added markdown hashtag * Added TouchableWithFeedback component * Added utils/bottom_sheet * Removed BottomSheet in favor of future SlideUpPanel * Added markdown_block_quote * Added markdown_list_item * Added markdown_list * Added MarkDownTableCell component * Markdown_table - in progress - need to verify TS * Added markdown_table * Update Podfile.lock * Added deep_linking constant * Added utils/draft * Update config to include ExperimentalNormalizeMarkdownLinks * Added markdown_link * Added markdown_table_row * Added ProgressiveImage and RetriableImage components and images utils * Converted Retriable component to functional component * Added type definition for commonmark * Continuing with markdown TS * Markdown - Typing props [ in progress ] * Fix boolean flag with mardown block quote * Adding observable config to markdown_link * TS Fixes [ in progress ] * TS fixes * TS fixes - TextStyles * Update markdown.tsx * TS fixes on markdown * TS Fixes - AtMention component * AtMention [ IN PROGRESS ] * Add markdown support * Fix emoji and jumboEmoji on iOS * Fix handleMyTeam operator * Fix navigation style based on theme * Fix iOS MattermostManaged deleteDatabse return error type * wrap setNavigationStackStyles under a requestAnimationFrame * Add preventDoubleTap to channel mention * Increase double tap to 750ms * Fix handleReceivedPostsInChannel chunk query * Set initial navigation theme * Swizzle FastImage on iOS * fix preventDoubleTap test Co-authored-by: Avinash Lingaloo <> Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
64 lines
2.1 KiB
TypeScript
64 lines
2.1 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {buildQueryString} from '@utils/helpers';
|
|
|
|
import {PER_PAGE_DEFAULT} from './constants';
|
|
|
|
export interface ClientEmojisMix {
|
|
getCustomEmoji: (id: string) => Promise<CustomEmoji>;
|
|
getCustomEmojiByName: (name: string) => Promise<CustomEmoji>;
|
|
getCustomEmojis: (page?: number, perPage?: number, sort?: string) => Promise<CustomEmoji[]>;
|
|
getSystemEmojiImageUrl: (filename: string) => string;
|
|
getCustomEmojiImageUrl: (id: string) => string;
|
|
searchCustomEmoji: (term: string, options?: Record<string, any>) => Promise<CustomEmoji[]>;
|
|
autocompleteCustomEmoji: (name: string) => Promise<CustomEmoji[]>;
|
|
}
|
|
|
|
const ClientEmojis = (superclass: any) => class extends superclass {
|
|
getCustomEmoji = async (id: string) => {
|
|
return this.doFetch(
|
|
`${this.getEmojisRoute()}/${id}`,
|
|
{method: 'get'},
|
|
);
|
|
};
|
|
|
|
getCustomEmojiByName = async (name: string) => {
|
|
return this.doFetch(
|
|
`${this.getEmojisRoute()}/name/${name}`,
|
|
{method: 'get'},
|
|
);
|
|
};
|
|
|
|
getCustomEmojis = async (page = 0, perPage = PER_PAGE_DEFAULT, sort = '') => {
|
|
return this.doFetch(
|
|
`${this.getEmojisRoute()}${buildQueryString({page, per_page: perPage, sort})}`,
|
|
{method: 'get'},
|
|
);
|
|
};
|
|
|
|
getSystemEmojiImageUrl = (filename: string) => {
|
|
return `${this.apiClient.baseUrl}static/emoji/${filename}.png`;
|
|
};
|
|
|
|
getCustomEmojiImageUrl = (id: string) => {
|
|
return `${this.apiClient.baseUrl}${this.getEmojiRoute(id)}/image`;
|
|
};
|
|
|
|
searchCustomEmoji = async (term: string, options = {}) => {
|
|
return this.doFetch(
|
|
`${this.getEmojisRoute()}/search`,
|
|
{method: 'post', body: {term, ...options}},
|
|
);
|
|
};
|
|
|
|
autocompleteCustomEmoji = async (name: string) => {
|
|
return this.doFetch(
|
|
`${this.getEmojisRoute()}/autocomplete${buildQueryString({name})}`,
|
|
{method: 'get'},
|
|
);
|
|
};
|
|
};
|
|
|
|
export default ClientEmojis;
|