Display user badges

This commit is contained in:
Evan Hahn 2021-11-02 18:01:13 -05:00 committed by GitHub
parent 927c22ef73
commit f647c4e053
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
95 changed files with 2891 additions and 424 deletions

View file

@ -34,6 +34,7 @@ import { cleanDataForIpc } from './cleanDataForIpc';
import type { ReactionType } from '../types/Reactions';
import type { ConversationColorType, CustomColorType } from '../types/Colors';
import type { UUIDStringType } from '../types/UUID';
import type { BadgeType } from '../badges/types';
import type { ProcessGroupCallRingRequestResult } from '../types/Calling';
import type { RemoveAllConfiguration } from '../types/RemoveAllConfiguration';
import createTaskWithTimeout from '../textsecure/TaskWithTimeout';
@ -272,6 +273,10 @@ const dataInterface: ClientInterface = {
updateEmojiUsage,
getRecentEmojis,
getAllBadges,
updateOrCreateBadges,
badgeImageFileDownloaded,
removeAll,
removeAllConfiguration,
@ -1575,6 +1580,27 @@ async function getRecentEmojis(limit = 32) {
return channels.getRecentEmojis(limit);
}
// Badges
function getAllBadges(): Promise<Array<BadgeType>> {
return channels.getAllBadges();
}
async function updateOrCreateBadges(
badges: ReadonlyArray<BadgeType>
): Promise<void> {
if (badges.length) {
await channels.updateOrCreateBadges(badges);
}
}
function badgeImageFileDownloaded(
url: string,
localPath: string
): Promise<void> {
return channels.badgeImageFileDownloaded(url, localPath);
}
// Other
async function removeAll() {