Skip to content

Commit

Permalink
Merge pull request #411 from ensan-hcl/feature/emoji_text_replacer
Browse files Browse the repository at this point in the history
[Feature] Update AZKKC version and support new text replacer API
  • Loading branch information
ensan-hcl authored Feb 17, 2024
2 parents 178c87e + b23a64c commit 84beacc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion AzooKeyCore/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ let package = Package(
// MARK: `_: .upToNextMinor(Version)` or `exact: Version` or `revision: Version`.
// MARK: For develop branch, you can use `revision:` specification.
// MARK: For main branch, you must use `upToNextMinor` specification.
.package(url: "https://github.com/ensan-hcl/AzooKeyKanaKanjiConverter", .upToNextMinor(from: "0.4.0"))
.package(url: "https://github.com/ensan-hcl/AzooKeyKanaKanjiConverter", .upToNextMinor(from: "0.5.0"))
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
14 changes: 13 additions & 1 deletion Keyboard/Display/InputManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import KeyboardExtensionUtils
dictionaryResourceURL: Self.dictionaryResourceURL,
memoryDirectoryURL: Self.memoryDirectoryURL,
sharedContainerURL: Self.sharedContainerURL,
textReplacer: self.textReplacer,
metadata: .init(appVersionString: SharedStore.currentAppVersion?.description ?? "Unknown")
)
}
Expand Down Expand Up @@ -191,7 +192,18 @@ import KeyboardExtensionUtils
/// かな漢字変換を受け持つ変換器。
private var kanaKanjiConverter = KanaKanjiConverter()
/// 置換機
private var textReplacer = TextReplacer()
private var textReplacer = TextReplacer(emojiDataProvider: {
// 読み込むファイルはバージョンごとに変更する必要がある
if #available(iOS 17.4, *) {
Bundle.main.bundleURL.appendingPathComponent("emoji_all_E15.1.txt.gen", isDirectory: false)
} else if #available(iOS 16.4, *) {
Bundle.main.bundleURL.appendingPathComponent("emoji_all_E15.0.txt.gen", isDirectory: false)
} else if #available(iOS 15.4, *) {
Bundle.main.bundleURL.appendingPathComponent("emoji_all_E14.0.txt.gen", isDirectory: false)
} else {
Bundle.main.bundleURL.appendingPathComponent("emoji_all_E13.1.txt.gen", isDirectory: false)
}
})

func sendToDicdataStore(_ data: DicdataStore.Notification) {
self.kanaKanjiConverter.sendToDicdataStore(data)
Expand Down

0 comments on commit 84beacc

Please sign in to comment.