Send reaction method placeholder (#355)

* Send reaction method placeholder

* Removed unnecessary emoji skin parsing

* Code review fixes
This commit is contained in:
Aleksandrs Proskurins
2022-12-07 13:19:47 +02:00
committed by GitHub
parent 7db7eec98f
commit 1e197d48de
24 changed files with 88 additions and 80 deletions
@@ -20,7 +20,7 @@ struct EmojiItem: Equatable, Identifiable {
var id: String
let name: String
let keywords: [String]
let skins: [EmojiItemSkin]
let skins: [String]
}
extension EmojiItem {
@@ -28,8 +28,8 @@ extension EmojiItem {
id = emojiMart.id
name = emojiMart.name
keywords = emojiMart.keywords
skins = emojiMart.skins.compactMap { emojiMartEmojiSkin in
EmojiItemSkin(from: emojiMartEmojiSkin)
skins = emojiMart.skins.map { emojiMartEmojiSkin in
emojiMartEmojiSkin.native
}
}
}
@@ -1,36 +0,0 @@
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
struct EmojiItemSkin: Equatable {
let value: String
init?(from emojiMartEmojiSkin: EmojiMartEmojiSkin) {
let unicodeStringComponents = emojiMartEmojiSkin.unified.components(separatedBy: "-")
var emoji = ""
for unicodeStringComponent in unicodeStringComponents {
guard let unicodeCodePoint = Int(unicodeStringComponent, radix: 16),
let emojiUnicodeScalar = UnicodeScalar(unicodeCodePoint) else {
return nil
}
emoji.append(String(emojiUnicodeScalar))
}
value = emoji
}
}