Fix spelling

This commit is contained in:
Jordan Kay 2022-11-28 16:35:29 -05:00
parent 8a2e78ae43
commit 58a6608c19
5 changed files with 13 additions and 13 deletions

View file

@ -4,8 +4,8 @@ import Foundation
import Mastodon
public indirect enum PickerEmoji: Hashable {
case custom(Emoji, inFrequentlyUsed: Bool)
case system(SystemEmoji, inFrequentlyUsed: Bool)
case custom(Emoji, infrequentlyUsed: Bool)
case system(SystemEmoji, infrequentlyUsed: Bool)
}
public extension PickerEmoji {
@ -43,12 +43,12 @@ public extension PickerEmoji {
}
}
var inFrequentlyUsed: Self {
var infrequentlyUsed: Self {
switch self {
case let .custom(emoji, _):
return .custom(emoji, inFrequentlyUsed: true)
return .custom(emoji, infrequentlyUsed: true)
case let .system(emoji, _):
return .system(emoji, inFrequentlyUsed: true)
return .system(emoji, infrequentlyUsed: true)
}
}
}

View file

@ -34,9 +34,9 @@ public extension EmojiPickerService {
}
if typed[category] == nil {
typed[category] = [.custom(emoji, inFrequentlyUsed: false)]
typed[category] = [.custom(emoji, infrequentlyUsed: false)]
} else {
typed[category]?.append(.custom(emoji, inFrequentlyUsed: false))
typed[category]?.append(.custom(emoji, infrequentlyUsed: false))
}
}
@ -73,7 +73,7 @@ public extension EmojiPickerService {
.map {
PickerEmoji.system(
$0.withMaxVersionForSkinToneVariations(Self.maxEmojiVersion),
inFrequentlyUsed: false)
infrequentlyUsed: false)
}
}

View file

@ -168,14 +168,14 @@ final class EmojiPickerViewController: UICollectionViewController {
contextMenuConfigurationForItemAt indexPath: IndexPath,
point: CGPoint) -> UIContextMenuConfiguration? {
guard let item = dataSource.itemIdentifier(for: indexPath),
case let .system(emoji, inFrequentlyUsed) = item,
case let .system(emoji, infrequentlyUsed) = item,
!emoji.skinToneVariations.isEmpty
else { return nil }
return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { _ in
UIMenu(children: ([emoji] + emoji.skinToneVariations).map { skinToneVariation in
UIAction(title: skinToneVariation.emoji) { [weak self] _ in
self?.select(emoji: .system(skinToneVariation, inFrequentlyUsed: inFrequentlyUsed))
self?.select(emoji: .system(skinToneVariation, infrequentlyUsed: infrequentlyUsed))
self?.viewModel.updateUse(emoji: item)
}
})

View file

@ -4,9 +4,9 @@ import Foundation
public extension PickerEmoji {
func applyingDefaultSkinTone(identityContext: IdentityContext) -> PickerEmoji {
if case let .system(systemEmoji, inFrequentlyUsed) = self,
if case let .system(systemEmoji, infrequentlyUsed) = self,
let defaultEmojiSkinTone = identityContext.appPreferences.defaultEmojiSkinTone {
return .system(systemEmoji.applying(skinTone: defaultEmojiSkinTone), inFrequentlyUsed: inFrequentlyUsed)
return .system(systemEmoji.applying(skinTone: defaultEmojiSkinTone), infrequentlyUsed: infrequentlyUsed)
} else {
return self
}

View file

@ -75,7 +75,7 @@ final public class EmojiPickerViewModel: ObservableObject {
emojis[.frequentlyUsed] = emojiUses.compactMap { use in
emojis.values.reduce([], +)
.first { use.system == $0.system && use.emoji == $0.name }
.map(\.inFrequentlyUsed)
.map(\.infrequentlyUsed)
}
}