mastodon-app-ufficiale-ipho.../MastodonSDK/Sources/MastodonCore/Persistence/Protocol/MastodonEmojiContainer.swift

28 lines
708 B
Swift

//
// MastodonEmojiContainer.swift
// MastodonEmojiContainer
//
// Created by Cirno MainasuK on 2021-9-3.
// Copyright © 2021 Twidere. All rights reserved.
//
import Foundation
import MastodonSDK
import CoreDataStack
public protocol MastodonEmojiContainer {
var emojis: [Mastodon.Entity.Emoji]? { get }
}
extension MastodonEmojiContainer {
public var mastodonEmojis: [MastodonEmoji] {
return emojis.flatMap { emojis in
emojis.map { MastodonEmoji(emoji: $0) }
} ?? []
}
}
extension Mastodon.Entity.Account: MastodonEmojiContainer { }
extension Mastodon.Entity.Status: MastodonEmojiContainer { }
extension Mastodon.Entity.StatusEdit: MastodonEmojiContainer { }