From 786f5feab3dc5abe1b0fac3f5d2c414d0981ffe0 Mon Sep 17 00:00:00 2001 From: ensan-hcl Date: Sat, 19 Apr 2025 18:22:28 +0900 Subject: [PATCH 1/2] feat: use emoji 16.0 --- .../azooKey_emoji_dictionary_storage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/KanaKanjiConverterModuleWithDefaultDictionary/azooKey_emoji_dictionary_storage b/Sources/KanaKanjiConverterModuleWithDefaultDictionary/azooKey_emoji_dictionary_storage index 24e88dd..ec11764 160000 --- a/Sources/KanaKanjiConverterModuleWithDefaultDictionary/azooKey_emoji_dictionary_storage +++ b/Sources/KanaKanjiConverterModuleWithDefaultDictionary/azooKey_emoji_dictionary_storage @@ -1 +1 @@ -Subproject commit 24e88dd14c27e333454ba15c7cc4c2b4a4dd9d34 +Subproject commit ec11764a92fa044cd7d497b8b7d67e966c054a6f From db1d2023ca98f674c9cda3da7b8514e3ad98a3ea Mon Sep 17 00:00:00 2001 From: ensan-hcl Date: Sat, 19 Apr 2025 18:30:01 +0900 Subject: [PATCH 2/2] feat: add test and update --- ...aKanjiConverterModuleWithDefaultDictionary.swift | 12 ++++++++---- .../DicdataStoreTests/TextReplacerTests.swift | 13 ++++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Sources/KanaKanjiConverterModuleWithDefaultDictionary/KanaKanjiConverterModuleWithDefaultDictionary.swift b/Sources/KanaKanjiConverterModuleWithDefaultDictionary/KanaKanjiConverterModuleWithDefaultDictionary.swift index 7a97ce0..398ded7 100644 --- a/Sources/KanaKanjiConverterModuleWithDefaultDictionary/KanaKanjiConverterModuleWithDefaultDictionary.swift +++ b/Sources/KanaKanjiConverterModuleWithDefaultDictionary/KanaKanjiConverterModuleWithDefaultDictionary.swift @@ -58,9 +58,11 @@ public extension TextReplacer { static func withDefaultEmojiDictionary() -> Self { self.init { let directoryName = "EmojiDictionary" - #if os(iOS) || os(watchOS) || os(tvOS) || os(visionOS) +#if os(iOS) || os(watchOS) || os(tvOS) || os(visionOS) let directory = Bundle.module.bundleURL.appendingPathComponent(directoryName, isDirectory: true) - return if #available(iOS 17.4, *) { + return if #available(iOS 18.4, *) { + directory.appendingPathComponent("emoji_all_E16.0.txt", isDirectory: false) + } else if #available(iOS 17.4, *) { directory.appendingPathComponent("emoji_all_E15.1.txt", isDirectory: false) } else if #available(iOS 16.4, *) { directory.appendingPathComponent("emoji_all_E15.0.txt", isDirectory: false) @@ -71,7 +73,9 @@ public extension TextReplacer { } #elseif os(macOS) let directory = Bundle.module.resourceURL!.appendingPathComponent(directoryName, isDirectory: true) - return if #available(macOS 14.4, *) { + return if #available(macOS 15.3, *) { + directory.appendingPathComponent("emoji_all_E16.0.txt", isDirectory: false) + } else if #available(macOS 14.4, *) { directory.appendingPathComponent("emoji_all_E15.1.txt", isDirectory: false) } else { directory.appendingPathComponent("emoji_all_E15.0.txt", isDirectory: false) @@ -79,7 +83,7 @@ public extension TextReplacer { #else return Bundle.module.resourceURL! .appendingPathComponent(directoryName, isDirectory: true) - .appendingPathComponent("emoji_all_E15.1.txt", isDirectory: false) + .appendingPathComponent("emoji_all_E16.0.txt", isDirectory: false) #endif } } diff --git a/Tests/KanaKanjiConverterModuleWithDefaultDictionaryTests/DicdataStoreTests/TextReplacerTests.swift b/Tests/KanaKanjiConverterModuleWithDefaultDictionaryTests/DicdataStoreTests/TextReplacerTests.swift index f988296..4bb1603 100644 --- a/Tests/KanaKanjiConverterModuleWithDefaultDictionaryTests/DicdataStoreTests/TextReplacerTests.swift +++ b/Tests/KanaKanjiConverterModuleWithDefaultDictionaryTests/DicdataStoreTests/TextReplacerTests.swift @@ -6,8 +6,15 @@ final class TextReplacerTests: XCTestCase { func testEmojiTextReplacer() throws { let textReplacer = TextReplacer.withDefaultEmojiDictionary() XCTAssertFalse(textReplacer.isEmpty) - let searchResult = textReplacer.getSearchResult(query: "カニ", target: [.emoji]) - XCTAssertEqual(searchResult.count, 1) - XCTAssertEqual(searchResult[0], .init(query: "かに", text: "🦀️")) + do { + let searchResult = textReplacer.getSearchResult(query: "カニ", target: [.emoji]) + XCTAssertEqual(searchResult.count, 1) + XCTAssertEqual(searchResult[0], .init(query: "かに", text: "🦀️")) + } + if #available(iOS 18.4, macOS 15.3, *) { + let searchResult = textReplacer.getSearchResult(query: "テツヤ", target: [.emoji]) + XCTAssertEqual(searchResult.count, 1) + XCTAssertEqual(searchResult[0], .init(query: "てつや", text: "🫩️")) + } } }