diff --git a/AzooKeyCore/.swiftpm/xcode/xcshareddata/xcschemes/KeyboardExtensionUtils.xcscheme b/AzooKeyCore/.swiftpm/xcode/xcshareddata/xcschemes/KeyboardExtensionUtils.xcscheme new file mode 100644 index 00000000..c641d812 --- /dev/null +++ b/AzooKeyCore/.swiftpm/xcode/xcshareddata/xcschemes/KeyboardExtensionUtils.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AzooKeyCore/Package.swift b/AzooKeyCore/Package.swift index 82e1ea65..0ae8831f 100644 --- a/AzooKeyCore/Package.swift +++ b/AzooKeyCore/Package.swift @@ -16,7 +16,7 @@ let swiftSettings: [SwiftSetting] = [ ] let package = Package( name: "AzooKeyCore", - platforms: [.iOS(.v15), .macOS(.v12)], + platforms: [.iOS(.v16), .macOS(.v13)], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( @@ -34,6 +34,10 @@ let package = Package( .library( name: "AzooKeyUtils", targets: ["AzooKeyUtils"] + ), + .library( + name: "KeyboardExtensionUtils", + targets: ["KeyboardExtensionUtils"] ) ], dependencies: [ @@ -67,6 +71,7 @@ let package = Package( name: "KeyboardViews", dependencies: [ "KeyboardThemes", + "KeyboardExtensionUtils", .product(name: "KanaKanjiConverterModule", package: "AzooKeyKanaKanjiConverter") ], resources: [], @@ -80,6 +85,20 @@ let package = Package( ], resources: [], swiftSettings: swiftSettings + ), + .target( + name: "KeyboardExtensionUtils", + dependencies: [ + .product(name: "KanaKanjiConverterModule", package: "AzooKeyKanaKanjiConverter") + ], + resources: [], + swiftSettings: swiftSettings + ), + .testTarget( + name: "KeyboardExtensionUtilsTests", + dependencies: [ + "KeyboardExtensionUtils" + ] ) ] ) diff --git a/AzooKeyCore/Sources/AzooKeyUtils/AzooKeyMessage.swift b/AzooKeyCore/Sources/AzooKeyUtils/AzooKeyMessage.swift index 579fbeeb..b0ff1876 100644 --- a/AzooKeyCore/Sources/AzooKeyUtils/AzooKeyMessage.swift +++ b/AzooKeyCore/Sources/AzooKeyUtils/AzooKeyMessage.swift @@ -11,7 +11,6 @@ import KeyboardViews public enum MessageIdentifier: String, CaseIterable, MessageIdentifierProtocol { case mock = "mock_alert_2022_09_16_03" - case iOS15_4_new_emoji = "iOS_15_4_new_emoji" // MARK: frozen case iOS16_4_new_emoji = "iOS_16_4_new_emoji_commit" // MARK: frozen case ver1_9_user_dictionary_update = "ver1_9_user_dictionary_update_release" // MARK: frozen case ver2_1_emoji_tab = "ver2_1_emoji_tab" @@ -19,8 +18,9 @@ public enum MessageIdentifier: String, CaseIterable, MessageIdentifierProtocol { // MARK: 過去にプロダクションで用いていたメッセージID // ver1_9_user_dictionary_updateが実行されれば不要になるので、この宣言は削除 // case ver1_5_update_loudstxt = "ver1_5_update_loudstxt" // MARK: frozen - // iOS15_4_new_emojiが実行されれば不要になるので、この宣言は削除 + // iOS16_4_new_emojiが実行されれば不要になるので、これらの宣言は削除 // case iOS14_5_new_emoji = "iOS_14_5_new_emoji_fixed_ver_1_6_1" // MARK: frozen + // case iOS15_4_new_emoji = "iOS_15_4_new_emoji" // MARK: frozen // 新機能の紹介も削除 // case liveconversion_introduction = "liveconversion_introduction" // MARK: frozen // case ver1_8_autocomplete_introduction = "ver1_8_autocomplete_introduction" // MARK: frozen @@ -33,7 +33,7 @@ public enum MessageIdentifier: String, CaseIterable, MessageIdentifierProtocol { switch self { case .ver1_9_user_dictionary_update, .ver2_1_emoji_tab: return true - case .iOS15_4_new_emoji, .iOS16_4_new_emoji, .mock: + case .iOS16_4_new_emoji, .mock: return false } } @@ -50,31 +50,6 @@ public enum AzooKeyMessageProvider: ApplicationSpecificKeyboardViewMessageProvid public static var messages: [MessageData] { [ - MessageData( - id: .iOS15_4_new_emoji, - title: "お知らせ", - description: "iOS15.4で新しい絵文字が追加されました。本体アプリを開き、データを更新しますか?", - button: .two(primary: .openContainer(text: "更新"), secondary: .later), - precondition: { - if #available(iOS 15.4, *) { - return true - } else { - return false - } - }, - silentDoneCondition: { - // ダウンロードがv1.8以降の場合はDone - if (SharedStore.initialAppVersion ?? .azooKey_v1_7_1) >= .azooKey_v1_8 { - return true - } - // .iOS16_4の方が終わっていたらDone - if MessageManager.checkDone(.iOS16_4_new_emoji, userDefaults: userDefaults) { - return true - } - return false - }, - containerAppShouldMakeItDone: { false } - ), MessageData( id: .iOS16_4_new_emoji, title: "お知らせ", diff --git a/AzooKeyCore/Sources/KeyboardViews/AnyTextDocumentProxy.swift b/AzooKeyCore/Sources/KeyboardExtensionUtils/AnyTextDocumentProxy.swift similarity index 100% rename from AzooKeyCore/Sources/KeyboardViews/AnyTextDocumentProxy.swift rename to AzooKeyCore/Sources/KeyboardExtensionUtils/AnyTextDocumentProxy.swift diff --git a/Keyboard/Display/DisplayedTextManager.swift b/AzooKeyCore/Sources/KeyboardExtensionUtils/DisplayedTextManager.swift similarity index 85% rename from Keyboard/Display/DisplayedTextManager.swift rename to AzooKeyCore/Sources/KeyboardExtensionUtils/DisplayedTextManager.swift index 229357fc..4f33d25a 100644 --- a/Keyboard/Display/DisplayedTextManager.swift +++ b/AzooKeyCore/Sources/KeyboardExtensionUtils/DisplayedTextManager.swift @@ -6,32 +6,27 @@ // Copyright © 2022 ensan. All rights reserved. // -import AzooKeyUtils import KanaKanjiConverterModule -import KeyboardViews import SwiftUtils import UIKit /// UI側の入力中のテキストの更新を受け持つクラス -@MainActor final class DisplayedTextManager { - init() { - @KeyboardSetting(.liveConversion) var enabled - self.isLiveConversionEnabled = enabled - - @KeyboardSetting(.markedTextSetting) var markedTextEnabled - self.isMarkedTextEnabled = markedTextEnabled != .disabled +@MainActor final public class DisplayedTextManager { + public init(isLiveConversionEnabled: Bool, isMarkedTextEnabled: Bool) { + self.isLiveConversionEnabled = isLiveConversionEnabled + self.isMarkedTextEnabled = isMarkedTextEnabled } /// `convertTarget`に対応する文字列 - private(set) var composingText: ComposingText = .init() + private(set) public var composingText: ComposingText = .init() /// ライブ変換の有効化状態 - private(set) var isLiveConversionEnabled: Bool + private(set) public var isLiveConversionEnabled: Bool /// ライブ変換結果として表示されるべきテキスト - private(set) var displayedLiveConversionText: String? + private(set) public var displayedLiveConversionText: String? /// テキストを変更するたびに増やす値 private var textChangedCount = 0 /// `textChangedCount`のgetter。 - func getTextChangedCount() -> Int { + public func getTextChangedCount() -> Int { self.textChangedCount } @@ -50,7 +45,7 @@ import UIKit /// キーボード内テキストフィールドの`UITextDocumentProxy` private var ikTextFieldProxy: (id: UUID, proxy: (any UITextDocumentProxy))? - func setTextDocumentProxy(_ proxy: AnyTextDocumentProxy) { + public func setTextDocumentProxy(_ proxy: AnyTextDocumentProxy) { switch proxy { case let .mainProxy(proxy): self.displayedTextProxy = proxy @@ -66,28 +61,29 @@ import UIKit } } - var documentContextAfterInput: String? { + public var documentContextAfterInput: String? { self.proxy?.documentContextAfterInput } - var selectedText: String? { + public var selectedText: String? { self.proxy?.selectedText } - var documentContextBeforeInput: String? { + public var documentContextBeforeInput: String? { self.proxy?.documentContextBeforeInput } - var shouldSkipMarkedTextChange: Bool { + public var shouldSkipMarkedTextChange: Bool { self.isMarkedTextEnabled && preferredTextProxy == .ikTextField && ikTextFieldProxy != nil } - func closeKeyboard() { + public func closeKeyboard() { self.ikTextFieldProxy = nil } /// 入力を停止する - @MainActor func stopComposition() { + /// - note: この関数を呼んだ後に`updateSettings`を呼ぶと良い + @MainActor public func stopComposition() { debug("DisplayedTextManager.stopComposition") if self.isMarkedTextEnabled { self.proxy?.unmarkText() @@ -96,15 +92,12 @@ import UIKit } self.composingText = .init() self.displayedLiveConversionText = nil - self.reloadSetting() } /// 設定を更新する - @MainActor private func reloadSetting() { - @KeyboardSetting(.liveConversion) var enabled - self.isLiveConversionEnabled = enabled - @KeyboardSetting(.markedTextSetting) var markedTextEnabled - self.isMarkedTextEnabled = markedTextEnabled != .disabled + @MainActor public func updateSettings(isLiveConversionEnabled: Bool, isMarkedTextEnabled: Bool) { + self.isLiveConversionEnabled = isLiveConversionEnabled + self.isMarkedTextEnabled = isMarkedTextEnabled } /// カーソルを何カウント分動かせばいいか計算する @@ -140,7 +133,7 @@ import UIKit self.proxy?.setMarkedText(text, selectedRange: NSRange(location: cursorPosition, length: 0)) } - func insertText(_ text: String) { + public func insertText(_ text: String) { guard !text.isEmpty else { return } @@ -149,7 +142,7 @@ import UIKit } /// In-Keyboard TextFiledが用いられていても、そちらではない方に強制的に入力を行う関数 - func insertMainDisplayText(_ text: String) { + public func insertMainDisplayText(_ text: String) { guard !text.isEmpty else { return } @@ -157,7 +150,7 @@ import UIKit self.textChangedCount += 1 } - func moveCursor(count: Int) { + public func moveCursor(count: Int) { guard count != 0 else { return } @@ -179,7 +172,7 @@ import UIKit // isComposingの場合、countはadjust済みであることを期待する // されていなかった場合は例外を投げる - func deleteBackward(count: Int) { + public func deleteBackward(count: Int) { if count == 0 { return } @@ -212,7 +205,7 @@ import UIKit // isComposingの場合、countはadjust済みであることを期待する // されていなかった場合は例外を投げる - func deleteForward(count: Int = 1) { + public func deleteForward(count: Int = 1) { if count == 0 { return } @@ -224,7 +217,7 @@ import UIKit } /// `composingText`を更新する - func updateComposingText(composingText: ComposingText, newLiveConversionText: String?) { + public func updateComposingText(composingText: ComposingText, newLiveConversionText: String?) { if isMarkedTextEnabled { self.composingText = composingText self.displayedLiveConversionText = newLiveConversionText @@ -251,7 +244,7 @@ import UIKit } } - func updateComposingText(composingText: ComposingText, userMovedCount: Int, adjustedMovedCount: Int) -> Bool { + public func updateComposingText(composingText: ComposingText, userMovedCount: Int, adjustedMovedCount: Int) -> Bool { let delta = adjustedMovedCount - userMovedCount self.composingText = composingText if delta != 0 { @@ -262,7 +255,7 @@ import UIKit return false } - func updateComposingText(composingText: ComposingText, completedPrefix: String, isSelected: Bool) { + public func updateComposingText(composingText: ComposingText, completedPrefix: String, isSelected: Bool) { if isMarkedTextEnabled { self.insertText(completedPrefix) self.composingText = composingText diff --git a/AzooKeyCore/Sources/KeyboardViews/UserActionManager.swift b/AzooKeyCore/Sources/KeyboardViews/UserActionManager.swift index 9dfc59fc..6d617530 100644 --- a/AzooKeyCore/Sources/KeyboardViews/UserActionManager.swift +++ b/AzooKeyCore/Sources/KeyboardViews/UserActionManager.swift @@ -8,6 +8,7 @@ import Foundation import SwiftUI +import KeyboardExtensionUtils /// キーボードの操作を管理するためのクラス /// - finalにはできない diff --git a/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/CustomKeyboard.swift b/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/CustomKeyboard.swift index df65eead..f8a1aa3f 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/CustomKeyboard.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/CustomKeyboard.swift @@ -60,7 +60,7 @@ fileprivate extension CustardInterface { } } - @MainActor func flickKeyModels(extension _: Extension.Type) -> [KeyPosition: (model: any FlickKeyModelProtocol, width: Int, height: Int)] { + @MainActor func flickKeyModels(extension _: Extension.Type) -> [KeyPosition: (model: any FlickKeyModelProtocol, width: Int, height: Int)] { self.keys.reduce(into: [:]) {dictionary, value in switch value.key { case let .gridFit(data): @@ -71,7 +71,7 @@ fileprivate extension CustardInterface { } } - @MainActor func qwertyKeyModels(extension _: Extension.Type) -> [KeyPosition: (model: any QwertyKeyModelProtocol, sizeType: QwertyKeySizeType)] { + @MainActor func qwertyKeyModels(extension _: Extension.Type) -> [KeyPosition: (model: any QwertyKeyModelProtocol, sizeType: QwertyKeySizeType)] { self.keys.reduce(into: [:]) {dictionary, value in switch value.key { case let .gridFit(data): @@ -126,28 +126,28 @@ fileprivate extension CustardKeyDesign.ColorType { } extension CustardInterfaceKey { - @MainActor public func flickKeyModel(extension _: Extension.Type) -> any FlickKeyModelProtocol { + @MainActor public func flickKeyModel(extension _: Extension.Type) -> any FlickKeyModelProtocol { switch self { case let .system(value): switch value { case .changeKeyboard: - return FlickChangeKeyboardModel.shared + return FlickChangeKeyboardModel.shared case .enter: - return FlickEnterKeyModel() + return FlickEnterKeyModel() case .upperLower: - return FlickAaKeyModel() + return FlickAaKeyModel() case .nextCandidate: - return FlickNextCandidateKeyModel.shared + return FlickNextCandidateKeyModel.shared case .flickKogaki: - return FlickKogakiKeyModel.shared + return FlickKogakiKeyModel.shared case .flickKutoten: - return FlickKanaSymbolsKeyModel.shared + return FlickKanaSymbolsKeyModel.shared case .flickHiraTab: - return FlickTabKeyModel.hiraTabKeyModel() + return FlickTabKeyModel.hiraTabKeyModel() case .flickAbcTab: - return FlickTabKeyModel.abcTabKeyModel() + return FlickTabKeyModel.abcTabKeyModel() case .flickStar123Tab: - return FlickTabKeyModel.numberTabKeyModel() + return FlickTabKeyModel.numberTabKeyModel() } case let .custom(value): let flickKeyModels: [FlickDirection: FlickedKeyModel] = value.variations.reduce(into: [:]) {dictionary, variation in @@ -162,7 +162,7 @@ extension CustardInterfaceKey { break } } - let model = FlickKeyModel( + return FlickKeyModel( labelType: value.design.label.keyLabelType, pressActions: value.press_actions.map {$0.actionType}, longPressActions: value.longpress_actions.longpressActionType, @@ -170,16 +170,15 @@ extension CustardInterfaceKey { needSuggestView: value.longpress_actions == .none && !value.variations.isEmpty, keycolorType: value.design.color.flickKeyColorType ) - return model } } - private func convertToQwertyKeyModel(customKey: KeyFlickSetting.SettingData, extension _: Extension.Type) -> any QwertyKeyModelProtocol { + private func convertToQwertyKeyModel(customKey: KeyFlickSetting.SettingData, extension _: Extension.Type) -> any QwertyKeyModelProtocol { let variations = VariationsModel([customKey.flick[.left], customKey.flick[.top], customKey.flick[.right], customKey.flick[.bottom]].compactMap {$0}.map {(label: $0.labelType, actions: $0.pressActions)}) - return QwertyKeyModel(labelType: customKey.labelType, pressActions: customKey.actions, longPressActions: customKey.longpressActions, variationsModel: variations, keyColorType: .normal, needSuggestView: false, for: (1, 1)) + return QwertyKeyModel(labelType: customKey.labelType, pressActions: customKey.actions, longPressActions: customKey.longpressActions, variationsModel: variations, keyColorType: .normal, needSuggestView: false, for: (1, 1)) } - @MainActor func qwertyKeyModel(layout: CustardInterfaceLayout, extension: Extension.Type) -> any QwertyKeyModelProtocol { + @MainActor func qwertyKeyModel(layout: CustardInterfaceLayout, extension: Extension.Type) -> any QwertyKeyModelProtocol { switch self { case let .system(value): switch value { @@ -192,11 +191,11 @@ extension CustardInterfaceKey { } return changeKeyboardKey case .enter: - return QwertyEnterKeyModel(keySizeType: .enter) + return QwertyEnterKeyModel(keySizeType: .enter) case .upperLower: - return QwertyAaKeyModel() + return QwertyAaKeyModel() case .nextCandidate: - return QwertyNextCandidateKeyModel() + return QwertyNextCandidateKeyModel() case .flickKogaki: return convertToQwertyKeyModel(customKey: Extension.SettingProvider.koganaFlickCustomKey.compiled(), extension: Extension.self) case .flickKutoten: @@ -218,7 +217,7 @@ extension CustardInterfaceKey { } } - let model = QwertyKeyModel( + return QwertyKeyModel( labelType: value.design.label.keyLabelType, pressActions: value.press_actions.map {$0.actionType}, longPressActions: value.longpress_actions.longpressActionType, @@ -227,35 +226,34 @@ extension CustardInterfaceKey { needSuggestView: value.longpress_actions == .none, for: (1, 1) ) - return model } } - func simpleKeyModel(extension _: Extension.Type) -> any SimpleKeyModelProtocol { + func simpleKeyModel(extension _: Extension.Type) -> any SimpleKeyModelProtocol { switch self { case let .system(value): switch value { case .changeKeyboard: - return SimpleChangeKeyboardKeyModel() + return SimpleChangeKeyboardKeyModel() case .enter: - return SimpleEnterKeyModel() + return SimpleEnterKeyModel() case .upperLower: - return SimpleKeyModel(keyLabelType: .text("a/A"), unpressedKeyColorType: .special, pressActions: [.changeCharacterType]) + return SimpleKeyModel(keyLabelType: .text("a/A"), unpressedKeyColorType: .special, pressActions: [.changeCharacterType]) case .nextCandidate: - return SimpleNextCandidateKeyModel() + return SimpleNextCandidateKeyModel() case .flickKogaki: - return SimpleKeyModel(keyLabelType: .text("小゙゚"), unpressedKeyColorType: .special, pressActions: [.changeCharacterType]) + return SimpleKeyModel(keyLabelType: .text("小゙゚"), unpressedKeyColorType: .special, pressActions: [.changeCharacterType]) case .flickKutoten: - return SimpleKeyModel(keyLabelType: .text("、"), unpressedKeyColorType: .normal, pressActions: [.input("、")]) + return SimpleKeyModel(keyLabelType: .text("、"), unpressedKeyColorType: .normal, pressActions: [.input("、")]) case .flickHiraTab: - return SimpleKeyModel(keyLabelType: .text("あいう"), unpressedKeyColorType: .special, pressActions: [.moveTab(.system(.user_japanese))]) + return SimpleKeyModel(keyLabelType: .text("あいう"), unpressedKeyColorType: .special, pressActions: [.moveTab(.system(.user_japanese))]) case .flickAbcTab: - return SimpleKeyModel(keyLabelType: .text("abc"), unpressedKeyColorType: .special, pressActions: [.moveTab(.system(.user_english))]) + return SimpleKeyModel(keyLabelType: .text("abc"), unpressedKeyColorType: .special, pressActions: [.moveTab(.system(.user_english))]) case .flickStar123Tab: - return SimpleKeyModel(keyLabelType: .text("☆123"), unpressedKeyColorType: .special, pressActions: [.moveTab(.system(.flick_numbersymbols))]) + return SimpleKeyModel(keyLabelType: .text("☆123"), unpressedKeyColorType: .special, pressActions: [.moveTab(.system(.flick_numbersymbols))]) } case let .custom(value): - return SimpleKeyModel( + return SimpleKeyModel( keyLabelType: value.design.label.keyLabelType, unpressedKeyColorType: value.design.color.simpleKeyColorType, pressActions: value.press_actions.map {$0.actionType}, @@ -337,7 +335,7 @@ struct CustomKeyboardView: public struct CustardFlickKeysView: View { @State private var suggestState = FlickSuggestState() - public init(models: [KeyPosition: (model: any FlickKeyModelProtocol, width: Int, height: Int)], tabDesign: TabDependentDesign, layout: CustardInterfaceLayoutGridValue, blur: Bool = false, @ViewBuilder generator: @escaping (FlickKeyView, Int, Int) -> (Content)) { + public init(models: [KeyPosition: (model: any FlickKeyModelProtocol, width: Int, height: Int)], tabDesign: TabDependentDesign, layout: CustardInterfaceLayoutGridValue, blur: Bool = false, @ViewBuilder generator: @escaping (FlickKeyView, Int, Int) -> (Content)) { self.models = models self.tabDesign = tabDesign self.layout = layout @@ -346,7 +344,7 @@ public struct CustardFlickKeysView, Int, Int) -> (Content) - private let models: [KeyPosition: (model: any FlickKeyModelProtocol, width: Int, height: Int)] + private let models: [KeyPosition: (model: any FlickKeyModelProtocol, width: Int, height: Int)] private let tabDesign: TabDependentDesign private let layout: CustardInterfaceLayoutGridValue private let blur: Bool diff --git a/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/SimpleKeyView/SimpleKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/SimpleKeyView/SimpleKeyModel.swift index 0b748c7c..bb54246e 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/SimpleKeyView/SimpleKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/SimpleKeyView/SimpleKeyModel.swift @@ -47,14 +47,14 @@ enum SimpleUnpressedKeyColorType: UInt8 { } } -protocol SimpleKeyModelProtocol { +protocol SimpleKeyModelProtocol { associatedtype Extension: ApplicationSpecificKeyboardViewExtension var unpressedKeyColorType: SimpleUnpressedKeyColorType {get} @MainActor func pressActions(variableStates: VariableStates) -> [ActionType] @MainActor func longPressActions(variableStates: VariableStates) -> LongpressActionType @MainActor func feedback(variableStates: VariableStates) - @MainActor func label(width: CGFloat, states: VariableStates, theme: Extension.Theme) -> KeyLabel + @MainActor func label(width: CGFloat, states: VariableStates) -> KeyLabel @MainActor func backGroundColorWhenPressed(theme: Extension.Theme) -> Color /// `pressActions`とは別に、押された際に発火する操作 /// - note: タブ固有の事情で実行しなければならないような処理に利用すること @@ -82,7 +82,7 @@ struct SimpleKeyModel: Simp private let pressActions: [ActionType] let longPressActions: LongpressActionType - func label(width: CGFloat, states: VariableStates, theme: ThemeData) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { KeyLabel(self.keyLabelType, width: width) } @@ -115,7 +115,7 @@ struct SimpleEnterKeyModel: } let unpressedKeyColorType: SimpleUnpressedKeyColorType = .enter - func label(width: CGFloat, states: VariableStates, theme: ThemeData) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { let text = Design.language.getEnterKeyText(states.enterKeyState) return KeyLabel(.text(text), width: width) } @@ -148,7 +148,7 @@ struct SimpleNextCandidateKeyModel(width: CGFloat, states: VariableStates, theme: ThemeData) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { if states.resultModel.results.isEmpty { KeyLabel(.text("空白"), width: width) } else { @@ -181,7 +181,7 @@ struct SimpleChangeKeyboardKeyModel(width: CGFloat, states: VariableStates, theme: ThemeData) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { if SemiStaticStates.shared.needsInputModeSwitchKey { return KeyLabel(.changeKeyboard, width: width) } else { diff --git a/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/SimpleKeyView/SimpleKeyView.swift b/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/SimpleKeyView/SimpleKeyView.swift index e8257b63..e134506e 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/SimpleKeyView/SimpleKeyView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/CustomKeybaord/SimpleKeyView/SimpleKeyView.swift @@ -12,7 +12,7 @@ import SwiftUIUtils @MainActor struct SimpleKeyView: View { - private let model: any SimpleKeyModelProtocol + private let model: any SimpleKeyModelProtocol @EnvironmentObject private var variableStates: VariableStates @Environment(Extension.Theme.self) private var theme @Environment(\.userActionManager) private var action @@ -20,13 +20,13 @@ struct SimpleKeyView: View private let keyViewWidth: CGFloat private let keyViewHeight: CGFloat - init(model: any SimpleKeyModelProtocol, tabDesign: TabDependentDesign) { + init(model: any SimpleKeyModelProtocol, tabDesign: TabDependentDesign) { self.model = model self.keyViewWidth = tabDesign.keyViewWidth self.keyViewHeight = tabDesign.keyViewHeight } - init(model: any SimpleKeyModelProtocol, width: CGFloat, height: CGFloat) { + init(model: any SimpleKeyModelProtocol, width: CGFloat, height: CGFloat) { self.model = model self.keyViewWidth = width self.keyViewHeight = height @@ -36,7 +36,7 @@ struct SimpleKeyView: View @State private var pressStartDate = Date() private func label(width: CGFloat) -> some View { - model.label(width: keyViewWidth, states: variableStates, theme: theme) as KeyLabel + model.label(width: keyViewWidth, states: variableStates) } var body: some View { diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/FlickDataProvider.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/FlickDataProvider.swift index 47470403..aac7944d 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/FlickDataProvider.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/FlickDataProvider.swift @@ -16,68 +16,68 @@ struct FlickDataProvider { } // 第5列 - @MainActor static func functionalKeys() -> [any FlickKeyModelProtocol] { + @MainActor static func functionalKeys() -> [any FlickKeyModelProtocol] { return [ - FlickKeyModel.delete, - Extension.SettingProvider.useNextCandidateKey ? FlickNextCandidateKeyModel.shared : FlickSpaceKeyModel.shared, - FlickEnterKeyModel.shared + FlickKeyModel.delete, + Extension.SettingProvider.useNextCandidateKey ? FlickNextCandidateKeyModel.shared : FlickSpaceKeyModel.shared, + FlickEnterKeyModel.shared ] } // 第1列 - @MainActor static func TabKeys() -> [any FlickKeyModelProtocol] { - let first: any FlickKeyModelProtocol = { + @MainActor static func TabKeys() -> [any FlickKeyModelProtocol] { + let first: any FlickKeyModelProtocol = { switch preferredLanguage.first { - case .el_GR: return FlickChangeKeyboardModel.shared - case .en_US: return FlickTabKeyModel.abcTabKeyModel() - case .ja_JP: return FlickTabKeyModel.hiraTabKeyModel() - case .none: return FlickChangeKeyboardModel.shared + case .el_GR: return FlickChangeKeyboardModel.shared + case .en_US: return FlickTabKeyModel.abcTabKeyModel() + case .ja_JP: return FlickTabKeyModel.hiraTabKeyModel() + case .none: return FlickChangeKeyboardModel.shared } }() - let second: (any FlickKeyModelProtocol)? = { + let second: (any FlickKeyModelProtocol)? = { guard let second = preferredLanguage.second else { return nil } switch second { case .none: return nil - case .el_GR: return FlickChangeKeyboardModel.shared - case .en_US: return FlickTabKeyModel.abcTabKeyModel() - case .ja_JP: return FlickTabKeyModel.hiraTabKeyModel() + case .el_GR: return FlickChangeKeyboardModel.shared + case .en_US: return FlickTabKeyModel.abcTabKeyModel() + case .ja_JP: return FlickTabKeyModel.hiraTabKeyModel() } }() if let second { return [ - FlickTabKeyModel.numberTabKeyModel(), + FlickTabKeyModel.numberTabKeyModel(), second, first, - FlickChangeKeyboardModel.shared + FlickChangeKeyboardModel.shared ] } else { return [ - FlickKeyModel( + FlickKeyModel( labelType: .image("list.bullet"), pressActions: [.setTabBar(.toggle)], longPressActions: .init(start: [.setTabBar(.toggle)]), flickKeys: [:], needSuggestView: false, keycolorType: .tabkey ), - FlickTabKeyModel.numberTabKeyModel(), + FlickTabKeyModel.numberTabKeyModel(), first, - FlickChangeKeyboardModel.shared + FlickChangeKeyboardModel.shared ] } } // 縦に並べる @MainActor - static var hiraKeyboard: [[any FlickKeyModelProtocol]] { + static var hiraKeyboard: [[any FlickKeyModelProtocol]] { [ // 第1列 Self.TabKeys(), // 第2列 [ - FlickKeyModel(labelType: .text("あ"), pressActions: [.input("あ")], flickKeys: [ + FlickKeyModel(labelType: .text("あ"), pressActions: [.input("あ")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("い"), pressActions: [.input("い")] @@ -96,7 +96,7 @@ struct FlickDataProvider { ) ]), - FlickKeyModel(labelType: .text("た"), pressActions: [.input("た")], flickKeys: [ + FlickKeyModel(labelType: .text("た"), pressActions: [.input("た")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("ち"), pressActions: [.input("ち")] @@ -114,7 +114,7 @@ struct FlickDataProvider { pressActions: [.input("と")] ) ]), - FlickKeyModel(labelType: .text("ま"), pressActions: [.input("ま")], flickKeys: [ + FlickKeyModel(labelType: .text("ま"), pressActions: [.input("ま")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("み"), pressActions: [.input("み")] @@ -133,11 +133,11 @@ struct FlickDataProvider { ) ]), - FlickKogakiKeyModel.shared + FlickKogakiKeyModel.shared ], // 第3列 [ - FlickKeyModel(labelType: .text("か"), pressActions: [.input("か")], flickKeys: [ + FlickKeyModel(labelType: .text("か"), pressActions: [.input("か")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("き"), pressActions: [.input("き")] @@ -156,7 +156,7 @@ struct FlickDataProvider { ) ]), - FlickKeyModel(labelType: .text("な"), pressActions: [.input("な")], flickKeys: [ + FlickKeyModel(labelType: .text("な"), pressActions: [.input("な")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("に"), pressActions: [.input("に")] @@ -175,7 +175,7 @@ struct FlickDataProvider { ) ]), - FlickKeyModel(labelType: .text("や"), pressActions: [.input("や")], flickKeys: [ + FlickKeyModel(labelType: .text("や"), pressActions: [.input("や")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("「"), pressActions: [.input("「")] @@ -194,7 +194,7 @@ struct FlickDataProvider { ) ]), - FlickKeyModel(labelType: .text("わ"), pressActions: [.input("わ")], flickKeys: [ + FlickKeyModel(labelType: .text("わ"), pressActions: [.input("わ")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("を"), pressActions: [.input("を")] @@ -212,7 +212,7 @@ struct FlickDataProvider { ], // 第4列 [ - FlickKeyModel(labelType: .text("さ"), pressActions: [.input("さ")], flickKeys: [ + FlickKeyModel(labelType: .text("さ"), pressActions: [.input("さ")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("し"), pressActions: [.input("し")] @@ -231,7 +231,7 @@ struct FlickDataProvider { ) ]), - FlickKeyModel(labelType: .text("は"), pressActions: [.input("は")], flickKeys: [ + FlickKeyModel(labelType: .text("は"), pressActions: [.input("は")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("ひ"), pressActions: [.input("ひ")] @@ -250,7 +250,7 @@ struct FlickDataProvider { ) ]), - FlickKeyModel(labelType: .text("ら"), pressActions: [.input("ら")], flickKeys: [ + FlickKeyModel(labelType: .text("ら"), pressActions: [.input("ら")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("り"), pressActions: [.input("り")] @@ -269,7 +269,7 @@ struct FlickDataProvider { ) ]), - FlickKanaSymbolsKeyModel.shared + FlickKanaSymbolsKeyModel.shared ], // 第5列 Self.functionalKeys() @@ -278,13 +278,13 @@ struct FlickDataProvider { // 縦に並べる @MainActor - static var abcKeyboard: [[any FlickKeyModelProtocol]] { + static var abcKeyboard: [[any FlickKeyModelProtocol]] { [ // 第1列 Self.TabKeys(), // 第2列 [ - FlickKeyModel(labelType: .text("@#/&_"), pressActions: [.input("@")], flickKeys: [ + FlickKeyModel(labelType: .text("@#/&_"), pressActions: [.input("@")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("#"), pressActions: [.input("#")] @@ -302,7 +302,7 @@ struct FlickDataProvider { pressActions: [.input("_")] ) ]), - FlickKeyModel(labelType: .text("GHI"), pressActions: [.input("g")], flickKeys: [ + FlickKeyModel(labelType: .text("GHI"), pressActions: [.input("g")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("H"), pressActions: [.input("h")] @@ -312,7 +312,7 @@ struct FlickDataProvider { pressActions: [.input("i")] ) ]), - FlickKeyModel(labelType: .text("PQRS"), pressActions: [.input("p")], flickKeys: [ + FlickKeyModel(labelType: .text("PQRS"), pressActions: [.input("p")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("Q"), pressActions: [.input("q")] @@ -326,12 +326,12 @@ struct FlickDataProvider { pressActions: [.input("s")] ) ]), - FlickAaKeyModel.shared + FlickAaKeyModel.shared ], // 第3列 [ - FlickKeyModel(labelType: .text("ABC"), pressActions: [.input("a")], flickKeys: [ + FlickKeyModel(labelType: .text("ABC"), pressActions: [.input("a")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("B"), pressActions: [.input("b")] @@ -341,7 +341,7 @@ struct FlickDataProvider { pressActions: [.input("c")] ) ]), - FlickKeyModel(labelType: .text("JKL"), pressActions: [.input("j")], flickKeys: [ + FlickKeyModel(labelType: .text("JKL"), pressActions: [.input("j")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("K"), pressActions: [.input("k")] @@ -351,7 +351,7 @@ struct FlickDataProvider { pressActions: [.input("l")] ) ]), - FlickKeyModel(labelType: .text("TUV"), pressActions: [.input("t")], flickKeys: [ + FlickKeyModel(labelType: .text("TUV"), pressActions: [.input("t")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("U"), pressActions: [.input("u")] @@ -361,7 +361,7 @@ struct FlickDataProvider { pressActions: [.input("v")] ) ]), - FlickKeyModel(labelType: .text("\'\"()"), pressActions: [.input("\'")], flickKeys: [ + FlickKeyModel(labelType: .text("\'\"()"), pressActions: [.input("\'")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("\""), pressActions: [.input("\"")] @@ -379,7 +379,7 @@ struct FlickDataProvider { ], // 第4列 [ - FlickKeyModel(labelType: .text("DEF"), pressActions: [.input("d")], flickKeys: [ + FlickKeyModel(labelType: .text("DEF"), pressActions: [.input("d")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("E"), pressActions: [.input("e")] @@ -390,7 +390,7 @@ struct FlickDataProvider { ) ]), - FlickKeyModel(labelType: .text("MNO"), pressActions: [.input("m")], flickKeys: [ + FlickKeyModel(labelType: .text("MNO"), pressActions: [.input("m")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("N"), pressActions: [.input("n")] @@ -401,7 +401,7 @@ struct FlickDataProvider { ) ]), - FlickKeyModel(labelType: .text("WXYZ"), pressActions: [.input("w")], flickKeys: [ + FlickKeyModel(labelType: .text("WXYZ"), pressActions: [.input("w")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("X"), pressActions: [.input("x")] @@ -415,7 +415,7 @@ struct FlickDataProvider { pressActions: [.input("z")] ) ]), - FlickKeyModel(labelType: .text(".,?!"), pressActions: [.input(".")], flickKeys: [ + FlickKeyModel(labelType: .text(".,?!"), pressActions: [.input(".")], flickKeys: [ .left: FlickedKeyModel( labelType: .text(","), pressActions: [.input(",")] @@ -436,13 +436,13 @@ struct FlickDataProvider { } // 縦に並べる @MainActor - static var numberKeyboard: [[any FlickKeyModelProtocol]] { + static var numberKeyboard: [[any FlickKeyModelProtocol]] { [ // 第1列 Self.TabKeys(), // 第2列 [ - FlickKeyModel(labelType: .symbols(["1", "☆", "♪", "→"]), pressActions: [.input("1")], flickKeys: [ + FlickKeyModel(labelType: .symbols(["1", "☆", "♪", "→"]), pressActions: [.input("1")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("☆"), pressActions: [.input("☆")] @@ -456,7 +456,7 @@ struct FlickDataProvider { pressActions: [.input("→")] ) ]), - FlickKeyModel(labelType: .symbols(["4", "○", "*", "・"]), pressActions: [.input("4")], flickKeys: [ + FlickKeyModel(labelType: .symbols(["4", "○", "*", "・"]), pressActions: [.input("4")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("○"), pressActions: [.input("○")] @@ -470,7 +470,7 @@ struct FlickDataProvider { pressActions: [.input("・")] ) ]), - FlickKeyModel(labelType: .symbols(["7", "「", "」", ":"]), pressActions: [.input("7")], flickKeys: [ + FlickKeyModel(labelType: .symbols(["7", "「", "」", ":"]), pressActions: [.input("7")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("「"), pressActions: [.input("「")] @@ -484,7 +484,7 @@ struct FlickDataProvider { pressActions: [.input(":")] ) ]), - FlickKeyModel(labelType: .text("()[]"), pressActions: [.input("(")], flickKeys: [ + FlickKeyModel(labelType: .text("()[]"), pressActions: [.input("(")], flickKeys: [ .left: FlickedKeyModel( labelType: .text(")"), pressActions: [.input(")")] @@ -502,7 +502,7 @@ struct FlickDataProvider { ], // 第3列 [ - FlickKeyModel(labelType: .symbols(["2", "¥", "$", "€"]), pressActions: [.input("2")], flickKeys: [ + FlickKeyModel(labelType: .symbols(["2", "¥", "$", "€"]), pressActions: [.input("2")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("¥"), pressActions: [.input("¥")] @@ -516,7 +516,7 @@ struct FlickDataProvider { pressActions: [.input("€")] ) ]), - FlickKeyModel(labelType: .symbols(["5", "+", "×", "÷"]), pressActions: [.input("5")], flickKeys: [ + FlickKeyModel(labelType: .symbols(["5", "+", "×", "÷"]), pressActions: [.input("5")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("+"), pressActions: [.input("+")] @@ -530,7 +530,7 @@ struct FlickDataProvider { pressActions: [.input("÷")] ) ]), - FlickKeyModel(labelType: .symbols(["8", "〒", "々", "〆"]), pressActions: [.input("8")], flickKeys: [ + FlickKeyModel(labelType: .symbols(["8", "〒", "々", "〆"]), pressActions: [.input("8")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("〒"), pressActions: [.input("〒")] @@ -544,7 +544,7 @@ struct FlickDataProvider { pressActions: [.input("〆")] ) ]), - FlickKeyModel(labelType: .symbols(["0", "〜", "…"]), pressActions: [.input("0")], flickKeys: [ + FlickKeyModel(labelType: .symbols(["0", "〜", "…"]), pressActions: [.input("0")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("〜"), pressActions: [.input("〜")] @@ -558,7 +558,7 @@ struct FlickDataProvider { ], // 第4列 [ - FlickKeyModel(labelType: .symbols(["3", "%", "°", "#"]), pressActions: [.input("3")], flickKeys: [ + FlickKeyModel(labelType: .symbols(["3", "%", "°", "#"]), pressActions: [.input("3")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("%"), pressActions: [.input("%")] @@ -573,7 +573,7 @@ struct FlickDataProvider { ) ]), - FlickKeyModel(labelType: .symbols(["6", "<", "=", ">"]), pressActions: [.input("6")], flickKeys: [ + FlickKeyModel(labelType: .symbols(["6", "<", "=", ">"]), pressActions: [.input("6")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("<"), pressActions: [.input("<")] @@ -588,7 +588,7 @@ struct FlickDataProvider { ) ]), - FlickKeyModel(labelType: .symbols(["9", "^", "|", "\\"]), pressActions: [.input("9")], flickKeys: [ + FlickKeyModel(labelType: .symbols(["9", "^", "|", "\\"]), pressActions: [.input("9")], flickKeys: [ .left: FlickedKeyModel( labelType: .text("^"), pressActions: [.input("^")] @@ -602,7 +602,7 @@ struct FlickDataProvider { pressActions: [.input("\\")] ) ]), - FlickKeyModel(labelType: .text(".,-/"), pressActions: [.input(".")], flickKeys: [ + FlickKeyModel(labelType: .text(".,-/"), pressActions: [.input(".")], flickKeys: [ .left: FlickedKeyModel( labelType: .text(","), pressActions: [.input(",")] diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/FlickKeyboardView.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/FlickKeyboardView.swift index 049b76bb..08e7f49c 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/FlickKeyboardView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/FlickKeyboardView.swift @@ -14,11 +14,11 @@ struct FlickKeyboardView: V @State private var suggestState = FlickSuggestState() private let tabDesign: TabDependentDesign - private let models: [KeyPosition: (model: any FlickKeyModelProtocol, width: Int, height: Int)] - init(keyModels: [[any FlickKeyModelProtocol]], interfaceSize: CGSize, keyboardOrientation: KeyboardOrientation) { + private let models: [KeyPosition: (model: any FlickKeyModelProtocol, width: Int, height: Int)] + init(keyModels: [[any FlickKeyModelProtocol]], interfaceSize: CGSize, keyboardOrientation: KeyboardOrientation) { self.tabDesign = TabDependentDesign(width: 5, height: 4, interfaceSize: interfaceSize, orientation: keyboardOrientation) - var models: [KeyPosition: (model: any FlickKeyModelProtocol, width: Int, height: Int)] = [:] + var models: [KeyPosition: (model: any FlickKeyModelProtocol, width: Int, height: Int)] = [:] for h in keyModels.indices { for v in keyModels[h].indices { let model = keyModels[h][v] diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickAaKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickAaKeyModel.swift index 95de8648..1f442965 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickAaKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickAaKeyModel.swift @@ -40,7 +40,7 @@ struct FlickAaKeyModel: Fli } } - func label(width: CGFloat, states: VariableStates) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { if states.boolStates.isCapsLocked { return KeyLabel(.image("capslock.fill"), width: width) } else { diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickChangeKeyboardKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickChangeKeyboardKeyModel.swift index 48581d84..1f6b259b 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickChangeKeyboardKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickChangeKeyboardKeyModel.swift @@ -45,7 +45,7 @@ struct FlickChangeKeyboardModel(width: CGFloat, states: VariableStates) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { switch SemiStaticStates.shared.needsInputModeSwitchKey { case true: return KeyLabel(.changeKeyboard, width: width) diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickEnterKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickEnterKeyModel.swift index 55011445..d1d8682c 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickEnterKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickEnterKeyModel.swift @@ -30,7 +30,7 @@ struct FlickEnterKeyModel: [:] } - func label(width: CGFloat, states: VariableStates) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { let text = Design.language.getEnterKeyText(states.enterKeyState) return KeyLabel(.text(text), width: width) } diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKanaSymbolsKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKanaSymbolsKeyModel.swift index 6e84de08..e00e847d 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKanaSymbolsKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKanaSymbolsKeyModel.swift @@ -33,7 +33,7 @@ struct FlickKanaSymbolsKeyModel(width: CGFloat, states: VariableStates) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { KeyLabel(self.labelType, width: width) } diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyModel.swift index 22d6b30c..f54d6667 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyModel.swift @@ -53,7 +53,7 @@ struct FlickKeyModel: Flick self.flickKeys } - func label(width: CGFloat, states: VariableStates) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { KeyLabel(self.labelType, width: width) } diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyModelProtocol.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyModelProtocol.swift index fdee67ce..ce856d39 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyModelProtocol.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyModelProtocol.swift @@ -44,9 +44,7 @@ public protocol FlickKeyModelProtocol { @MainActor func flickKeys(variableStates: VariableStates) -> [FlickDirection: FlickedKeyModel] @MainActor func isFlickAble(to direction: FlickDirection, variableStates: VariableStates) -> Bool - // FIXME: any FlickKeyModelProtocolではassociatedtypeが扱いづらい問題に対処するため、任意のExtensionに対して扱えるようにする - // FIXME: iOS 16以降はany FlickKeyModelProtocolを使って解消できる - @MainActor func label(width: CGFloat, states: VariableStates) -> KeyLabel + @MainActor func label(width: CGFloat, states: VariableStates) -> KeyLabel @MainActor func flickSensitivity(to direction: FlickDirection) -> CGFloat @MainActor func feedback(variableStates: VariableStates) diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyView.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyView.swift index 80ccc77b..e4a4486e 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKeyView.swift @@ -28,7 +28,7 @@ enum KeyPressState { @MainActor public struct FlickKeyView: View { - private let model: any FlickKeyModelProtocol + private let model: any FlickKeyModelProtocol @State private var pressState: KeyPressState = .inactive @Binding private var suggestState: FlickSuggestState @@ -43,7 +43,7 @@ public struct FlickKeyView: private let size: CGSize private let position: (x: Int, y: Int) - init(model: any FlickKeyModelProtocol, size: CGSize, position: (x: Int, y: Int), suggestState: Binding) { + init(model: any FlickKeyModelProtocol, size: CGSize, position: (x: Int, y: Int), suggestState: Binding) { self.model = model self.size = size self.position = position diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKogakiKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKogakiKeyModel.swift index ab2324c3..7e18751e 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKogakiKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickKogakiKeyModel.swift @@ -35,7 +35,7 @@ struct FlickKogakiKeyModel: .none } - func label(width: CGFloat, states: VariableStates) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { KeyLabel(self.labelType, width: width) } diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickNextCandidateKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickNextCandidateKeyModel.swift index 59dd8181..64f589c7 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickNextCandidateKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickNextCandidateKeyModel.swift @@ -58,7 +58,7 @@ struct FlickNextCandidateKeyModel(width: CGFloat, states: VariableStates) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { if states.resultModel.results.isEmpty { KeyLabel(.text("空白"), width: width) } else { diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickSpaceKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickSpaceKeyModel.swift index 4b8bd688..aed6b087 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickSpaceKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickSpaceKeyModel.swift @@ -43,7 +43,7 @@ struct FlickSpaceKeyModel: .init(start: [.setCursorBar(.toggle)]) } - func label(width: CGFloat, states: VariableStates) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { KeyLabel(.text("空白"), width: width) } diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickTabKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickTabKeyModel.swift index c356e77a..ff20387e 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickTabKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/KeyView/FlickTabKeyModel.swift @@ -37,7 +37,7 @@ struct FlickTabKeyModel: Fl self.tab = tab } - func label(width: CGFloat, states: VariableStates) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { KeyLabel(self.data.labelType, width: width) } diff --git a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/SuggestView/FlickSuggestView.swift b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/SuggestView/FlickSuggestView.swift index d4646ba7..38adf233 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/SuggestView/FlickSuggestView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/FlickKeyboard/SuggestView/FlickSuggestView.swift @@ -15,12 +15,12 @@ struct FlickSuggestView: Vi @EnvironmentObject private var variableStates: VariableStates @Environment(Extension.Theme.self) private var theme @Environment(\.colorScheme) private var colorScheme - private let model: any FlickKeyModelProtocol + private let model: any FlickKeyModelProtocol private let suggestType: FlickSuggestType private let tabDesign: TabDependentDesign private let size: CGSize - init(model: any FlickKeyModelProtocol, tabDesign: TabDependentDesign, size: CGSize, suggestType: FlickSuggestType) { + init(model: any FlickKeyModelProtocol, tabDesign: TabDependentDesign, size: CGSize, suggestType: FlickSuggestType) { self.model = model self.tabDesign = tabDesign self.size = size @@ -167,7 +167,7 @@ struct FlickSuggestView: Vi ) .zIndex(2) .overlay { - (self.model.label(width: size.width, states: variableStates) as KeyLabel) + (self.model.label(width: size.width, states: variableStates)) .textColor(.white) .textSize(.xlarge) } diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyAaKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyAaKeyModel.swift index 03ff1ab8..9f6372ee 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyAaKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyAaKeyModel.swift @@ -28,7 +28,7 @@ struct QwertyAaKeyModel: Qw .init(start: [.setBoolState(VariableStates.BoolStates.isCapsLockedKey, .toggle)]) } - func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { + func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { if states.boolStates.isCapsLocked { return KeyLabel(.image("capslock.fill"), width: width, textColor: color) } else { diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyChangeKeyboardKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyChangeKeyboardKeyModel.swift index dddafd1d..8af5a2d0 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyChangeKeyboardKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyChangeKeyboardKeyModel.swift @@ -68,7 +68,7 @@ struct QwertyChangeKeyboardKeyModel(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { + func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { if SemiStaticStates.shared.needsInputModeSwitchKey { return KeyLabel(.changeKeyboard, width: width, textColor: color) } diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyEnterKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyEnterKeyModel.swift index e2fafb48..d783af6a 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyEnterKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyEnterKeyModel.swift @@ -34,7 +34,7 @@ struct QwertyEnterKeyModel: .none } - func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { + func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { let text = Design.language.getEnterKeyText(states.enterKeyState) return KeyLabel(.text(text), width: width, textSize: .small, textColor: color) } diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyFunctionalKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyFunctionalKeyModel.swift index cf8420fe..101366c2 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyFunctionalKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyFunctionalKeyModel.swift @@ -38,7 +38,7 @@ struct QwertyFunctionalKeyModel(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { + func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { KeyLabel(self.labelType, width: width, textColor: color) } diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyModel.swift index 96acb6cb..f50926c9 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyModel.swift @@ -31,7 +31,7 @@ struct QwertyKeyModel: Qwer self.unpressedKeyColorType = keyColorType } - func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { + func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { if (states.boolStates.isCapsLocked || states.boolStates.isShifted), states.keyboardLanguage == .en_US, case let .text(text) = self.labelType { return KeyLabel(.text(text.uppercased()), width: width, textColor: color) } diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyModelProtocol.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyModelProtocol.swift index e2fa274d..3b8a290f 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyModelProtocol.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyModelProtocol.swift @@ -92,7 +92,7 @@ protocol QwertyKeyModelProtocol { @MainActor func longPressActions(variableStates: VariableStates) -> LongpressActionType /// 二回連続で押した際に発火するActionを指定する @MainActor func doublePressActions(variableStates: VariableStates) -> [ActionType] - @MainActor func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel + @MainActor func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel func backGroundColorWhenPressed(theme: Extension.Theme) -> Color var unpressedKeyColorType: QwertyUnpressedKeyColorType {get} diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyView.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyView.swift index c9179d7c..7039e2bf 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyKeyView.swift @@ -98,7 +98,7 @@ struct QwertyKeyDoublePressState { @MainActor struct QwertyKeyView: View { - private let model: any QwertyKeyModelProtocol + private let model: any QwertyKeyModelProtocol @EnvironmentObject private var variableStates: VariableStates @State private var pressState: QwertyKeyPressState = .unpressed @@ -112,7 +112,7 @@ struct QwertyKeyView: View private let tabDesign: TabDependentDesign private let size: CGSize - init(model: any QwertyKeyModelProtocol, tabDesign: TabDependentDesign, size: CGSize) { + init(model: any QwertyKeyModelProtocol, tabDesign: TabDependentDesign, size: CGSize) { self.model = model self.tabDesign = tabDesign self.size = size @@ -227,7 +227,7 @@ struct QwertyKeyView: View } private func label(width: CGFloat, color: Color?) -> some View { - self.model.label(width: width, states: variableStates, color: color) as KeyLabel + self.model.label(width: width, states: variableStates, color: color) } var body: some View { diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyLanguageSwitchKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyLanguageSwitchKeyModel.swift index 1d9e45c4..913c89da 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyLanguageSwitchKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyLanguageSwitchKeyModel.swift @@ -55,7 +55,7 @@ struct QwertySwitchLanguageKeyModel(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { + func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { let current = currentTabLanguage(variableStates: states) if languages.0 == current { return KeyLabel(.selectable(languages.0.symbol, languages.1.symbol), width: width, textColor: color) @@ -64,7 +64,7 @@ struct QwertySwitchLanguageKeyModel(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { + func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { if states.resultModel.results.isEmpty { switch states.keyboardLanguage { case .el_GR: diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyShiftKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyShiftKeyModel.swift index d8751a7e..25661474 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyShiftKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyShiftKeyModel.swift @@ -37,7 +37,7 @@ struct QwertyShiftKeyModel: } } - func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { + func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { if states.boolStates.isCapsLocked { return KeyLabel(.image("capslock.fill"), width: width, textColor: color) } else if states.boolStates.isShifted { diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertySpaceKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertySpaceKeyModel.swift index 16c20490..0ae02b98 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertySpaceKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertySpaceKeyModel.swift @@ -18,7 +18,7 @@ struct QwertySpaceKeyModel: init() {} - func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { + func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { switch states.keyboardLanguage { case .el_GR: return KeyLabel(.text("διάστημα"), width: width, textSize: .small, textColor: color) diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyTabKeyModel.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyTabKeyModel.swift index 4cffc7f7..d366ae9e 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyTabKeyModel.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/KeyView/QwertyTabKeyModel.swift @@ -41,7 +41,7 @@ struct QwertyTabKeyModel: Q self.keySizeType = .functional(normal: rowInfo.normal, functional: rowInfo.functional, enter: rowInfo.enter, space: rowInfo.space) } - func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { + func label(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel { switch SemiStaticStates.shared.needsInputModeSwitchKey { case true: switch states.keyboardLanguage { diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/QwertyDataProvider.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/QwertyDataProvider.swift index cdd5d10a..1fb7a81a 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/QwertyDataProvider.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/QwertyDataProvider.swift @@ -10,12 +10,12 @@ import Foundation import enum CustardKit.TabData struct QwertyDataProvider { - @MainActor static func tabKeys(rowInfo: (normal: Int, functional: Int, space: Int, enter: Int)) -> (languageKey: any QwertyKeyModelProtocol, numbersKey: any QwertyKeyModelProtocol, symbolsKey: any QwertyKeyModelProtocol, changeKeyboardKey: any QwertyKeyModelProtocol) { + @MainActor static func tabKeys(rowInfo: (normal: Int, functional: Int, space: Int, enter: Int)) -> (languageKey: any QwertyKeyModelProtocol, numbersKey: any QwertyKeyModelProtocol, symbolsKey: any QwertyKeyModelProtocol, changeKeyboardKey: any QwertyKeyModelProtocol) { let preferredLanguage = Extension.SettingProvider.preferredLanguage - let languageKey: any QwertyKeyModelProtocol + let languageKey: any QwertyKeyModelProtocol let first = preferredLanguage.first if let second = preferredLanguage.second { - languageKey = QwertySwitchLanguageKeyModel(rowInfo: rowInfo, languages: (first, second)) + languageKey = QwertySwitchLanguageKeyModel(rowInfo: rowInfo, languages: (first, second)) } else { let targetTab: TabData = { switch first { @@ -27,17 +27,17 @@ struct QwertyDataProvider { return .system(.user_japanese) } }() - languageKey = QwertyFunctionalKeyModel(labelType: .text(first.symbol), rowInfo: rowInfo, pressActions: [.moveTab(targetTab)], longPressActions: .none, needSuggestView: false) + languageKey = QwertyFunctionalKeyModel(labelType: .text(first.symbol), rowInfo: rowInfo, pressActions: [.moveTab(targetTab)], longPressActions: .none, needSuggestView: false) } - let numbersKey: any QwertyKeyModelProtocol = QwertyFunctionalKeyModel(labelType: .image("textformat.123"), rowInfo: rowInfo, pressActions: [.moveTab(.system(.qwerty_numbers))], longPressActions: .init(start: [.setTabBar(.toggle)])) - let symbolsKey: any QwertyKeyModelProtocol = QwertyFunctionalKeyModel(labelType: .text("#+="), rowInfo: rowInfo, pressActions: [.moveTab(.system(.qwerty_symbols))], longPressActions: .init(start: [.setTabBar(.toggle)])) + let numbersKey: any QwertyKeyModelProtocol = QwertyFunctionalKeyModel(labelType: .image("textformat.123"), rowInfo: rowInfo, pressActions: [.moveTab(.system(.qwerty_numbers))], longPressActions: .init(start: [.setTabBar(.toggle)])) + let symbolsKey: any QwertyKeyModelProtocol = QwertyFunctionalKeyModel(labelType: .text("#+="), rowInfo: rowInfo, pressActions: [.moveTab(.system(.qwerty_symbols))], longPressActions: .init(start: [.setTabBar(.toggle)])) - let changeKeyboardKey: any QwertyKeyModelProtocol + let changeKeyboardKey: any QwertyKeyModelProtocol if let second = preferredLanguage.second { - changeKeyboardKey = QwertyChangeKeyboardKeyModel(keySizeType: .functional(normal: rowInfo.normal, functional: rowInfo.functional, enter: rowInfo.enter, space: rowInfo.space), fallBackType: .secondTab(secondLanguage: second)) + changeKeyboardKey = QwertyChangeKeyboardKeyModel(keySizeType: .functional(normal: rowInfo.normal, functional: rowInfo.functional, enter: rowInfo.enter, space: rowInfo.space), fallBackType: .secondTab(secondLanguage: second)) } else { - changeKeyboardKey = QwertyChangeKeyboardKeyModel(keySizeType: .functional(normal: rowInfo.normal, functional: rowInfo.functional, enter: rowInfo.enter, space: rowInfo.space), fallBackType: .tabBar) + changeKeyboardKey = QwertyChangeKeyboardKeyModel(keySizeType: .functional(normal: rowInfo.normal, functional: rowInfo.functional, enter: rowInfo.enter, space: rowInfo.space), fallBackType: .tabBar) } return ( languageKey: languageKey, @@ -52,9 +52,9 @@ struct QwertyDataProvider { } // 横に並べる - @MainActor static var numberKeyboard: [[any QwertyKeyModelProtocol]] {[ + @MainActor static var numberKeyboard: [[any QwertyKeyModelProtocol]] {[ [ - QwertyKeyModel( + QwertyKeyModel( labelType: .text("1"), pressActions: [.input("1")], variationsModel: VariationsModel([ @@ -65,7 +65,7 @@ struct QwertyDataProvider { ], direction: .right) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("2"), pressActions: [.input("2")], variationsModel: VariationsModel([ @@ -76,7 +76,7 @@ struct QwertyDataProvider { ], direction: .right) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("3"), pressActions: [.input("3")], variationsModel: VariationsModel([ @@ -87,7 +87,7 @@ struct QwertyDataProvider { ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("4"), pressActions: [.input("4")], variationsModel: VariationsModel([ @@ -97,7 +97,7 @@ struct QwertyDataProvider { (label: .text("④"), actions: [.input("④")] ) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("5"), pressActions: [.input("5")], variationsModel: VariationsModel([ @@ -107,7 +107,7 @@ struct QwertyDataProvider { (label: .text("⑤"), actions: [.input("⑤")] ) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("6"), pressActions: [.input("6")], variationsModel: VariationsModel([ @@ -117,7 +117,7 @@ struct QwertyDataProvider { (label: .text("⑥"), actions: [.input("⑥")] ) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("7"), pressActions: [.input("7")], variationsModel: VariationsModel([ @@ -127,7 +127,7 @@ struct QwertyDataProvider { (label: .text("⑦"), actions: [.input("⑦")] ) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("8"), pressActions: [.input("8")], variationsModel: VariationsModel([ @@ -137,7 +137,7 @@ struct QwertyDataProvider { (label: .text("⑧"), actions: [.input("⑧")] ) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("9"), pressActions: [.input("9")], variationsModel: VariationsModel([ @@ -147,7 +147,7 @@ struct QwertyDataProvider { (label: .text("⑨"), actions: [.input("⑨")] ) ], direction: .left) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("0"), pressActions: [.input("0")], variationsModel: VariationsModel([ @@ -159,8 +159,8 @@ struct QwertyDataProvider { ) ], [ - QwertyKeyModel(labelType: .text("-"), pressActions: [.input("-")]), - QwertyKeyModel( + QwertyKeyModel(labelType: .text("-"), pressActions: [.input("-")]), + QwertyKeyModel( labelType: .text("/"), pressActions: [.input("/")], variationsModel: VariationsModel([ @@ -168,7 +168,7 @@ struct QwertyDataProvider { (label: .text("\\"), actions: [.input("\\")] ) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text(":"), pressActions: [.input(":")], variationsModel: VariationsModel([ @@ -178,7 +178,7 @@ struct QwertyDataProvider { (label: .text(";"), actions: [.input(";")] ) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("@"), pressActions: [.input("@")], variationsModel: VariationsModel([ @@ -186,9 +186,9 @@ struct QwertyDataProvider { (label: .text("@"), actions: [.input("@")] ) ]) ), - QwertyKeyModel(labelType: .text("("), pressActions: [.input("(")]), - QwertyKeyModel(labelType: .text(")"), pressActions: [.input(")")]), - QwertyKeyModel( + QwertyKeyModel(labelType: .text("("), pressActions: [.input("(")]), + QwertyKeyModel(labelType: .text(")"), pressActions: [.input(")")]), + QwertyKeyModel( labelType: .text("「"), pressActions: [.input("「")], variationsModel: VariationsModel([ @@ -199,7 +199,7 @@ struct QwertyDataProvider { (label: .text("《"), actions: [.input("《")] ) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("」"), pressActions: [.input("」")], variationsModel: VariationsModel([ @@ -210,7 +210,7 @@ struct QwertyDataProvider { (label: .text("》"), actions: [.input("》")] ) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("¥"), pressActions: [.input("¥")], variationsModel: VariationsModel([ @@ -224,7 +224,7 @@ struct QwertyDataProvider { (label: .text("¤"), actions: [.input("¤")] ) ], direction: .left) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("&"), pressActions: [.input("&")], variationsModel: VariationsModel([ @@ -238,21 +238,21 @@ struct QwertyDataProvider { Self.tabKeys(rowInfo: (7, 2, 0, 0)).symbolsKey ] + Extension.SettingProvider.numberTabCustomKeysSetting.compiled(extension: Extension.self) + [ - QwertyFunctionalKeyModel.delete + QwertyFunctionalKeyModel.delete ], [ Self.tabKeys(rowInfo: (0, 2, 1, 1)).languageKey, Self.tabKeys(rowInfo: (0, 2, 1, 1)).changeKeyboardKey, Self.spaceKey(), - QwertyEnterKeyModel.shared + QwertyEnterKeyModel.shared ] ] } // 横に並べる - @MainActor static func symbolsKeyboard() -> [[any QwertyKeyModelProtocol]] {[ + @MainActor static func symbolsKeyboard() -> [[any QwertyKeyModelProtocol]] {[ [ - QwertyKeyModel( + QwertyKeyModel( labelType: .text("["), pressActions: [.input("[")], variationsModel: VariationsModel([ @@ -260,7 +260,7 @@ struct QwertyDataProvider { (label: .text("["), actions: [.input("[")]) ], direction: .right) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("]"), pressActions: [.input("]")], variationsModel: VariationsModel([ @@ -268,7 +268,7 @@ struct QwertyDataProvider { (label: .text("]"), actions: [.input("]")]) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("{"), pressActions: [.input("{")], variationsModel: VariationsModel([ @@ -276,7 +276,7 @@ struct QwertyDataProvider { (label: .text("{"), actions: [.input("{")]) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("}"), pressActions: [.input("}")], variationsModel: VariationsModel([ @@ -284,7 +284,7 @@ struct QwertyDataProvider { (label: .text("}"), actions: [.input("}")]) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("#"), pressActions: [.input("#")], variationsModel: VariationsModel([ @@ -292,7 +292,7 @@ struct QwertyDataProvider { (label: .text("#"), actions: [.input("#")]) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("%"), pressActions: [.input("%")], variationsModel: VariationsModel([ @@ -300,7 +300,7 @@ struct QwertyDataProvider { (label: .text("%"), actions: [.input("%")]) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("^"), pressActions: [.input("^")], variationsModel: VariationsModel([ @@ -308,7 +308,7 @@ struct QwertyDataProvider { (label: .text("^"), actions: [.input("^")]) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("*"), pressActions: [.input("*")], variationsModel: VariationsModel([ @@ -316,7 +316,7 @@ struct QwertyDataProvider { (label: .text("*"), actions: [.input("*")]) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("+"), pressActions: [.input("+")], variationsModel: VariationsModel([ @@ -325,7 +325,7 @@ struct QwertyDataProvider { (label: .text("±"), actions: [.input("±")]) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("="), pressActions: [.input("=")], variationsModel: VariationsModel([ @@ -338,8 +338,8 @@ struct QwertyDataProvider { ) ], [ - QwertyKeyModel(labelType: .text("_"), pressActions: [.input("_")]), - QwertyKeyModel( + QwertyKeyModel(labelType: .text("_"), pressActions: [.input("_")]), + QwertyKeyModel( labelType: .text("\\"), pressActions: [.input("\\")], variationsModel: VariationsModel([ @@ -347,7 +347,7 @@ struct QwertyDataProvider { (label: .text("\\"), actions: [.input("\\")] ) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text(";"), pressActions: [.input(";")], variationsModel: VariationsModel([ @@ -357,7 +357,7 @@ struct QwertyDataProvider { (label: .text(";"), actions: [.input(";")] ) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("|"), pressActions: [.input("|")], variationsModel: VariationsModel([ @@ -365,7 +365,7 @@ struct QwertyDataProvider { (label: .text("|"), actions: [.input("|")] ) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("<"), pressActions: [.input("<")], variationsModel: VariationsModel([ @@ -373,7 +373,7 @@ struct QwertyDataProvider { (label: .text("<"), actions: [.input("<")]) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text(">"), pressActions: [.input(">")], variationsModel: VariationsModel([ @@ -381,7 +381,7 @@ struct QwertyDataProvider { (label: .text(">"), actions: [.input(">")]) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("\""), pressActions: [.input("\"")], variationsModel: VariationsModel([ @@ -391,7 +391,7 @@ struct QwertyDataProvider { (label: .text("”"), actions: [.input("”")]) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("'"), pressActions: [.input("'")], variationsModel: VariationsModel([ @@ -400,7 +400,7 @@ struct QwertyDataProvider { ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("$"), pressActions: [.input("$")], variationsModel: VariationsModel([ @@ -408,7 +408,7 @@ struct QwertyDataProvider { (label: .text("$"), actions: [.input("$")]) ]) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("€"), pressActions: [.input("€")], variationsModel: VariationsModel([ @@ -426,7 +426,7 @@ struct QwertyDataProvider { [ Self.tabKeys(rowInfo: (7, 2, 0, 0)).numbersKey, - QwertyKeyModel( + QwertyKeyModel( labelType: .text("."), pressActions: [.input(".")], variationsModel: VariationsModel([ @@ -435,7 +435,7 @@ struct QwertyDataProvider { ]), for: (7, 5) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text(","), pressActions: [.input(",")], variationsModel: VariationsModel([ @@ -443,7 +443,7 @@ struct QwertyDataProvider { (label: .text(","), actions: [.input(",")] ) ]), for: (7, 5)), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("?"), pressActions: [.input("?")], variationsModel: VariationsModel([ @@ -452,7 +452,7 @@ struct QwertyDataProvider { ]), for: (7, 5) ), - QwertyKeyModel( + QwertyKeyModel( labelType: .text("!"), pressActions: [.input("!")], variationsModel: VariationsModel([ @@ -460,116 +460,116 @@ struct QwertyDataProvider { (label: .text("!"), actions: [.input("!")] ) ]), for: (7, 5)), - QwertyKeyModel(labelType: .text("・"), pressActions: [.input("…")], for: (7, 5)), - QwertyFunctionalKeyModel.delete + QwertyKeyModel(labelType: .text("・"), pressActions: [.input("…")], for: (7, 5)), + QwertyFunctionalKeyModel.delete ], [ Self.tabKeys(rowInfo: (0, 2, 1, 1)).languageKey, Self.tabKeys(rowInfo: (0, 2, 1, 1)).changeKeyboardKey, Self.spaceKey(), - QwertyEnterKeyModel.shared + QwertyEnterKeyModel.shared ] ]} // 横に並べる - @MainActor static func hiraKeyboard() -> [[any QwertyKeyModelProtocol]] {[ + @MainActor static func hiraKeyboard() -> [[any QwertyKeyModelProtocol]] {[ [ - QwertyKeyModel(labelType: .text("q"), pressActions: [.input("q")]), - QwertyKeyModel(labelType: .text("w"), pressActions: [.input("w")]), - QwertyKeyModel(labelType: .text("e"), pressActions: [.input("e")]), - QwertyKeyModel(labelType: .text("r"), pressActions: [.input("r")]), - QwertyKeyModel(labelType: .text("t"), pressActions: [.input("t")]), - QwertyKeyModel(labelType: .text("y"), pressActions: [.input("y")]), - QwertyKeyModel(labelType: .text("u"), pressActions: [.input("u")]), - QwertyKeyModel(labelType: .text("i"), pressActions: [.input("i")]), - QwertyKeyModel(labelType: .text("o"), pressActions: [.input("o")]), - QwertyKeyModel(labelType: .text("p"), pressActions: [.input("p")]) + QwertyKeyModel(labelType: .text("q"), pressActions: [.input("q")]), + QwertyKeyModel(labelType: .text("w"), pressActions: [.input("w")]), + QwertyKeyModel(labelType: .text("e"), pressActions: [.input("e")]), + QwertyKeyModel(labelType: .text("r"), pressActions: [.input("r")]), + QwertyKeyModel(labelType: .text("t"), pressActions: [.input("t")]), + QwertyKeyModel(labelType: .text("y"), pressActions: [.input("y")]), + QwertyKeyModel(labelType: .text("u"), pressActions: [.input("u")]), + QwertyKeyModel(labelType: .text("i"), pressActions: [.input("i")]), + QwertyKeyModel(labelType: .text("o"), pressActions: [.input("o")]), + QwertyKeyModel(labelType: .text("p"), pressActions: [.input("p")]) ], [ - QwertyKeyModel(labelType: .text("a"), pressActions: [.input("a")]), - QwertyKeyModel(labelType: .text("s"), pressActions: [.input("s")]), - QwertyKeyModel(labelType: .text("d"), pressActions: [.input("d")]), - QwertyKeyModel(labelType: .text("f"), pressActions: [.input("f")]), - QwertyKeyModel(labelType: .text("g"), pressActions: [.input("g")]), - QwertyKeyModel(labelType: .text("h"), pressActions: [.input("h")]), - QwertyKeyModel(labelType: .text("j"), pressActions: [.input("j")]), - QwertyKeyModel(labelType: .text("k"), pressActions: [.input("k")]), - QwertyKeyModel(labelType: .text("l"), pressActions: [.input("l")]), - QwertyKeyModel(labelType: .text("ー"), pressActions: [.input("ー")]) + QwertyKeyModel(labelType: .text("a"), pressActions: [.input("a")]), + QwertyKeyModel(labelType: .text("s"), pressActions: [.input("s")]), + QwertyKeyModel(labelType: .text("d"), pressActions: [.input("d")]), + QwertyKeyModel(labelType: .text("f"), pressActions: [.input("f")]), + QwertyKeyModel(labelType: .text("g"), pressActions: [.input("g")]), + QwertyKeyModel(labelType: .text("h"), pressActions: [.input("h")]), + QwertyKeyModel(labelType: .text("j"), pressActions: [.input("j")]), + QwertyKeyModel(labelType: .text("k"), pressActions: [.input("k")]), + QwertyKeyModel(labelType: .text("l"), pressActions: [.input("l")]), + QwertyKeyModel(labelType: .text("ー"), pressActions: [.input("ー")]) ], [ Self.tabKeys(rowInfo: (7, 2, 0, 0)).languageKey, - QwertyKeyModel(labelType: .text("z"), pressActions: [.input("z")]), - QwertyKeyModel(labelType: .text("x"), pressActions: [.input("x")]), - QwertyKeyModel(labelType: .text("c"), pressActions: [.input("c")]), - QwertyKeyModel(labelType: .text("v"), pressActions: [.input("v")]), - QwertyKeyModel(labelType: .text("b"), pressActions: [.input("b")]), - QwertyKeyModel(labelType: .text("n"), pressActions: [.input("n")]), - QwertyKeyModel(labelType: .text("m"), pressActions: [.input("m")]), - QwertyFunctionalKeyModel.delete + QwertyKeyModel(labelType: .text("z"), pressActions: [.input("z")]), + QwertyKeyModel(labelType: .text("x"), pressActions: [.input("x")]), + QwertyKeyModel(labelType: .text("c"), pressActions: [.input("c")]), + QwertyKeyModel(labelType: .text("v"), pressActions: [.input("v")]), + QwertyKeyModel(labelType: .text("b"), pressActions: [.input("b")]), + QwertyKeyModel(labelType: .text("n"), pressActions: [.input("n")]), + QwertyKeyModel(labelType: .text("m"), pressActions: [.input("m")]), + QwertyFunctionalKeyModel.delete ], [ Self.tabKeys(rowInfo: (0, 2, 1, 1)).numbersKey, Self.tabKeys(rowInfo: (0, 2, 1, 1)).changeKeyboardKey, Self.spaceKey(), - QwertyEnterKeyModel.shared + QwertyEnterKeyModel.shared ] ]} // 横に並べる - @MainActor static func abcKeyboard() -> [[any QwertyKeyModelProtocol]] {[ + @MainActor static func abcKeyboard() -> [[any QwertyKeyModelProtocol]] {[ [ - QwertyKeyModel(labelType: .text("q"), pressActions: [.input("q")]), - QwertyKeyModel(labelType: .text("w"), pressActions: [.input("w")]), - QwertyKeyModel(labelType: .text("e"), pressActions: [.input("e")]), - QwertyKeyModel(labelType: .text("r"), pressActions: [.input("r")]), - QwertyKeyModel(labelType: .text("t"), pressActions: [.input("t")]), - QwertyKeyModel(labelType: .text("y"), pressActions: [.input("y")]), - QwertyKeyModel(labelType: .text("u"), pressActions: [.input("u")]), - QwertyKeyModel(labelType: .text("i"), pressActions: [.input("i")]), - QwertyKeyModel(labelType: .text("o"), pressActions: [.input("o")]), - QwertyKeyModel(labelType: .text("p"), pressActions: [.input("p")]) + QwertyKeyModel(labelType: .text("q"), pressActions: [.input("q")]), + QwertyKeyModel(labelType: .text("w"), pressActions: [.input("w")]), + QwertyKeyModel(labelType: .text("e"), pressActions: [.input("e")]), + QwertyKeyModel(labelType: .text("r"), pressActions: [.input("r")]), + QwertyKeyModel(labelType: .text("t"), pressActions: [.input("t")]), + QwertyKeyModel(labelType: .text("y"), pressActions: [.input("y")]), + QwertyKeyModel(labelType: .text("u"), pressActions: [.input("u")]), + QwertyKeyModel(labelType: .text("i"), pressActions: [.input("i")]), + QwertyKeyModel(labelType: .text("o"), pressActions: [.input("o")]), + QwertyKeyModel(labelType: .text("p"), pressActions: [.input("p")]) ], Extension.SettingProvider.useShiftKey ? [ - QwertyShiftKeyModel.shared, - QwertyKeyModel(labelType: .text("a"), pressActions: [.input("a")]), - QwertyKeyModel(labelType: .text("s"), pressActions: [.input("s")]), - QwertyKeyModel(labelType: .text("d"), pressActions: [.input("d")]), - QwertyKeyModel(labelType: .text("f"), pressActions: [.input("f")]), - QwertyKeyModel(labelType: .text("g"), pressActions: [.input("g")]), - QwertyKeyModel(labelType: .text("h"), pressActions: [.input("h")]), - QwertyKeyModel(labelType: .text("j"), pressActions: [.input("j")]), - QwertyKeyModel(labelType: .text("k"), pressActions: [.input("k")]), - QwertyKeyModel(labelType: .text("l"), pressActions: [.input("l")]) + QwertyShiftKeyModel.shared, + QwertyKeyModel(labelType: .text("a"), pressActions: [.input("a")]), + QwertyKeyModel(labelType: .text("s"), pressActions: [.input("s")]), + QwertyKeyModel(labelType: .text("d"), pressActions: [.input("d")]), + QwertyKeyModel(labelType: .text("f"), pressActions: [.input("f")]), + QwertyKeyModel(labelType: .text("g"), pressActions: [.input("g")]), + QwertyKeyModel(labelType: .text("h"), pressActions: [.input("h")]), + QwertyKeyModel(labelType: .text("j"), pressActions: [.input("j")]), + QwertyKeyModel(labelType: .text("k"), pressActions: [.input("k")]), + QwertyKeyModel(labelType: .text("l"), pressActions: [.input("l")]) ] : [ - QwertyKeyModel(labelType: .text("a"), pressActions: [.input("a")]), - QwertyKeyModel(labelType: .text("s"), pressActions: [.input("s")]), - QwertyKeyModel(labelType: .text("d"), pressActions: [.input("d")]), - QwertyKeyModel(labelType: .text("f"), pressActions: [.input("f")]), - QwertyKeyModel(labelType: .text("g"), pressActions: [.input("g")]), - QwertyKeyModel(labelType: .text("h"), pressActions: [.input("h")]), - QwertyKeyModel(labelType: .text("j"), pressActions: [.input("j")]), - QwertyKeyModel(labelType: .text("k"), pressActions: [.input("k")]), - QwertyKeyModel(labelType: .text("l"), pressActions: [.input("l")]), - QwertyAaKeyModel.shared + QwertyKeyModel(labelType: .text("a"), pressActions: [.input("a")]), + QwertyKeyModel(labelType: .text("s"), pressActions: [.input("s")]), + QwertyKeyModel(labelType: .text("d"), pressActions: [.input("d")]), + QwertyKeyModel(labelType: .text("f"), pressActions: [.input("f")]), + QwertyKeyModel(labelType: .text("g"), pressActions: [.input("g")]), + QwertyKeyModel(labelType: .text("h"), pressActions: [.input("h")]), + QwertyKeyModel(labelType: .text("j"), pressActions: [.input("j")]), + QwertyKeyModel(labelType: .text("k"), pressActions: [.input("k")]), + QwertyKeyModel(labelType: .text("l"), pressActions: [.input("l")]), + QwertyAaKeyModel.shared ], [ Self.tabKeys(rowInfo: (7, 2, 0, 0)).languageKey, - QwertyKeyModel(labelType: .text("z"), pressActions: [.input("z")]), - QwertyKeyModel(labelType: .text("x"), pressActions: [.input("x")]), - QwertyKeyModel(labelType: .text("c"), pressActions: [.input("c")]), - QwertyKeyModel(labelType: .text("v"), pressActions: [.input("v")]), - QwertyKeyModel(labelType: .text("b"), pressActions: [.input("b")]), - QwertyKeyModel(labelType: .text("n"), pressActions: [.input("n")]), - QwertyKeyModel(labelType: .text("m"), pressActions: [.input("m")]), - QwertyFunctionalKeyModel.delete + QwertyKeyModel(labelType: .text("z"), pressActions: [.input("z")]), + QwertyKeyModel(labelType: .text("x"), pressActions: [.input("x")]), + QwertyKeyModel(labelType: .text("c"), pressActions: [.input("c")]), + QwertyKeyModel(labelType: .text("v"), pressActions: [.input("v")]), + QwertyKeyModel(labelType: .text("b"), pressActions: [.input("b")]), + QwertyKeyModel(labelType: .text("n"), pressActions: [.input("n")]), + QwertyKeyModel(labelType: .text("m"), pressActions: [.input("m")]), + QwertyFunctionalKeyModel.delete ], [ Self.tabKeys(rowInfo: (0, 2, 1, 1)).numbersKey, Self.tabKeys(rowInfo: (0, 2, 1, 1)).changeKeyboardKey, Self.spaceKey(), - QwertyEnterKeyModel.shared + QwertyEnterKeyModel.shared ] ]} } diff --git a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/QwertyKeyboardView.swift b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/QwertyKeyboardView.swift index 7a2a2ab0..d8c5a36e 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/QwertyKeyboardView.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/QwertyKeyboard/QwertyKeyboardView.swift @@ -11,9 +11,9 @@ import SwiftUI struct QwertyKeyboardView: View { private let tabDesign: TabDependentDesign - private let keyModels: [[any QwertyKeyModelProtocol]] + private let keyModels: [[any QwertyKeyModelProtocol]] - init(keyModels: [[any QwertyKeyModelProtocol]], interfaceSize: CGSize, keyboardOrientation: KeyboardOrientation) { + init(keyModels: [[any QwertyKeyModelProtocol]], interfaceSize: CGSize, keyboardOrientation: KeyboardOrientation) { self.keyModels = keyModels self.tabDesign = TabDependentDesign(width: 10, height: 4, interfaceSize: interfaceSize, orientation: keyboardOrientation) } @@ -32,7 +32,7 @@ struct QwertyKeyboardView: HStack(spacing: tabDesign.horizontalSpacing) { ForEach(self.horizontalIndices(v: v), id: \.self) {(h: Int) in let model = self.keyModels[v][h] - QwertyKeyView( + QwertyKeyView( model: model, tabDesign: tabDesign, size: CGSize( diff --git a/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/ClipboardHistoryTab.swift b/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/ClipboardHistoryTab.swift index a2219807..b971b4ea 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/ClipboardHistoryTab.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/ClipboardHistoryTab.swift @@ -192,7 +192,7 @@ struct ClipboardHistoryTab: } } } - .iOS16_scrollContentBackground(.hidden) + .scrollContentBackground(.hidden) } private func enterKey(_ design: TabDependentDesign) -> some View { diff --git a/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/EmojiTab.swift b/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/EmojiTab.swift index 975a0b2a..99f6263e 100644 --- a/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/EmojiTab.swift +++ b/AzooKeyCore/Sources/KeyboardViews/View/SpecialTabs/EmojiTab.swift @@ -210,10 +210,8 @@ struct EmojiTab: View { // 読み込むファイルはバージョンごとに変更する必要がある if #available(iOS 16.4, *) { fileURL = Bundle.main.bundleURL.appendingPathComponent("emoji_genre_E15.0.txt.gen", isDirectory: false) - } else if #available(iOS 15.4, *) { - fileURL = Bundle.main.bundleURL.appendingPathComponent("emoji_genre_E14.0.txt.gen", isDirectory: false) } else { - fileURL = Bundle.main.bundleURL.appendingPathComponent("emoji_genre_E13.1.txt.gen", isDirectory: false) + fileURL = Bundle.main.bundleURL.appendingPathComponent("emoji_genre_E14.0.txt.gen", isDirectory: false) } let genres: [String: Genre] = [ "Symbols": .symbols, @@ -363,7 +361,7 @@ struct EmojiTab: View { private struct ExpandKeyModel: SimpleKeyModelProtocol { private var currentLevel: EmojiTabExpandModePreference.Level private var action: () -> Void - func label(width: CGFloat, states: VariableStates, theme: ThemeData) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { KeyLabel(.image(self.currentLevel.icon), width: width, textSize: .max) } @@ -390,7 +388,7 @@ private struct ExpandKeyModel: SimpleKeyModelProtocol { private var action: () -> Void private var systemImage: String - func label(width: CGFloat, states: VariableStates, theme: ThemeData) -> KeyLabel { + func label(width: CGFloat, states: VariableStates) -> KeyLabel { KeyLabel(.image(systemImage), width: width, textSize: .max) } @@ -429,7 +427,7 @@ private struct EmojiKeyModel(width: CGFloat, states _: VariableStates, theme _: ThemeData) -> KeyLabel { + func label(width: CGFloat, states _: VariableStates) -> KeyLabel { KeyLabel(.text(emoji), width: width, textSize: .max) } diff --git a/AzooKeyCore/Sources/SwiftUIUtils/Availability.swift b/AzooKeyCore/Sources/SwiftUIUtils/Availability.swift deleted file mode 100644 index f1db98e7..00000000 --- a/AzooKeyCore/Sources/SwiftUIUtils/Availability.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// Availability.swift -// Availability -// -// Created by ensan on 2021/07/21. -// Copyright © 2021 ensan. All rights reserved. -// - -import Foundation -import SwiftUI - -public extension View { - @ViewBuilder - func iOS16_scrollContentBackground(_ visibility: Visibility) -> some View { - if #available(iOS 16, macOS 13, *) { - self.scrollContentBackground(visibility) - } else { - self - } - } -} diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ClauseDataUnitTests.swift b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ClauseDataUnitTests.swift deleted file mode 100644 index 7123f4ff..00000000 --- a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ClauseDataUnitTests.swift +++ /dev/null @@ -1,54 +0,0 @@ -// -// ClauseDataUnitTests.swift -// KanaKanjiConverterModuleTests -// -// Created by ensan on 2022/12/30. -// Copyright © 2022 ensan. All rights reserved. -// - -@testable import KanaKanjiConverterModule -import XCTest - -final class ClauseDataUnitTests: XCTestCase { - func testMerge() throws { - do { - let unit1 = ClauseDataUnit() - unit1.text = "僕が" - unit1.inputRange = 0 ..< 3 - unit1.mid = 0 - unit1.nextLcid = 0 - - let unit2 = ClauseDataUnit() - unit2.text = "走る" - unit2.inputRange = 3 ..< 6 - unit2.mid = 1 - unit2.nextLcid = 1 - - unit1.merge(with: unit2) - XCTAssertEqual(unit1.text, "僕が走る") - XCTAssertEqual(unit1.inputRange, 0 ..< 6) - XCTAssertEqual(unit1.nextLcid, 1) - XCTAssertEqual(unit1.mid, 0) - } - - do { - let unit1 = ClauseDataUnit() - unit1.text = "君は" - unit1.inputRange = 0 ..< 3 - unit1.mid = 0 - unit1.nextLcid = 0 - - let unit2 = ClauseDataUnit() - unit2.text = "笑った" - unit2.inputRange = 3 ..< 7 - unit2.mid = 3 - unit2.nextLcid = 3 - - unit1.merge(with: unit2) - XCTAssertEqual(unit1.text, "君は笑った") - XCTAssertEqual(unit1.inputRange, 0 ..< 7) - XCTAssertEqual(unit1.nextLcid, 3) - XCTAssertEqual(unit1.mid, 0) - } - } -} diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ComposingTextTests.swift b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ComposingTextTests.swift deleted file mode 100644 index 440e6be7..00000000 --- a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ComposingTextTests.swift +++ /dev/null @@ -1,219 +0,0 @@ -// -// ComposingTextTests.swift -// KanaKanjiConverterModuleTests -// -// Created by ensan on 2022/12/18. -// Copyright © 2022 ensan. All rights reserved. -// - -@testable import KanaKanjiConverterModule -import XCTest - -final class ComposingTextTests: XCTestCase { - - func sequentialInput(_ composingText: inout ComposingText, sequence: String, inputStyle: InputStyle) { - for char in sequence { - composingText.insertAtCursorPosition(String(char), inputStyle: inputStyle) - } - } - - func testIsEmpty() throws { - var c = ComposingText() - XCTAssertTrue(c.isEmpty) - c.insertAtCursorPosition("あ", inputStyle: .direct) - XCTAssertFalse(c.isEmpty) - c.stopComposition() - XCTAssertTrue(c.isEmpty) - } - - func testInsertAtCursorPosition() throws { - // ダイレクト - do { - var c = ComposingText() - c.insertAtCursorPosition("あ", inputStyle: .direct) - XCTAssertEqual(c.input, [ComposingText.InputElement(character: "あ", inputStyle: .direct)]) - XCTAssertEqual(c.convertTarget, "あ") - XCTAssertEqual(c.convertTargetCursorPosition, 1) - - c.insertAtCursorPosition("ん", inputStyle: .direct) - XCTAssertEqual(c, ComposingText(convertTargetCursorPosition: 2, input: [.init(character: "あ", inputStyle: .direct), .init(character: "ん", inputStyle: .direct)], convertTarget: "あん")) - } - // ローマ字 - do { - let inputStyle = InputStyle.roman2kana - var c = ComposingText() - c.insertAtCursorPosition("a", inputStyle: inputStyle) - XCTAssertEqual(c.input, [ComposingText.InputElement(character: "a", inputStyle: inputStyle)]) - XCTAssertEqual(c.convertTarget, "あ") - XCTAssertEqual(c.convertTargetCursorPosition, 1) - - c.insertAtCursorPosition("k", inputStyle: inputStyle) - XCTAssertEqual(c, ComposingText(convertTargetCursorPosition: 2, input: [.init(character: "a", inputStyle: inputStyle), .init(character: "k", inputStyle: inputStyle)], convertTarget: "あk")) - - c.insertAtCursorPosition("i", inputStyle: inputStyle) - XCTAssertEqual(c, ComposingText(convertTargetCursorPosition: 2, input: [.init(character: "a", inputStyle: inputStyle), .init(character: "k", inputStyle: inputStyle), .init(character: "i", inputStyle: inputStyle)], convertTarget: "あき")) - } - // ローマ字で一気に入力 - do { - let inputStyle = InputStyle.roman2kana - var c = ComposingText() - c.insertAtCursorPosition("akafa", inputStyle: inputStyle) - XCTAssertEqual(c.input, [ - ComposingText.InputElement(character: "a", inputStyle: inputStyle), - ComposingText.InputElement(character: "k", inputStyle: inputStyle), - ComposingText.InputElement(character: "a", inputStyle: inputStyle), - ComposingText.InputElement(character: "f", inputStyle: inputStyle), - ComposingText.InputElement(character: "a", inputStyle: inputStyle) - ]) - XCTAssertEqual(c.convertTarget, "あかふぁ") - XCTAssertEqual(c.convertTargetCursorPosition, 4) - - } - // ローマ字の特殊ケース(促音) - do { - var c = ComposingText() - sequentialInput(&c, sequence: "itte", inputStyle: .roman2kana) - XCTAssertEqual(c.input, [ - ComposingText.InputElement(character: "i", inputStyle: .roman2kana), - ComposingText.InputElement(character: "っ", inputStyle: .direct), - ComposingText.InputElement(character: "t", inputStyle: .roman2kana), - ComposingText.InputElement(character: "e", inputStyle: .roman2kana) - ]) - XCTAssertEqual(c.convertTarget, "いって") - XCTAssertEqual(c.convertTargetCursorPosition, 3) - } - // ローマ字の特殊ケース(撥音) - do { - var c = ComposingText() - sequentialInput(&c, sequence: "anta", inputStyle: .roman2kana) - XCTAssertEqual(c.input, [ - ComposingText.InputElement(character: "a", inputStyle: .roman2kana), - ComposingText.InputElement(character: "ん", inputStyle: .direct), - ComposingText.InputElement(character: "t", inputStyle: .roman2kana), - ComposingText.InputElement(character: "a", inputStyle: .roman2kana) - ]) - XCTAssertEqual(c.convertTarget, "あんた") - XCTAssertEqual(c.convertTargetCursorPosition, 3) - } - // ミックス - do { - var c = ComposingText() - c.insertAtCursorPosition("a", inputStyle: .direct) - XCTAssertEqual(c.input, [ComposingText.InputElement(character: "a", inputStyle: .direct)]) - XCTAssertEqual(c.convertTarget, "a") - XCTAssertEqual(c.convertTargetCursorPosition, 1) - - c.insertAtCursorPosition("k", inputStyle: .roman2kana) - XCTAssertEqual(c, ComposingText(convertTargetCursorPosition: 2, input: [.init(character: "a", inputStyle: .direct), .init(character: "k", inputStyle: .roman2kana)], convertTarget: "ak")) - - c.insertAtCursorPosition("i", inputStyle: .roman2kana) - XCTAssertEqual(c, ComposingText(convertTargetCursorPosition: 2, input: [.init(character: "a", inputStyle: .direct), .init(character: "k", inputStyle: .roman2kana), .init(character: "i", inputStyle: .roman2kana)], convertTarget: "aき")) - } - } - - func testDeleteForward() throws { - // ダイレクト - do { - var c = ComposingText() - c.insertAtCursorPosition("あいうえお", inputStyle: .direct) // あいうえお| - _ = c.moveCursorFromCursorPosition(count: -3) // あい|うえお - // 「う」を消す - c.deleteForwardFromCursorPosition(count: 1) // あい|えお - XCTAssertEqual(c.input, [ - ComposingText.InputElement(character: "あ", inputStyle: .direct), - ComposingText.InputElement(character: "い", inputStyle: .direct), - ComposingText.InputElement(character: "え", inputStyle: .direct), - ComposingText.InputElement(character: "お", inputStyle: .direct) - ]) - XCTAssertEqual(c.convertTarget, "あいえお") - XCTAssertEqual(c.convertTargetCursorPosition, 2) - } - - // ローマ字(危険なケース) - do { - var c = ComposingText() - c.insertAtCursorPosition("akafa", inputStyle: .roman2kana) // あかふぁ| - _ = c.moveCursorFromCursorPosition(count: -1) // あかふ|ぁ - // 「ぁ」を消す - c.deleteForwardFromCursorPosition(count: 1) // あかふ - XCTAssertEqual(c.input, [ - ComposingText.InputElement(character: "a", inputStyle: .roman2kana), - ComposingText.InputElement(character: "k", inputStyle: .roman2kana), - ComposingText.InputElement(character: "a", inputStyle: .roman2kana), - ComposingText.InputElement(character: "ふ", inputStyle: .direct) - ]) - XCTAssertEqual(c.convertTarget, "あかふ") - XCTAssertEqual(c.convertTargetCursorPosition, 3) - } - - } - - func testIsRightSideValid() throws { - do { - var c = ComposingText() - c.insertAtCursorPosition("akafatta", inputStyle: .roman2kana) // あかふぁった| - XCTAssertTrue(ComposingText.isRightSideValid(lastElement: ComposingText.InputElement(character: "a", inputStyle: .roman2kana), convertTargetElements: [ComposingText.ConvertTargetElement(string: ["あ"], inputStyle: .roman2kana)], of: c.input, to: 1)) - XCTAssertFalse(ComposingText.isRightSideValid(lastElement: ComposingText.InputElement(character: "k", inputStyle: .roman2kana), convertTargetElements: [ComposingText.ConvertTargetElement(string: ["あ", "k"], inputStyle: .roman2kana)], of: c.input, to: 2)) - XCTAssertTrue(ComposingText.isRightSideValid(lastElement: ComposingText.InputElement(character: "a", inputStyle: .roman2kana), convertTargetElements: [ComposingText.ConvertTargetElement(string: ["あ", "か"], inputStyle: .roman2kana)], of: c.input, to: 3)) - XCTAssertFalse(ComposingText.isRightSideValid(lastElement: ComposingText.InputElement(character: "f", inputStyle: .roman2kana), convertTargetElements: [ComposingText.ConvertTargetElement(string: ["あ", "か", "f"], inputStyle: .roman2kana)], of: c.input, to: 4)) - XCTAssertTrue(ComposingText.isRightSideValid(lastElement: ComposingText.InputElement(character: "a", inputStyle: .roman2kana), convertTargetElements: [ComposingText.ConvertTargetElement(string: ["あ", "か", "ふ", "ぁ"], inputStyle: .roman2kana)], of: c.input, to: 5)) - // これはtrueにしている - XCTAssertTrue(ComposingText.isRightSideValid(lastElement: ComposingText.InputElement(character: "t", inputStyle: .roman2kana), convertTargetElements: [ComposingText.ConvertTargetElement(string: ["あ", "か", "ふ", "ぁ", "t"], inputStyle: .roman2kana)], of: c.input, to: 6)) - // これはfalse - XCTAssertFalse(ComposingText.isRightSideValid(lastElement: ComposingText.InputElement(character: "t", inputStyle: .roman2kana), convertTargetElements: [ComposingText.ConvertTargetElement(string: ["あ", "か", "ふ", "ぁ", "t", "t"], inputStyle: .roman2kana)], of: c.input, to: 7)) - XCTAssertTrue(ComposingText.isRightSideValid(lastElement: ComposingText.InputElement(character: "a", inputStyle: .roman2kana), convertTargetElements: [ComposingText.ConvertTargetElement(string: ["あ", "か", "ふ", "ぁ", "っ", "た"], inputStyle: .roman2kana)], of: c.input, to: 8)) - } - } - - func testGetConvertTargetIfRightSideIsValid() throws { - do { - var c = ComposingText() - c.insertAtCursorPosition("akafatta", inputStyle: .roman2kana) // あかふぁった| - XCTAssertEqual( - ComposingText.getConvertTargetIfRightSideIsValid( - lastElement: ComposingText.InputElement(character: "t", inputStyle: .roman2kana), - of: c.input, - to: 6, - convertTargetElements: [ComposingText.ConvertTargetElement(string: Array("あかふぁt"), inputStyle: .roman2kana)] - ), - Array("あかふぁっ") - ) - } - do { - var c = ComposingText() - c.insertAtCursorPosition("kintarou", inputStyle: .roman2kana) // きんたろう| - XCTAssertEqual( - ComposingText.getConvertTargetIfRightSideIsValid( - lastElement: ComposingText.InputElement(character: "n", inputStyle: .roman2kana), - of: c.input, - to: 3, - convertTargetElements: [ComposingText.ConvertTargetElement(string: Array("きn"), inputStyle: .roman2kana)] - ), - Array("きん") - ) - } - } - - func testDifferenceSuffix() throws { - do { - var c1 = ComposingText() - c1.insertAtCursorPosition("hasir", inputStyle: .roman2kana) - - var c2 = ComposingText() - c2.insertAtCursorPosition("hasiru", inputStyle: .roman2kana) - - XCTAssertEqual(c2.differenceSuffix(to: c1).deleted, 0) - XCTAssertEqual(c2.differenceSuffix(to: c1).addedCount, 1) - } - do { - var c1 = ComposingText() - c1.insertAtCursorPosition("tukatt", inputStyle: .roman2kana) - - var c2 = ComposingText() - c2.insertAtCursorPosition("tukatte", inputStyle: .roman2kana) - - XCTAssertEqual(c2.differenceSuffix(to: c1).deleted, 0) - XCTAssertEqual(c2.differenceSuffix(to: c1).addedCount, 1) - } - } -} diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ConverterTests/EmailAddressConversionTests.swift b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ConverterTests/EmailAddressConversionTests.swift deleted file mode 100644 index 056b3c8d..00000000 --- a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ConverterTests/EmailAddressConversionTests.swift +++ /dev/null @@ -1,57 +0,0 @@ -// -// EmailAddressConversionTests.swift -// azooKeyTests -// -// Created by ensan on 2022/12/26. -// Copyright © 2022 ensan. All rights reserved. -// - -@testable import KanaKanjiConverterModule -import XCTest - -final class EmailAddressConversionTests: XCTestCase { - func makeDirectInput(direct input: String) -> ComposingText { - ComposingText( - convertTargetCursorPosition: input.count, - input: input.map {.init(character: $0, inputStyle: .direct)}, - convertTarget: input - ) - } - - func testtoEmailAddressCandidates() throws { - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "azooKey@") - let result = converter.toEmailAddressCandidates(input) - XCTAssertFalse(result.isEmpty) - XCTAssertTrue(result.contains(where: {$0.text == "azooKey@gmail.com"})) - XCTAssertTrue(result.contains(where: {$0.text == "azooKey@icloud.com"})) - XCTAssertTrue(result.contains(where: {$0.text == "azooKey@yahoo.co.jp"})) - XCTAssertTrue(result.contains(where: {$0.text == "azooKey@i.softbank.jp"})) - } - - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "my.dev_az@") - let result = converter.toEmailAddressCandidates(input) - XCTAssertFalse(result.isEmpty) - XCTAssertTrue(result.contains(where: {$0.text == "my.dev_az@gmail.com"})) - XCTAssertTrue(result.contains(where: {$0.text == "my.dev_az@icloud.com"})) - XCTAssertTrue(result.contains(where: {$0.text == "my.dev_az@yahoo.co.jp"})) - XCTAssertTrue(result.contains(where: {$0.text == "my.dev_az@i.softbank.jp"})) - } - - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "@") - let result = converter.toEmailAddressCandidates(input) - XCTAssertFalse(result.isEmpty) - XCTAssertTrue(result.contains(where: {$0.text == "@gmail.com"})) - XCTAssertTrue(result.contains(where: {$0.text == "@icloud.com"})) - XCTAssertTrue(result.contains(where: {$0.text == "@yahoo.co.jp"})) - XCTAssertTrue(result.contains(where: {$0.text == "@i.softbank.jp"})) - } - - } - -} diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ConverterTests/UnicodeConversionTests.swift b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ConverterTests/UnicodeConversionTests.swift deleted file mode 100644 index ef60cabc..00000000 --- a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ConverterTests/UnicodeConversionTests.swift +++ /dev/null @@ -1,73 +0,0 @@ -// -// UnicodeConversionTests.swift -// azooKeyTests -// -// Created by ensan on 2022/12/29. -// Copyright © 2022 ensan. All rights reserved. -// - -@testable import KanaKanjiConverterModule -import XCTest - -final class UnicodeConversionTests: XCTestCase { - func makeDirectInput(direct input: String) -> ComposingText { - ComposingText( - convertTargetCursorPosition: input.count, - input: input.map {.init(character: $0, inputStyle: .direct)}, - convertTarget: input - ) - } - - func testFromUnicode() throws { - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "U+3042") - let result = converter.unicodeCandidates(input) - XCTAssertEqual(result.count, 1) - XCTAssertEqual(result[0].text, "あ") - } - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "U+1F607") - let result = converter.unicodeCandidates(input) - XCTAssertEqual(result.count, 1) - XCTAssertEqual(result[0].text, "😇") - } - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "u+3042") - let result = converter.unicodeCandidates(input) - XCTAssertEqual(result.count, 1) - XCTAssertEqual(result[0].text, "あ") - } - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "U3042") - let result = converter.unicodeCandidates(input) - XCTAssertEqual(result.count, 1) - XCTAssertEqual(result[0].text, "あ") - } - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "u3042") - let result = converter.unicodeCandidates(input) - XCTAssertEqual(result.count, 1) - XCTAssertEqual(result[0].text, "あ") - } - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "U+61") - let result = converter.unicodeCandidates(input) - XCTAssertEqual(result.count, 1) - XCTAssertEqual(result[0].text, "a") - } - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "U+189") - let result = converter.unicodeCandidates(input) - XCTAssertEqual(result.count, 1) - XCTAssertEqual(result[0].text, "Ɖ") - } - } - -} diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ConverterTests/WarekiConversionTests.swift b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ConverterTests/WarekiConversionTests.swift deleted file mode 100644 index f1b67c7a..00000000 --- a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/ConverterTests/WarekiConversionTests.swift +++ /dev/null @@ -1,167 +0,0 @@ -// -// WarekiConversionTests.swift -// azooKeyTests -// -// Created by ensan on 2022/12/22. -// Copyright © 2022 ensan. All rights reserved. -// - -@testable import KanaKanjiConverterModule -import XCTest - -final class WarekiConversionTests: XCTestCase { - func makeDirectInput(direct input: String) -> ComposingText { - ComposingText( - convertTargetCursorPosition: input.count, - input: input.map {.init(character: $0, inputStyle: .direct)}, - convertTarget: input - ) - } - - func testSeireki2Wareki() throws { - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "2019ねん") - let result = converter.toWarekiCandidates(input) - XCTAssertEqual(result.count, 2) - if result.count == 2 { - XCTAssertEqual(result[0].text, "令和元年") - XCTAssertEqual(result[1].text, "平成31年") - } - } - - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "2020ねん") - let result = converter.toWarekiCandidates(input) - XCTAssertEqual(result.count, 1) - if result.count == 1 { - XCTAssertEqual(result[0].text, "令和2年") - } - } - - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "2001ねん") - let result = converter.toWarekiCandidates(input) - XCTAssertEqual(result.count, 1) - if result.count == 1 { - XCTAssertEqual(result[0].text, "平成13年") - } - } - - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "1945ねん") - let result = converter.toWarekiCandidates(input) - XCTAssertEqual(result.count, 1) - if result.count == 1 { - XCTAssertEqual(result[0].text, "昭和20年") - } - } - - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "9999ねん") - let result = converter.toWarekiCandidates(input) - XCTAssertEqual(result.count, 1) - if result.count == 1 { - XCTAssertEqual(result[0].text, "令和7981年") - } - } - - // invalid cases - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "せいれき2001ねん") - let result = converter.toWarekiCandidates(input) - XCTAssertTrue(result.isEmpty) - } - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "1582ねん") - let result = converter.toWarekiCandidates(input) - XCTAssertTrue(result.isEmpty) - } - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "10000ねん") - let result = converter.toWarekiCandidates(input) - XCTAssertTrue(result.isEmpty) - } - - } - - func testWareki2Seireki() throws { - do { - let converter = KanaKanjiConverter() - let input = ComposingText( - convertTargetCursorPosition: 8, - input: "れいわがんねん".map {.init(character: $0, inputStyle: .direct)}, - convertTarget: "れいわがんねん" - ) - let result = converter.toSeirekiCandidates(input) - XCTAssertEqual(result.count, 1) - if result.count == 1 { - XCTAssertEqual(result[0].text, "2019年") - } - } - - do { - let converter = KanaKanjiConverter() - let input = ComposingText( - convertTargetCursorPosition: 8, - input: "れいわ1ねん".map {.init(character: $0, inputStyle: .direct)}, - convertTarget: "れいわ1ねん" - ) - let result = converter.toSeirekiCandidates(input) - XCTAssertEqual(result.count, 1) - if result.count == 1 { - XCTAssertEqual(result[0].text, "2019年") - } - } - - do { - let converter = KanaKanjiConverter() - let input = ComposingText( - convertTargetCursorPosition: 8, - input: "しょうわ25ねん".map {.init(character: $0, inputStyle: .direct)}, - convertTarget: "しょうわ25ねん" - ) - let result = converter.toSeirekiCandidates(input) - XCTAssertEqual(result.count, 1) - if result.count == 1 { - XCTAssertEqual(result[0].text, "1950年") - } - } - - do { - let converter = KanaKanjiConverter() - let input = ComposingText( - convertTargetCursorPosition: 8, - input: "めいじ9ねん".map {.init(character: $0, inputStyle: .direct)}, - convertTarget: "めいじ9ねん" - ) - let result = converter.toSeirekiCandidates(input) - XCTAssertEqual(result.count, 1) - if result.count == 1 { - XCTAssertEqual(result[0].text, "1876年") - } - } - - // invalid cases - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "れいわ100ねん") - let result = converter.toSeirekiCandidates(input) - XCTAssertTrue(result.isEmpty) - } - - do { - let converter = KanaKanjiConverter() - let input = makeDirectInput(direct: "けいおう5ねん") - let result = converter.toSeirekiCandidates(input) - XCTAssertTrue(result.isEmpty) - } - } -} diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/.gitkeep b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/cb/.gitkeep b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/cb/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/cb/1285.binary b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/cb/1285.binary deleted file mode 100644 index 20689c27..00000000 Binary files a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/cb/1285.binary and /dev/null differ diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/.gitkeep b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/charID.chid b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/charID.chid deleted file mode 100644 index ad2392bb..00000000 Binary files a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/charID.chid and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\267.louds" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\267.louds" deleted file mode 100644 index 96b251ca..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\267.louds" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\267.loudschars2" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\267.loudschars2" deleted file mode 100644 index 4a768a45..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\267.loudschars2" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2670.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2670.loudstxt3" deleted file mode 100644 index a6ddef09..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2670.loudstxt3" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2671.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2671.loudstxt3" deleted file mode 100644 index 8346252d..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2671.loudstxt3" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\26710.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\26710.loudstxt3" deleted file mode 100644 index 5fbdcf2d..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\26710.loudstxt3" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\26711.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\26711.loudstxt3" deleted file mode 100644 index 8f6916c2..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\26711.loudstxt3" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\26712.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\26712.loudstxt3" deleted file mode 100644 index 11c1a545..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\26712.loudstxt3" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\26713.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\26713.loudstxt3" deleted file mode 100644 index 214c0905..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\26713.loudstxt3" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2672.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2672.loudstxt3" deleted file mode 100644 index ce9fe545..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2672.loudstxt3" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2673.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2673.loudstxt3" deleted file mode 100644 index 5e9f2c40..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2673.loudstxt3" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2674.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2674.loudstxt3" deleted file mode 100644 index af12bfe6..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2674.loudstxt3" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2675.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2675.loudstxt3" deleted file mode 100644 index 98555dad..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2675.loudstxt3" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2676.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2676.loudstxt3" deleted file mode 100644 index af0e47b7..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2676.loudstxt3" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2677.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2677.loudstxt3" deleted file mode 100644 index bb251ead..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2677.loudstxt3" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2678.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2678.loudstxt3" deleted file mode 100644 index 7d21fe19..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2678.loudstxt3" and /dev/null differ diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2679.loudstxt3" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2679.loudstxt3" deleted file mode 100644 index 8f748463..00000000 Binary files "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/louds/\343\202\2679.loudstxt3" and /dev/null differ diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/mm.binary b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/mm.binary deleted file mode 100644 index cd75b67b..00000000 Binary files a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/mm.binary and /dev/null differ diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/p/.gitkeep b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/p/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/p/p_\343\202\267.csv" "b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/p/p_\343\202\267.csv" deleted file mode 100644 index a1e69637..00000000 --- "a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/DictionaryMock/p/p_\343\202\267.csv" +++ /dev/null @@ -1,50 +0,0 @@ -シカ,しか,257,257,268,-4.2795 -シカシ,しかし,555,555,282,-5.4644 -シカタ,仕方,1284,1284,468,-6.3727 -シゴト,仕事,1283,1283,290,-6.7303 -シタ,した,610,435,17,-5.8511 -シッ,知っ,786,786,427,-6.2581 -シテ,して,610,307,17,-5.1961 -シテイル,している,610,919,17,-6.8068 -シナ,死な,748,748,161,-4.9477 -シニ,死に,751,751,161,-4.9485 -シニャ,死にゃ,745,745,161,-4.9347 -シヌ,死ぬ,746,746,161,-4.9348 -シノ,死の,747,747,161,-4.9476 -シマイ,しまい,1273,1273,282,-4.1023 -シマウ,しまう,1253,1253,282,-4.0578 -シマエ,しまえ,1249,1249,47,-4.1475 -シマエ,しまえ,1265,1265,47,-4.1502 -シマオ,しまお,1257,1257,78,-4.1498 -シマッ,しまっ,1269,1269,282,-4.0663 -シマワ,しまわ,1261,1261,268,-4.1497 -シメサ,示さ,733,733,481,-6.6955 -シメシ,示し,735,735,481,-6.7511 -シメシャ,示しゃ,730,730,481,-6.6753 -シメス,示す,731,731,481,-6.6789 -シメセ,示せ,729,729,481,-6.6685 -シメセ,示せ,734,734,481,-6.6744 -シメソ,示そ,732,732,481,-6.6763 -シモ,しも,333,333,437,-6.1361 -シャ,しゃ,878,878,331,-6.2638 -ショ,しょ,603,603,331,-3.0303 -シヨ,しよ,603,603,78,-3.0235 -シヨウ,使用,1283,1283,375,-6.8956 -シラ,知ら,780,780,441,-6.1623 -シリ,知り,788,788,427,-6.3249 -シリャ,知りゃ,770,770,438,-6.3237 -シル,知る,772,772,438,-6.2017 -シレ,知れ,784,784,438,-6.3237 -シレ,知れ,768,768,438,-6.3238 -シレ,しれ,622,622,268,-6.6306 -シレ,しれ,625,625,268,-6.8119 -シレヨ,しれよ,624,624,501,-6.8937 -シレリャ,しれりゃ,618,618,501,-6.8749 -シレレ,しれれ,617,617,501,-6.8950 -シレロ,しれろ,623,623,501,-6.8939 -シレン,しれん,620,620,501,-6.8940 -シロ,しろ,608,608,437,-2.6815 -シロ,知ろ,778,778,438,-6.3241 -シン,死ん,750,750,292,-4.9321 -シン,知ん,782,782,438,-6.3238 -シン,知ん,774,774,438,-6.3238 \ No newline at end of file diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/JapaneseNumberConversionTests.swift b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/JapaneseNumberConversionTests.swift deleted file mode 100644 index 533a595b..00000000 --- a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/JapaneseNumberConversionTests.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// JapaneseNumberConversionTests.swift -// KanaKanjiConverterModuleTests -// -// Created by ensan on 2023/04/18. -// Copyright © 2023 ensan. All rights reserved. -// - -@testable import KanaKanjiConverterModule -import XCTest - -final class JapaneseNumberConversionTests: XCTestCase { - func testJapaneseNumberConversion() throws { - let dicdataStore = DicdataStore() - do { - let result = dicdataStore.getJapaneseNumberDicdata(head: "イチマン") - XCTAssertEqual(result.count, 2) - XCTAssertTrue(result.contains(where: {$0.word == "一万"})) - XCTAssertTrue(result.contains(where: {$0.word == "10000"})) - } - do { - let result = dicdataStore.getJapaneseNumberDicdata(head: "ニオクロクセンヨンヒャクマンキュウ") - XCTAssertEqual(result.count, 2) - XCTAssertTrue(result.contains(where: {$0.word == "二億六千四百万九"})) - XCTAssertTrue(result.contains(where: {$0.word == "264000009"})) - } - do { - XCTAssertEqual(dicdataStore.getJapaneseNumberDicdata(head: "マルマン").count, 0) - XCTAssertEqual(dicdataStore.getJapaneseNumberDicdata(head: "アマン").count, 0) - XCTAssertEqual(dicdataStore.getJapaneseNumberDicdata(head: "イチリン").count, 0) - XCTAssertEqual(dicdataStore.getJapaneseNumberDicdata(head: "ニムリョウタイスウサンガイ").count, 0) - } - } -} diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/KanaKanjiConverterModuleTests.swift b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/KanaKanjiConverterModuleTests.swift deleted file mode 100644 index 9e7fb843..00000000 --- a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/KanaKanjiConverterModuleTests.swift +++ /dev/null @@ -1,10 +0,0 @@ -@testable import KanaKanjiConverterModule -import XCTest - -final class KanaKanjiConverterModuleTests: XCTestCase { - func testExample() throws { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct - // results. - } -} diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/LOUDSTests.swift b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/LOUDSTests.swift deleted file mode 100644 index f2143791..00000000 --- a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/LOUDSTests.swift +++ /dev/null @@ -1,48 +0,0 @@ -// -// LOUDSTests.swift -// KanaKanjiConverterModuleTests -// -// Created by ensan on 2023/02/02. -// Copyright © 2023 ensan. All rights reserved. -// - -@testable import KanaKanjiConverterModule -import XCTest - -final class LOUDSTests: XCTestCase { - static var resourceURL = Bundle.module.resourceURL!.standardizedFileURL.appendingPathComponent("DictionaryMock", isDirectory: true) - func requestOptions() -> ConvertRequestOptions { - var options: ConvertRequestOptions = .default - options.dictionaryResourceURL = Self.resourceURL - return options - } - - func loadCharIDs() -> [Character: UInt8] { - do { - let string = try String(contentsOf: Self.resourceURL.appendingPathComponent("louds/charID.chid", isDirectory: false), encoding: String.Encoding.utf8) - return [Character: UInt8](uniqueKeysWithValues: string.enumerated().map {($0.element, UInt8($0.offset))}) - } catch { - print("ファイルが見つかりませんでした") - return [:] - } - } - - func testSearchNodeIndex() throws { - // データリソースの場所を指定する - print("Options: ", requestOptions()) - let louds = LOUDS.load("シ", option: requestOptions()) - XCTAssertNotNil(louds) - guard let louds else { return } - let charIDs = loadCharIDs() - let key = "シカイ" - let chars = key.map {charIDs[$0, default: .max]} - let index = louds.searchNodeIndex(chars: chars) - XCTAssertNotNil(index) - guard let index else { return } - - let dicdata: [DicdataElement] = LOUDS.getDataForLoudstxt3("シ" + "\(index >> 11)", indices: [index & 2047], option: requestOptions()) - XCTAssertTrue(dicdata.contains {$0.word == "司会"}) - XCTAssertTrue(dicdata.contains {$0.word == "視界"}) - XCTAssertTrue(dicdata.contains {$0.word == "死界"}) - } -} diff --git a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/RegisteredNodeTests.swift b/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/RegisteredNodeTests.swift deleted file mode 100644 index 54aabda3..00000000 --- a/AzooKeyCore/Tests/KanaKanjiConverterModuleTests/RegisteredNodeTests.swift +++ /dev/null @@ -1,78 +0,0 @@ -// -// RegisteredNodeTests.swift -// KanaKanjiConverterModuleTests -// -// Created by ensan on 2023/01/31. -// Copyright © 2023 ensan. All rights reserved. -// - -@testable import KanaKanjiConverterModule -import XCTest - -final class RegisteredNodeTests: XCTestCase { - func testBOSNode() throws { - let bos = RegisteredNode.BOSNode() - XCTAssertEqual(bos.inputRange, 0..<0) - XCTAssertNil(bos.prev) - XCTAssertEqual(bos.totalValue, 0) - XCTAssertEqual(bos.data.rcid, CIDData.BOS.cid) - } - - func testFromLastCandidate() throws { - let candidate = Candidate(text: "我輩は猫", value: -20, correspondingCount: 7, lastMid: 100, data: [DicdataElement(word: "我輩は猫", ruby: "ワガハイハネコ", cid: CIDData.一般名詞.cid, mid: 100, value: -20)]) - let bos = RegisteredNode.fromLastCandidate(candidate) - XCTAssertEqual(bos.inputRange, 0..<0) - XCTAssertNil(bos.prev) - XCTAssertEqual(bos.totalValue, 0) - XCTAssertEqual(bos.data.rcid, CIDData.一般名詞.cid) - XCTAssertEqual(bos.data.mid, 100) - } - - func testGetCandidateData() throws { - let bos = RegisteredNode.BOSNode() - let node1 = RegisteredNode( - data: DicdataElement(word: "我輩", ruby: "ワガハイ", cid: CIDData.一般名詞.cid, mid: 1, value: -5), - registered: bos, - totalValue: -10, - inputRange: 0..<4 - ) - let node2 = RegisteredNode( - data: DicdataElement(word: "は", ruby: "ハ", cid: CIDData.係助詞ハ.cid, mid: 2, value: -2), - registered: node1, - totalValue: -13, - inputRange: 4..<5 - ) - let node3 = RegisteredNode( - data: DicdataElement(word: "猫", ruby: "ネコ", cid: CIDData.一般名詞.cid, mid: 3, value: -4), - registered: node2, - totalValue: -20, - inputRange: 5..<7 - ) - let node4 = RegisteredNode( - data: DicdataElement(word: "です", ruby: "デス", cid: CIDData.助動詞デス基本形.cid, mid: 4, value: -3), - registered: node3, - totalValue: -25, - inputRange: 7..<9 - ) - let result = node4.getCandidateData() - let clause1 = ClauseDataUnit() - clause1.text = "我輩は" - clause1.nextLcid = CIDData.一般名詞.cid - clause1.inputRange = 0..<5 - clause1.mid = 1 - - let clause2 = ClauseDataUnit() - clause2.text = "猫です" - clause2.nextLcid = CIDData.EOS.cid - clause2.inputRange = 5..<9 - clause2.mid = 3 - - let expectedResult: CandidateData = CandidateData( - clauses: [(clause1, -13), (clause2, -25)], - data: [node1.data, node2.data, node3.data, node4.data] - ) - XCTAssertEqual(result.data, expectedResult.data) - XCTAssertEqual(result.clauses.map {$0.value}, expectedResult.clauses.map {$0.value}) - XCTAssertEqual(result.clauses.map {$0.clause}, expectedResult.clauses.map {$0.clause}) - } -} diff --git a/AzooKeyCore/Tests/KeyboardExtensionUtilsTests/DisplayedTextManagerTests.swift b/AzooKeyCore/Tests/KeyboardExtensionUtilsTests/DisplayedTextManagerTests.swift new file mode 100644 index 00000000..7fdc8c46 --- /dev/null +++ b/AzooKeyCore/Tests/KeyboardExtensionUtilsTests/DisplayedTextManagerTests.swift @@ -0,0 +1,42 @@ +@testable import KeyboardExtensionUtils +import KanaKanjiConverterModule +import XCTest + +final class KeyboardExtensionUtils: XCTestCase { + @MainActor + func testOperation() throws { + let manager = DisplayedTextManager(isLiveConversionEnabled: false, isMarkedTextEnabled: false) + var composingText = ComposingText() + + let mockProxy = MockTextDocumentProxy() + manager.setTextDocumentProxy(.mainProxy(mockProxy)) + + composingText.insertAtCursorPosition("a", inputStyle: .direct) + manager.updateComposingText(composingText: composingText, newLiveConversionText: nil) + XCTAssertEqual(manager.composingText, composingText) + XCTAssertEqual(mockProxy.documentContextBeforeInput, "a") + print("Here1") + composingText.insertAtCursorPosition("b", inputStyle: .direct) + manager.updateComposingText(composingText: composingText, newLiveConversionText: nil) + XCTAssertEqual(manager.composingText, composingText) + XCTAssertEqual(mockProxy.documentContextBeforeInput, "ab") + print("Here2") + let _ = composingText.moveCursorFromCursorPosition(count: -1) + manager.updateComposingText(composingText: composingText, newLiveConversionText: nil) + XCTAssertEqual(manager.composingText, composingText) + XCTAssertEqual(mockProxy.documentContextBeforeInput, "a") + XCTAssertEqual(mockProxy.documentContextAfterInput, "b") + print("Here3") + composingText.deleteBackwardFromCursorPosition(count: 1) + manager.updateComposingText(composingText: composingText, newLiveConversionText: nil) + XCTAssertEqual(manager.composingText, composingText) + XCTAssertEqual(mockProxy.documentContextBeforeInput, "") + XCTAssertEqual(mockProxy.documentContextAfterInput, "b") + + let _ = composingText.moveCursorFromCursorPosition(count: 1) + manager.updateComposingText(composingText: composingText, newLiveConversionText: nil) + XCTAssertEqual(manager.composingText, composingText) + XCTAssertEqual(mockProxy.documentContextBeforeInput, "b") + XCTAssertEqual(mockProxy.documentContextAfterInput, "") + } +} diff --git a/AzooKeyCore/Tests/KeyboardExtensionUtilsTests/MockTextDocumentProxy.swift b/AzooKeyCore/Tests/KeyboardExtensionUtilsTests/MockTextDocumentProxy.swift new file mode 100644 index 00000000..27016751 --- /dev/null +++ b/AzooKeyCore/Tests/KeyboardExtensionUtilsTests/MockTextDocumentProxy.swift @@ -0,0 +1,66 @@ +import UIKit + +final class MockTextDocumentProxy: NSObject, UITextDocumentProxy { + var documentContextBeforeInput: String? { + let prefix = utf16String.prefix(utf16CursorRange.startPosition) + return String(utf16CodeUnits: Array(prefix), count: prefix.count) + } + + var documentContextAfterInput: String? { + let suffix = utf16String.dropFirst(utf16CursorRange.startPosition + utf16CursorRange.length) + return String(utf16CodeUnits: Array(suffix), count: suffix.count) + } + + var selectedText: String? { + if utf16CursorRange.length == 0 { + return nil + } else { + return String(utf16CodeUnits: Array(utf16String[utf16CursorRange.startPosition ..< utf16CursorRange.startPosition + utf16CursorRange.length]), count: utf16CursorRange.length) + } + } + + var documentInputMode: UITextInputMode? = nil + + var documentIdentifier: UUID = UUID() + + var utf16CursorRange = (startPosition: 0, length: 0) + var utf16String: [UInt16] = [] + + func adjustTextPosition(byCharacterOffset offset: Int) { + if utf16CursorRange.length != 0 { + utf16CursorRange = (utf16CursorRange.startPosition + utf16CursorRange.length, 0) + } else { + utf16CursorRange.startPosition += offset + utf16CursorRange.startPosition = max(min(utf16CursorRange.startPosition, utf16String.endIndex), 0) + } + } + + func setMarkedText(_ markedText: String, selectedRange: NSRange) { + // do nothing + } + + func unmarkText() { + // do nothing + } + + var hasText: Bool { + utf16String.isEmpty + } + + func insertText(_ text: String) { + if utf16CursorRange.length != 0 { + utf16String.removeSubrange(utf16CursorRange.startPosition ..< utf16CursorRange.startPosition + utf16CursorRange.length) + utf16CursorRange.length = 0 + } + utf16String.insert(contentsOf: text.utf16, at: utf16CursorRange.startPosition) + utf16CursorRange.startPosition += text.utf16.count + } + + func deleteBackward() { + if utf16CursorRange.startPosition == 0 { + return + } + utf16String.remove(at: utf16CursorRange.startPosition - 1) + utf16CursorRange.startPosition -= 1 + } +} diff --git a/AzooKeyCore/Tests/SwiftUtilsTests/AppVersionTests.swift b/AzooKeyCore/Tests/SwiftUtilsTests/AppVersionTests.swift deleted file mode 100644 index b8374ca6..00000000 --- a/AzooKeyCore/Tests/SwiftUtilsTests/AppVersionTests.swift +++ /dev/null @@ -1,57 +0,0 @@ -// -// AppVersionTests.swift -// azooKeyTests -// -// Created by ensan on 2022/12/19. -// Copyright © 2022 ensan. All rights reserved. -// - -@testable import SwiftUtils -import XCTest - -final class AppVersionTests: XCTestCase { - - func testInitFromString() throws { - do { - let version = AppVersion("1.9.3") - XCTAssertNotNil(version) - XCTAssertEqual(version!.majorVersion, 1) - XCTAssertEqual(version!.minorVersion, 9) - XCTAssertEqual(version!.patchVersion, 3) - } - do { - let version = AppVersion("1.10") - XCTAssertNotNil(version) - XCTAssertEqual(version!.majorVersion, 1) - XCTAssertEqual(version!.minorVersion, 10) - XCTAssertEqual(version!.patchVersion, 0) - } - do { - let version = AppVersion("1") - XCTAssertNotNil(version) - XCTAssertEqual(version!.majorVersion, 1) - XCTAssertEqual(version!.minorVersion, 0) - XCTAssertEqual(version!.patchVersion, 0) - } - do { - let version = AppVersion("X") - XCTAssertNil(version) - } - } - - func testComparable() throws { - XCTAssertTrue(AppVersion("1.9.1")! < AppVersion("1.10")!) - XCTAssertTrue(AppVersion("1.7")! < AppVersion("1.7.1")!) - XCTAssertTrue(AppVersion("1.10")! < AppVersion("2.1")!) - XCTAssertFalse(AppVersion("1.9.1")! < AppVersion("1.9.1")!) - XCTAssertFalse(AppVersion("2.5")! < AppVersion("2.4.9")!) - - XCTAssertTrue(AppVersion("2.5")! > AppVersion("2.4.9")!) - XCTAssertTrue(AppVersion("3.1")! > AppVersion("1.4.9")!) - XCTAssertFalse(AppVersion("1.9.1")! > AppVersion("1.9.1")!) - XCTAssertFalse(AppVersion("1.9.1")! > AppVersion("1.10")!) - XCTAssertFalse(AppVersion("1.7")! > AppVersion("1.7.1")!) - XCTAssertFalse(AppVersion("1.10")! > AppVersion("2.1")!) - } - -} diff --git a/AzooKeyCore/Tests/SwiftUtilsTests/CharacterUtilsTests.swift b/AzooKeyCore/Tests/SwiftUtilsTests/CharacterUtilsTests.swift deleted file mode 100644 index 72d099d7..00000000 --- a/AzooKeyCore/Tests/SwiftUtilsTests/CharacterUtilsTests.swift +++ /dev/null @@ -1,192 +0,0 @@ -// -// CharacterUtilsTests.swift -// KanaKanjiConverterModuleTests -// -// Created by ensan on 2022/12/18. -// Copyright © 2022 ensan. All rights reserved. -// - -@testable import SwiftUtils -import XCTest - -final class CharacterUtilsTests: XCTestCase { - - func testIsKogana() throws { - XCTAssertTrue(CharacterUtils.isKogana("ぁ")) - XCTAssertTrue(CharacterUtils.isKogana("ヵ")) - XCTAssertTrue(CharacterUtils.isKogana("ッ")) - XCTAssertTrue(CharacterUtils.isKogana("ヮ")) - XCTAssertTrue(CharacterUtils.isKogana("ゎ")) - - XCTAssertFalse(CharacterUtils.isKogana("あ")) - XCTAssertFalse(CharacterUtils.isKogana("カ")) - XCTAssertFalse(CharacterUtils.isKogana("a")) - XCTAssertFalse(CharacterUtils.isKogana("!")) - } - - func testIsRomanLetter() throws { - XCTAssertTrue(CharacterUtils.isRomanLetter("a")) - XCTAssertTrue(CharacterUtils.isRomanLetter("A")) - XCTAssertTrue(CharacterUtils.isRomanLetter("b")) - - XCTAssertFalse(CharacterUtils.isRomanLetter("ぁ")) - XCTAssertFalse(CharacterUtils.isRomanLetter("'")) - XCTAssertFalse(CharacterUtils.isRomanLetter("あ")) - XCTAssertFalse(CharacterUtils.isRomanLetter("カ")) - XCTAssertFalse(CharacterUtils.isRomanLetter("!")) - } - - func testIsDakuten() throws { - XCTAssertTrue(CharacterUtils.isDakuten("が")) - XCTAssertTrue(CharacterUtils.isDakuten("ば")) - XCTAssertTrue(CharacterUtils.isDakuten("ダ")) - XCTAssertTrue(CharacterUtils.isDakuten("ヴ")) - XCTAssertTrue(CharacterUtils.isDakuten("ゔ")) - - XCTAssertFalse(CharacterUtils.isDakuten("ぱ")) - XCTAssertFalse(CharacterUtils.isDakuten("あ")) - XCTAssertFalse(CharacterUtils.isDakuten("a")) - XCTAssertFalse(CharacterUtils.isDakuten("!")) - XCTAssertFalse(CharacterUtils.isDakuten("ん")) - } - - func testIsHandakuten() throws { - XCTAssertTrue(CharacterUtils.isHandakuten("ぱ")) - XCTAssertTrue(CharacterUtils.isHandakuten("パ")) - XCTAssertTrue(CharacterUtils.isHandakuten("プ")) - XCTAssertTrue(CharacterUtils.isHandakuten("ぽ")) - XCTAssertTrue(CharacterUtils.isHandakuten("ペ")) - - XCTAssertFalse(CharacterUtils.isHandakuten("ば")) - XCTAssertFalse(CharacterUtils.isHandakuten("が")) - XCTAssertFalse(CharacterUtils.isHandakuten("a")) - XCTAssertFalse(CharacterUtils.isHandakuten("!")) - XCTAssertFalse(CharacterUtils.isHandakuten("ん")) - } - - func testKogaki() throws { - XCTAssertEqual(CharacterUtils.kogaki("あ"), "ぁ") - XCTAssertEqual(CharacterUtils.kogaki("カ"), "ヵ") - XCTAssertEqual(CharacterUtils.kogaki("ワ"), "ヮ") - - // そのままの場合もある - XCTAssertEqual(CharacterUtils.kogaki("ん"), "ん") - XCTAssertEqual(CharacterUtils.kogaki("漢"), "漢") - XCTAssertEqual(CharacterUtils.kogaki("A"), "A") - } - - func testOgaki() throws { - XCTAssertEqual(CharacterUtils.ogaki("ぁ"), "あ") - XCTAssertEqual(CharacterUtils.ogaki("ヵ"), "カ") - XCTAssertEqual(CharacterUtils.ogaki("ヮ"), "ワ") - - // そのままの場合もある - XCTAssertEqual(CharacterUtils.ogaki("ん"), "ん") - XCTAssertEqual(CharacterUtils.ogaki("漢"), "漢") - XCTAssertEqual(CharacterUtils.ogaki("A"), "A") - } - - func testDakuten() throws { - XCTAssertEqual(CharacterUtils.dakuten("か"), "が") - XCTAssertEqual(CharacterUtils.dakuten("う"), "ゔ") - XCTAssertEqual(CharacterUtils.dakuten("ホ"), "ボ") - // 「へ」はひらがな、カタカナの判別が難しいので、厳密にやる - XCTAssertEqual(CharacterUtils.dakuten(("へ" as Character).toHiragana()), ("べ" as Character).toHiragana()) - XCTAssertEqual(CharacterUtils.dakuten(("へ" as Character).toKatakana()), ("べ" as Character).toKatakana()) - - // そのままの場合もある - XCTAssertEqual(CharacterUtils.dakuten("パ"), "パ") - XCTAssertEqual(CharacterUtils.dakuten("漢"), "漢") - XCTAssertEqual(CharacterUtils.dakuten("A"), "A") - } - - func testMudakuten() throws { - XCTAssertEqual(CharacterUtils.mudakuten("が"), "か") - XCTAssertEqual(CharacterUtils.mudakuten("ゔ"), "う") - XCTAssertEqual(CharacterUtils.mudakuten("ボ"), "ホ") - // 「へ」はひらがな、カタカナの判別が難しいので、厳密にやる - XCTAssertEqual(CharacterUtils.mudakuten(("べ" as Character).toHiragana()), ("へ" as Character).toHiragana()) - XCTAssertEqual(CharacterUtils.mudakuten(("べ" as Character).toKatakana()), ("へ" as Character).toKatakana()) - - // そのままの場合もある - XCTAssertEqual(CharacterUtils.mudakuten("パ"), "パ") - XCTAssertEqual(CharacterUtils.mudakuten("漢"), "漢") - XCTAssertEqual(CharacterUtils.mudakuten("A"), "A") - } - - func testHandakuten() throws { - XCTAssertEqual(CharacterUtils.handakuten("は"), "ぱ") - XCTAssertEqual(CharacterUtils.handakuten("ホ"), "ポ") - // 「へ」はひらがな、カタカナの判別が難しいので、厳密にやる - XCTAssertEqual(CharacterUtils.handakuten(("へ" as Character).toHiragana()), ("ぺ" as Character).toHiragana()) - XCTAssertEqual(CharacterUtils.handakuten(("へ" as Character).toKatakana()), ("ぺ" as Character).toKatakana()) - - // そのままの場合もある - XCTAssertEqual(CharacterUtils.handakuten("バ"), "バ") - XCTAssertEqual(CharacterUtils.handakuten("漢"), "漢") - XCTAssertEqual(CharacterUtils.handakuten("A"), "A") - } - - func testMuhandakuten() throws { - XCTAssertEqual(CharacterUtils.muhandakuten("ぱ"), "は") - XCTAssertEqual(CharacterUtils.muhandakuten("ポ"), "ホ") - // 「へ」はひらがな、カタカナの判別が難しいので、厳密にやる - XCTAssertEqual(CharacterUtils.muhandakuten(("ぺ" as Character).toHiragana()), ("へ" as Character).toHiragana()) - XCTAssertEqual(CharacterUtils.muhandakuten(("ぺ" as Character).toKatakana()), ("へ" as Character).toKatakana()) - - // そのままの場合もある - XCTAssertEqual(CharacterUtils.muhandakuten("バ"), "バ") - XCTAssertEqual(CharacterUtils.muhandakuten("漢"), "漢") - XCTAssertEqual(CharacterUtils.muhandakuten("A"), "A") - } - - func testToHiragana() throws { - XCTAssertEqual(("ハ" as Character).toHiragana(), "は") - XCTAssertEqual(("ヴ" as Character).toHiragana(), "ゔ") - XCTAssertEqual(("ン" as Character).toHiragana(), "ん") - XCTAssertEqual(("ァ" as Character).toHiragana(), "ぁ") - - // そのままの場合もある - XCTAssertEqual(("漢" as Character).toHiragana(), "漢") - XCTAssertEqual(("あ" as Character).toHiragana(), "あ") - XCTAssertEqual(("A" as Character).toHiragana(), "A") - } - - func testToKatakana() throws { - XCTAssertEqual(("は" as Character).toKatakana(), "ハ") - XCTAssertEqual(("ゔ" as Character).toKatakana(), "ヴ") - XCTAssertEqual(("ん" as Character).toKatakana(), "ン") - XCTAssertEqual(("ぁ" as Character).toKatakana(), "ァ") - - // そのままの場合もある - XCTAssertEqual(("漢" as Character).toKatakana(), "漢") - XCTAssertEqual(("ア" as Character).toKatakana(), "ア") - XCTAssertEqual(("A" as Character).toKatakana(), "A") - XCTAssertEqual(("😇" as Character).toKatakana(), "😇") - } - - func testRequestChange() throws { - XCTAssertEqual(CharacterUtils.requestChange("あ"), "ぁ") - XCTAssertEqual(CharacterUtils.requestChange("ぁ"), "あ") - XCTAssertEqual(CharacterUtils.requestChange("か"), "が") - XCTAssertEqual(CharacterUtils.requestChange("が"), "か") - XCTAssertEqual(CharacterUtils.requestChange("つ"), "っ") - XCTAssertEqual(CharacterUtils.requestChange("っ"), "づ") - XCTAssertEqual(CharacterUtils.requestChange("づ"), "つ") - XCTAssertEqual(CharacterUtils.requestChange("は"), "ば") - XCTAssertEqual(CharacterUtils.requestChange("ば"), "ぱ") - XCTAssertEqual(CharacterUtils.requestChange("ぱ"), "は") - - XCTAssertEqual(CharacterUtils.requestChange("a"), "A") - XCTAssertEqual(CharacterUtils.requestChange("A"), "a") - - XCTAssertEqual(CharacterUtils.requestChange("Π"), "π") - XCTAssertEqual(CharacterUtils.requestChange("π"), "Π") - - // そのままの場合もある - XCTAssertEqual(CharacterUtils.requestChange("バ"), "バ") - XCTAssertEqual(CharacterUtils.requestChange("漢"), "漢") - XCTAssertEqual(CharacterUtils.requestChange("。"), "。") - } - -} diff --git a/AzooKeyCore/Tests/SwiftUtilsTests/StringExtensionTests.swift b/AzooKeyCore/Tests/SwiftUtilsTests/StringExtensionTests.swift deleted file mode 100644 index 728c780e..00000000 --- a/AzooKeyCore/Tests/SwiftUtilsTests/StringExtensionTests.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// StringExtensionTests.swift -// azooKeyTests -// -// Created by ensan on 2022/12/23. -// Copyright © 2022 ensan. All rights reserved. -// - -@testable import SwiftUtils -import XCTest - -final class StringExtensionTests: XCTestCase { - - func testToKatakana() throws { - XCTAssertEqual("かゔぁあーんじょ123+++リスク".toKatakana(), "カヴァアーンジョ123+++リスク") - XCTAssertEqual("".toKatakana(), "") - XCTAssertEqual("コレハロン".toKatakana(), "コレハロン") - } - - func testToHiragana() throws { - XCTAssertEqual("カヴァアーンじょ123+++リスク".toHiragana(), "かゔぁあーんじょ123+++りすく") - XCTAssertEqual("".toHiragana(), "") - XCTAssertEqual("これはろん".toHiragana(), "これはろん") - } - - func testIndexFromStart() throws { - do { - let string = "ア❤️‍🔥ウ😇オ" - XCTAssertEqual(string[string.indexFromStart(3)], "😇") - XCTAssertEqual(string[string.indexFromStart(4)], "オ") - } - } - -} diff --git a/AzooKeyCore/Tests/SwiftUtilsTests/StringUtilsTests.swift b/AzooKeyCore/Tests/SwiftUtilsTests/StringUtilsTests.swift deleted file mode 100644 index 44876572..00000000 --- a/AzooKeyCore/Tests/SwiftUtilsTests/StringUtilsTests.swift +++ /dev/null @@ -1,91 +0,0 @@ -// -// StringUtilsTests.swift -// KanaKanjiConverterModuleTests -// -// Created by ensan on 2022/12/18. -// Copyright © 2022 ensan. All rights reserved. -// - -@testable import SwiftUtils -import XCTest - -final class StringTests: XCTestCase { - - func testIsKana() throws { - XCTAssertTrue("あ".isKana) - XCTAssertTrue("ぁ".isKana) - XCTAssertTrue("ン".isKana) - XCTAssertTrue("ァ".isKana) - XCTAssertTrue("が".isKana) - XCTAssertTrue("ゔ".isKana) - - XCTAssertFalse("k".isKana) - XCTAssertFalse("@".isKana) - XCTAssertFalse("カ".isKana) // 半角カタカナはカナ扱いしない - } - - func testOnlyRomanAlphabetOrNumber() throws { - XCTAssertTrue("and13".onlyRomanAlphabetOrNumber) - XCTAssertTrue("vmaoNFIU".onlyRomanAlphabetOrNumber) - XCTAssertTrue("1332".onlyRomanAlphabetOrNumber) - - // 文字がない場合はfalse - XCTAssertFalse("".onlyRomanAlphabetOrNumber) - XCTAssertFalse("and 13".onlyRomanAlphabetOrNumber) - XCTAssertFalse("can't".onlyRomanAlphabetOrNumber) - XCTAssertFalse("Mt.".onlyRomanAlphabetOrNumber) - } - - func testOnlyRomanAlphabet() throws { - XCTAssertTrue("vmaoNFIU".onlyRomanAlphabet) - XCTAssertTrue("NAO".onlyRomanAlphabet) - - // 文字がない場合はfalse - XCTAssertFalse("".onlyRomanAlphabet) - XCTAssertFalse("and 13".onlyRomanAlphabet) - XCTAssertFalse("can't".onlyRomanAlphabet) - XCTAssertFalse("Mt.".onlyRomanAlphabet) - XCTAssertFalse("and13".onlyRomanAlphabet) - XCTAssertFalse("vmaoNFIU83942".onlyRomanAlphabet) - } - - func testContainsRomanAlphabet() throws { - XCTAssertTrue("vmaoNFIU".containsRomanAlphabet) - XCTAssertTrue("変数x".containsRomanAlphabet) - XCTAssertTrue("and 13".containsRomanAlphabet) - XCTAssertTrue("can't".containsRomanAlphabet) - XCTAssertTrue("Mt.".containsRomanAlphabet) - XCTAssertTrue("(^v^)".containsRomanAlphabet) - - // 文字がない場合はfalse - XCTAssertFalse("".containsRomanAlphabet) - XCTAssertFalse("!?!?".containsRomanAlphabet) - XCTAssertFalse("(^_^)".containsRomanAlphabet) - XCTAssertFalse("問題ア".containsRomanAlphabet) - } - - func testIsEnglishSentence() throws { - XCTAssertTrue("Is this an English sentence?".isEnglishSentence) - XCTAssertTrue("English sentences can include symbols like '!?/\\=-+^`{}()[].".isEnglishSentence) - - // 文字がない場合はfalse - XCTAssertFalse("".isEnglishSentence) - XCTAssertFalse("The word '変数' is not an English word.".isEnglishSentence) - XCTAssertFalse("これは完全に日本語の文章です".isEnglishSentence) - } - - func testToKatakana() throws { - XCTAssertEqual("あいうえお".toKatakana(), "アイウエオ") - XCTAssertEqual("これは日本語の文章です".toKatakana(), "コレハ日本語ノ文章デス") - XCTAssertEqual("えモじ😇".toKatakana(), "エモジ😇") - } - - func testToHiragana() throws { - XCTAssertEqual("アイウエオ".toHiragana(), "あいうえお") - XCTAssertEqual("僕はロボットです".toHiragana(), "僕はろぼっとです") - XCTAssertEqual("えモじ😇".toHiragana(), "えもじ😇") - } - - func testPerformanceExample() throws { - } -} diff --git a/AzooKeyCore/Tests/SwiftUtilsTests/WithMutableValueTests.swift b/AzooKeyCore/Tests/SwiftUtilsTests/WithMutableValueTests.swift deleted file mode 100644 index 5e722088..00000000 --- a/AzooKeyCore/Tests/SwiftUtilsTests/WithMutableValueTests.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// WithMutableValueTests.swift -// azooKeyTests -// -// Created by ensan on 2022/12/22. -// Copyright © 2022 ensan. All rights reserved. -// - -@testable import SwiftUtils -import XCTest - -final class WithMutableValueTests: XCTestCase { - func testWithMutableValue() throws { - var array = [0, 1, 2, 3] - withMutableValue(&array[1]) { value in - value = value * value + value / value - } - XCTAssertEqual(array, [0, 2, 2, 3]) - } - -} diff --git a/Keyboard/Display/InputManager.swift b/Keyboard/Display/InputManager.swift index 5ab388ab..f6981e38 100644 --- a/Keyboard/Display/InputManager.swift +++ b/Keyboard/Display/InputManager.swift @@ -12,12 +12,13 @@ import KeyboardViews import OrderedCollections import SwiftUtils import UIKit +import KeyboardExtensionUtils @MainActor final class InputManager { // 入力中の文字列を管理する構造体 private(set) var composingText = ComposingText() // 表示される文字列を管理するクラス - private(set) var displayedTextManager = DisplayedTextManager() + private(set) var displayedTextManager: DisplayedTextManager // TODO: displayedTextManagerとliveConversionManagerを何らかの形で統合したい // ライブ変換を管理するクラス var liveConversionManager = LiveConversionManager() @@ -27,6 +28,12 @@ import UIKit // TODO: isSelectedはdisplayedTextManagerが持っているべき var isSelected = false + init() { + @KeyboardSetting(.liveConversion) var liveConversion + @KeyboardSetting(.markedTextSetting) var markedTextSetting + + self.displayedTextManager = DisplayedTextManager(isLiveConversionEnabled: liveConversion, isMarkedTextEnabled: markedTextSetting != .disabled) + } // キーボードの言語 private var keyboardLanguage: KeyboardLanguage = .ja_JP func setKeyboardLanguage(_ value: KeyboardLanguage) { @@ -307,6 +314,11 @@ import UIKit $0.setResults([]) } } + + @KeyboardSetting(.liveConversion) var liveConversion + @KeyboardSetting(.markedTextSetting) var markedTextSetting + + self.displayedTextManager.updateSettings(isLiveConversionEnabled: liveConversion, isMarkedTextEnabled: markedTextSetting != .disabled) } func closeKeyboard() { @@ -655,14 +667,11 @@ import UIKit /// iOS16以上の仕様変更に対応するため追加されたAPI func adjustLeftString(_ left: String) -> String { - if #available(iOS 16, *) { - var newLeft = left.components(separatedBy: "\n").last ?? "" - if left.contains("\n") && newLeft.isEmpty { - newLeft = "\n" - } - return newLeft + var newLeft = left.components(separatedBy: "\n").last ?? "" + if left.contains("\n") && newLeft.isEmpty { + newLeft = "\n" } - return left + return newLeft } /// クリップボードの文字列をペーストする diff --git a/Keyboard/Display/KeyboardActionManager.swift b/Keyboard/Display/KeyboardActionManager.swift index fdbc4ef8..d6e54f05 100644 --- a/Keyboard/Display/KeyboardActionManager.swift +++ b/Keyboard/Display/KeyboardActionManager.swift @@ -9,6 +9,7 @@ import AzooKeyUtils import KanaKanjiConverterModule import KeyboardViews +import enum KeyboardExtensionUtils.AnyTextDocumentProxy import SwiftUI import SwiftUtils @@ -510,17 +511,6 @@ import SwiftUtils --------------------- */ - private func adjustLeftString(_ left: String) -> String { - if #available(iOS 16, *) { - var newLeft = left.components(separatedBy: "\n").last ?? "" - if left.contains("\n") && newLeft.isEmpty { - newLeft = "\n" - } - return newLeft - } - return left - } - /// 何かが変化した後に状態を比較し、どのような変化が起こったのか判断する関数。 override func notifySomethingDidChange(a_left: String, a_center: String, a_right: String, variableStates: VariableStates) { defer { @@ -543,8 +533,8 @@ import SwiftUtils } // iOS16以降左側の文字列の設計が変わったので、adjustする - let a_left = adjustLeftString(a_left) - let b_left = adjustLeftString(tempLeft) + let a_left = self.inputManager.adjustLeftString(a_left) + let b_left = self.inputManager.adjustLeftString(tempLeft) // システムによる操作でこの関数が呼ばれた場合はスルーする if let operation = self.inputManager.getPreviousSystemOperation() { @@ -616,7 +606,8 @@ import SwiftUtils } // MarkedTextを有効化している場合、テキストの送信等でここに来ることがある - if self.inputManager.displayedTextManager.isMarkedTextEnabled { + @KeyboardSetting(.liveConversion) var liveConversionEnabled + if liveConversionEnabled { debug("user operation id: 2.5") self.inputManager.stopComposition() return diff --git a/Keyboard/Display/KeyboardViewController.swift b/Keyboard/Display/KeyboardViewController.swift index 65d14552..84a9a10e 100644 --- a/Keyboard/Display/KeyboardViewController.swift +++ b/Keyboard/Display/KeyboardViewController.swift @@ -257,24 +257,14 @@ final class KeyboardViewController: UIInputViewController { // この関数は「これから」向きが変わる場合に呼ばれるので、デバイスの向きによってwidthとheightが逆転するUIScreen.main.bounds.sizeを用いて向きを確かめることができる。 // ただしこの時点でのUIScreen.mainの値はOSバージョンで変わる debug("KeyboardViewController.viewWillTransition", size, UIScreen.main.bounds.size) - if #available(iOS 16, *) { - SemiStaticStates.shared.setScreenWidth(size.width) - KeyboardViewController.variableStates.setInterfaceSize(orientation: UIScreen.main.bounds.width < UIScreen.main.bounds.height ? .horizontal : .vertical, screenWidth: size.width) - } else { - SemiStaticStates.shared.setScreenWidth(size.width) - KeyboardViewController.variableStates.setInterfaceSize(orientation: UIScreen.main.bounds.width < UIScreen.main.bounds.height ? .vertical : .horizontal, screenWidth: size.width) - } + SemiStaticStates.shared.setScreenWidth(size.width) + KeyboardViewController.variableStates.setInterfaceSize(orientation: UIScreen.main.bounds.width < UIScreen.main.bounds.height ? .horizontal : .vertical, screenWidth: size.width) } override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() debug("KeyboardViewController.viewDidLayoutSubviews", SemiStaticStates.shared.screenWidth) - if #available(iOS 16, *) { - self.view.frame.size.height = Design.keyboardScreenHeight(upsideComponent: KeyboardViewController.variableStates.upsideComponent, orientation: KeyboardViewController.variableStates.keyboardOrientation) - } else { - self.view.frame.size.height = Design.keyboardScreenHeight(upsideComponent: KeyboardViewController.variableStates.upsideComponent, orientation: KeyboardViewController.variableStates.keyboardOrientation) - self.updateViewConstraints() - } + self.view.frame.size.height = Design.keyboardScreenHeight(upsideComponent: KeyboardViewController.variableStates.upsideComponent, orientation: KeyboardViewController.variableStates.keyboardOrientation) } func reloadAllView() { diff --git a/MainApp/ContentView.swift b/MainApp/ContentView.swift index 8a898518..3d6822be 100644 --- a/MainApp/ContentView.swift +++ b/MainApp/ContentView.swift @@ -100,7 +100,7 @@ struct ContentView: View { tabBarData.lastUpdateDate = .now try? manager.saveTabBarData(tabBarData: tabBarData) } - case .iOS15_4_new_emoji, .iOS16_4_new_emoji: + case .iOS16_4_new_emoji: // 絵文字を更新する DataUpdateView(id: data.id, manager: $messageManager) { AdditionalDictManager().userDictUpdate() diff --git a/MainApp/Customize/CustomizeTabView.swift b/MainApp/Customize/CustomizeTabView.swift index 2d0de750..c676a30c 100644 --- a/MainApp/Customize/CustomizeTabView.swift +++ b/MainApp/Customize/CustomizeTabView.swift @@ -13,6 +13,7 @@ import SwiftUIUtils struct CustomizeTabView: View { @EnvironmentObject private var appStates: MainAppStates + @Environment(\.requestReview) var requestReview var body: some View { ZStack { @@ -51,9 +52,7 @@ struct CustomizeTabView: View { .navigationBarTitle(Text("拡張"), displayMode: .large) .onAppear { if appStates.requestReviewManager.shouldTryRequestReview, appStates.requestReviewManager.shouldRequestReview() { - if let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene { - SKStoreReviewController.requestReview(in: scene) - } + requestReview() } } } diff --git a/MainApp/Customize/EditingTenkeyCustardView.swift b/MainApp/Customize/EditingTenkeyCustardView.swift index 70c2af9d..fe223510 100644 --- a/MainApp/Customize/EditingTenkeyCustardView.swift +++ b/MainApp/Customize/EditingTenkeyCustardView.swift @@ -47,7 +47,7 @@ struct EditingTenkeyCustardView: CancelableEditor { @Binding private var manager: CustardManager @State private var showPreview = false @State private var copiedKey: UserMadeTenKeyCustard.KeyData? - private var models: [KeyPosition: (model: any FlickKeyModelProtocol, width: Int, height: Int)] { + private var models: [KeyPosition: (model: any FlickKeyModelProtocol, width: Int, height: Int)] { (0.., isPresented: Binding) { - self.configuration = configuration - self._pickerResult = pickerResult - self._isPresented = isPresented - } - - private let configuration: PHPickerConfiguration - @Binding private var pickerResult: UIImage? - @Binding private var isPresented: Bool - - func makeUIViewController(context: Context) -> PHPickerViewController { - let controller = PHPickerViewController(configuration: configuration) - controller.delegate = context.coordinator - return controller - } - - func updateUIViewController(_ uiViewController: PHPickerViewController, context: Context) { - - } - - func makeCoordinator() -> Coordinator { - Coordinator(self) - } - - /// PHPickerViewControllerDelegate => Coordinator - final class Coordinator: PHPickerViewControllerDelegate { - private let parent: PhotoPicker - - init(_ parent: PhotoPicker) { - self.parent = parent - } - // PHPickerViewControllerDelegateの設定 - func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) { - for image in results { - if image.itemProvider.canLoadObject(ofClass: PHLivePhoto.self) { - image.itemProvider.loadObject(ofClass: PHLivePhoto.self) { (livePhotoObject, error) in - // PHLivePhotoとして取得 - if let livePhoto = livePhotoObject as? PHLivePhoto, - let imageUrl = livePhoto.value(forKey: "imageURL") as? URL { - do { - // Dataで取得 - let imageData: Data = try Data(contentsOf: imageUrl) - if let uiImage = UIImage(data: imageData), let cgImage = uiImage.cgImage { - self.parent.pickerResult = UIImage(cgImage: cgImage, scale: 1, orientation: uiImage.imageOrientation) - } - } catch { - debug(error) - } - } - } - } else if image.itemProvider.canLoadObject(ofClass: UIImage.self) { - image.itemProvider.loadObject(ofClass: UIImage.self) { (selectedImage, error) in - if let error { - debug("error: \(error.localizedDescription)") - return - } - guard let wrapImage = selectedImage as? UIImage else { - debug("wrap error") - return - } - // 選択したImageをpickerResultに格納 - self.parent.pickerResult = wrapImage - } - } - } - // 閉じる - parent.isPresented = false - } - } -} diff --git a/MainApp/Setting/AdditionalDict/AdditionalDictManageView.swift b/MainApp/Setting/AdditionalDict/AdditionalDictManageView.swift index 385079af..c50cbdb1 100644 --- a/MainApp/Setting/AdditionalDict/AdditionalDictManageView.swift +++ b/MainApp/Setting/AdditionalDict/AdditionalDictManageView.swift @@ -43,10 +43,8 @@ struct AdditionalSystemDictManager: OnOffSettingSet { case .emoji: if #available(iOS 16.4, *) { return ["emoji_dict_E15.0.txt.gen"] - } else if #available(iOS 15.4, *) { - return ["emoji_dict_E14.0.txt.gen"] } else { - return ["emoji_dict_E13.1.txt.gen"] + return ["emoji_dict_E14.0.txt.gen"] } case .kaomoji: return ["kaomoji_dict.tsv"] diff --git a/MainApp/Setting/AdditionalDict/AzooKeyUserDictionary.swift b/MainApp/Setting/AdditionalDict/AzooKeyUserDictionary.swift index f42180d5..eb73e37b 100644 --- a/MainApp/Setting/AdditionalDict/AzooKeyUserDictionary.swift +++ b/MainApp/Setting/AdditionalDict/AzooKeyUserDictionary.swift @@ -159,7 +159,6 @@ private struct UserDictionaryDataEditor: CancelableEditor { self.base = (item.copy(), variables.templates) } - @available(iOS 16.0, *) private func hasTemplate(word: String) -> Bool { word.contains(templateRegex) } @@ -182,12 +181,10 @@ private struct UserDictionaryDataEditor: CancelableEditor { @State private var sending = false @FocusState private var focusOnWordField: Bool? - @available(iOS 16.0, *) private var templateRegex: some RegexComponent { /{{.+?}}/ } - @available(iOS 16.0, *) private func parsedWord(word: String) -> [String] { var result: [String] = [] var startIndex = word.startIndex @@ -201,7 +198,6 @@ private struct UserDictionaryDataEditor: CancelableEditor { return result } - @available(iOS 16.0, *) private func replaceTemplate(selectedTemplate: (name: String, index: Int), newName: String) { var parsedWords = parsedWord(word: item.data.word) if parsedWords.indices.contains(selectedTemplate.index) && parsedWords[selectedTemplate.index] == "{{\(selectedTemplate.name)}}" { @@ -211,7 +207,6 @@ private struct UserDictionaryDataEditor: CancelableEditor { } @ViewBuilder - @available(iOS 16.0, *) private func templateWordView(word: String) -> some View { let parsedWords = parsedWord(word: word) ScrollView(.horizontal, showsIndicators: false) { @@ -249,7 +244,6 @@ private struct UserDictionaryDataEditor: CancelableEditor { } } - @available(iOS 16.0, *) @ViewBuilder private func templateEditor(index: Int, selectedTemplate: (name: String, index: Int)) -> some View { if variables.templates[index].name == selectedTemplate.name { @@ -276,7 +270,7 @@ private struct UserDictionaryDataEditor: CancelableEditor { if wordEditMode { wordField } else { - if #available(iOS 16.0, *), hasTemplate(word: item.data.word) { + if hasTemplate(word: item.data.word) { templateWordView(word: item.data.word) Spacer() Divider() @@ -338,7 +332,7 @@ private struct UserDictionaryDataEditor: CancelableEditor { Text("この単語をazooKeyの本体辞書に追加することを申請します。\n個人情報を含む単語は申請しないでください。") } } - if #available(iOS 16.0, *), let selectedTemplate { + if let selectedTemplate { if let index = templateIndex(name: selectedTemplate.name) { Section(header: Text("テンプレートを編集する")) { Text("{{\(selectedTemplate.name)}}を編集できます") diff --git a/MainApp/Setting/KeyboardLayout/KeyboardLayoutSettingItemView.swift b/MainApp/Setting/KeyboardLayout/KeyboardLayoutSettingItemView.swift index d57cfd28..574ac3ea 100644 --- a/MainApp/Setting/KeyboardLayout/KeyboardLayoutSettingItemView.swift +++ b/MainApp/Setting/KeyboardLayout/KeyboardLayoutSettingItemView.swift @@ -97,31 +97,15 @@ struct LanguageLayoutSettingView: Vie Group { // ラベルの数でUIを出し分ける if types.count > 3 { - if #available(iOS 16, *) { - Picker(selection: $selection, label: Text(labelText)) { - ForEach(0 ..< types.count, id: \.self) { i in - Text(types[i].label).tag(types[i]) - } - } - CenterAlignedView { - KeyboardPreview(scale: 0.8, defaultTab: tab) - .allowsHitTesting(false) - .disabled(true) + Picker(selection: $selection, label: Text(labelText)) { + ForEach(0 ..< types.count, id: \.self) { i in + Text(types[i].label).tag(types[i]) } - } else { - Text(labelText) - CenterAlignedView { - KeyboardPreview(scale: 0.8, defaultTab: tab) - .allowsHitTesting(false) - .disabled(true) - } - Picker(selection: $selection, label: Text(labelText)) { - ForEach(0 ..< types.count, id: \.self) { i in - Text(types[i].label).tag(types[i]) - } - } - .labelsHidden() - .pickerStyle(.segmented) + } + CenterAlignedView { + KeyboardPreview(scale: 0.8, defaultTab: tab) + .allowsHitTesting(false) + .disabled(true) } } else { VStack { diff --git a/MainApp/Setting/SettingTab.swift b/MainApp/Setting/SettingTab.swift index f196b730..bf73ab74 100644 --- a/MainApp/Setting/SettingTab.swift +++ b/MainApp/Setting/SettingTab.swift @@ -12,6 +12,7 @@ import StoreKit import SwiftUI struct SettingTabView: View { + @Environment(\.requestReview) var requestReview @EnvironmentObject private var appStates: MainAppStates private func canFlickLayout(_ layout: LanguageLayout) -> Bool { if layout == .flick { @@ -146,9 +147,7 @@ struct SettingTabView: View { .navigationBarTitleDisplayMode(.large) .onAppear { if appStates.requestReviewManager.shouldTryRequestReview, appStates.requestReviewManager.shouldRequestReview() { - if let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene { - SKStoreReviewController.requestReview(in: scene) - } + requestReview() } } } diff --git a/MainApp/Theme/ThemeEditView.swift b/MainApp/Theme/ThemeEditView.swift index ae341c09..7fab6e39 100644 --- a/MainApp/Theme/ThemeEditView.swift +++ b/MainApp/Theme/ThemeEditView.swift @@ -87,10 +87,10 @@ struct ThemeEditView: CancelableEditor { @Binding private var manager: ThemeIndexManager + @State private var photosPickerItem: PhotosPickerItem? @State private var trimmedImage: UIImage? @State private var isTrimmingViewPresented = false @State private var pickedImage: UIImage? - @State private var isSheetPresented = false @State private var viewType = ViewType.editor private let colorConverter = ThemeColorTranslator.self @@ -139,18 +139,15 @@ struct ThemeEditView: CancelableEditor { Form { Section(header: Text("背景")) { if trimmedImage != nil { - Button("\(systemImage: "photo")画像を選び直す") { - self.isSheetPresented = true - } + PhotosPicker("\(systemImage: "photo")画像を選び直す", selection: $photosPickerItem) Button("画像を削除") { + photosPickerItem = nil pickedImage = nil trimmedImage = nil } .foregroundStyle(.red) } else { - Button("\(systemImage: "photo")画像を選ぶ") { - self.isSheetPresented = true - } + PhotosPicker("\(systemImage: "photo")画像を選ぶ", selection: $photosPickerItem) ColorPicker("背景の色", selection: $theme.backgroundColor.converted(colorConverter)) } } @@ -234,11 +231,18 @@ struct ThemeEditView: CancelableEditor { self.theme.pushedKeyFillColor = .color(pushedKeyColor) } } - .sheet(isPresented: $isSheetPresented, content: { - PhotoPicker(configuration: self.config, - pickerResult: $pickedImage, - isPresented: $isSheetPresented) - }) + .onChange(of: self.photosPickerItem) { item in + guard let item else { + return + } + Task { + if let data = try await item.loadTransferable(type: Data.self) { + if let uiImage = UIImage(data: data) { + self.pickedImage = uiImage + } + } + } + } .navigationBarTitle(Text(self.title), displayMode: .inline) .navigationBarBackButtonHidden(true) .navigationBarItems( diff --git a/MainApp/Theme/ThemeShareView.swift b/MainApp/Theme/ThemeShareView.swift index 89997950..7288b26c 100644 --- a/MainApp/Theme/ThemeShareView.swift +++ b/MainApp/Theme/ThemeShareView.swift @@ -45,14 +45,10 @@ struct ThemeShareView: View { .fixedSize(horizontal: false, vertical: true) Button { - if #available(iOS 16, *) { - let renderer = ImageRenderer(content: keyboardPreview) - renderer.scale = 3.0 - if let image = renderer.uiImage { - shareImage.setImage(image) - } - } else { - shareImage.setImage(keyboardPreview.snapshot()) + let renderer = ImageRenderer(content: keyboardPreview) + renderer.scale = 3.0 + if let image = renderer.uiImage { + shareImage.setImage(image) } showActivityView = true } label: { diff --git a/azooKey.xcodeproj/project.pbxproj b/azooKey.xcodeproj/project.pbxproj index 2cfca961..bff9fc68 100644 --- a/azooKey.xcodeproj/project.pbxproj +++ b/azooKey.xcodeproj/project.pbxproj @@ -41,7 +41,6 @@ 1A1A630B29C9C91A00EF7B26 /* emoji_dict_E13.1.txt.gen in Resources */ = {isa = PBXBuildFile; fileRef = 1A1A630629C9C91A00EF7B26 /* emoji_dict_E13.1.txt.gen */; }; 1A1A630C29C9C91A00EF7B26 /* emoji_dict_E15.0.txt.gen in Resources */ = {isa = PBXBuildFile; fileRef = 1A1A630729C9C91A00EF7B26 /* emoji_dict_E15.0.txt.gen */; }; 1A1A630D29C9C91A00EF7B26 /* emoji_dict_E15.0.txt.gen in Resources */ = {isa = PBXBuildFile; fileRef = 1A1A630729C9C91A00EF7B26 /* emoji_dict_E15.0.txt.gen */; }; - 1A1ECCA2295DF8DE001AD7E0 /* DisplayedTextManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A1ECCA1295DF8DE001AD7E0 /* DisplayedTextManager.swift */; }; 1A1ECCA4295DF9D4001AD7E0 /* LiveConversionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A1ECCA3295DF9D4001AD7E0 /* LiveConversionManager.swift */; }; 1A1ECCA6295DFADF001AD7E0 /* InputManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A1ECCA5295DFADF001AD7E0 /* InputManager.swift */; }; 1A273F97291A6B8B001E1B02 /* iOS15TerminationNews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A273F96291A6B8B001E1B02 /* iOS15TerminationNews.swift */; }; @@ -93,7 +92,6 @@ 1A73F20529C01B0F00833C11 /* RequestReviewManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A73F20429C01B0F00833C11 /* RequestReviewManager.swift */; }; 1A73F20729C01B5700833C11 /* checkKeyboardActivation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A73F20629C01B5700833C11 /* checkKeyboardActivation.swift */; }; 1A73F20929C01B7600833C11 /* closeKeyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A73F20829C01B7600833C11 /* closeKeyboard.swift */; }; - 1A73F20A29C0A6E000833C11 /* DisplayedTextManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A1ECCA1295DF8DE001AD7E0 /* DisplayedTextManager.swift */; }; 1A73F20B29C0B01C00833C11 /* InputManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A1ECCA5295DFADF001AD7E0 /* InputManager.swift */; }; 1A73F21229C0B36D00833C11 /* OrderedCollections in Frameworks */ = {isa = PBXBuildFile; productRef = 1A73F21129C0B36D00833C11 /* OrderedCollections */; }; 1A7B147325F6602E00BE2472 /* CustomizeTabWalkthrough.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A7B147225F6602E00BE2472 /* CustomizeTabWalkthrough.swift */; }; @@ -142,7 +140,6 @@ 1AD8FDF12988076F00DA4296 /* ConverterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AD8FDF02988076F00DA4296 /* ConverterTests.swift */; }; 1AD96FB82A22F9C800FD4EA4 /* SwiftUIUtils in Frameworks */ = {isa = PBXBuildFile; productRef = 1AD96FB72A22F9C800FD4EA4 /* SwiftUIUtils */; }; 1AD96FBA2A22F9CD00FD4EA4 /* SwiftUIUtils in Frameworks */ = {isa = PBXBuildFile; productRef = 1AD96FB92A22F9CD00FD4EA4 /* SwiftUIUtils */; }; - 1AE1023625D0C99200CA7277 /* PhotoPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AE1023525D0C99200CA7277 /* PhotoPicker.swift */; }; 1AE1025625D1788300CA7277 /* Capture.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AE1025525D1788300CA7277 /* Capture.swift */; }; 1AE102CF25D3713C00CA7277 /* TrimmingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AE102CE25D3713C00CA7277 /* TrimmingView.swift */; }; 1AE1913625D4A3370044EE4B /* ThemeShareView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AE1913525D4A3370044EE4B /* ThemeShareView.swift */; }; @@ -178,6 +175,7 @@ 557D9E012ABF320F0028F3A0 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 557D9E002ABF320F0028F3A0 /* Localizable.xcstrings */; }; 557D9E022ABF320F0028F3A0 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 557D9E002ABF320F0028F3A0 /* Localizable.xcstrings */; }; 5592F5AE2AC0395D00AA1325 /* PredictionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5598472D2AB84F5200B18C15 /* PredictionManager.swift */; }; + 55950E542AF8E09400ACACAB /* KeyboardExtensionUtils in Frameworks */ = {isa = PBXBuildFile; productRef = 55950E532AF8E09400ACACAB /* KeyboardExtensionUtils */; }; 5598472E2AB84F5200B18C15 /* PredictionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5598472D2AB84F5200B18C15 /* PredictionManager.swift */; }; /* End PBXBuildFile section */ @@ -256,7 +254,6 @@ 1A1A630529C9C91A00EF7B26 /* emoji_dict_E14.0.txt.gen */ = {isa = PBXFileReference; lastKnownFileType = text; name = emoji_dict_E14.0.txt.gen; path = Gen/generated/emoji_dict_E14.0.txt.gen; sourceTree = SOURCE_ROOT; }; 1A1A630629C9C91A00EF7B26 /* emoji_dict_E13.1.txt.gen */ = {isa = PBXFileReference; lastKnownFileType = text; name = emoji_dict_E13.1.txt.gen; path = Gen/generated/emoji_dict_E13.1.txt.gen; sourceTree = SOURCE_ROOT; }; 1A1A630729C9C91A00EF7B26 /* emoji_dict_E15.0.txt.gen */ = {isa = PBXFileReference; lastKnownFileType = text; name = emoji_dict_E15.0.txt.gen; path = Gen/generated/emoji_dict_E15.0.txt.gen; sourceTree = SOURCE_ROOT; }; - 1A1ECCA1295DF8DE001AD7E0 /* DisplayedTextManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayedTextManager.swift; sourceTree = ""; }; 1A1ECCA3295DF9D4001AD7E0 /* LiveConversionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveConversionManager.swift; sourceTree = ""; }; 1A1ECCA5295DFADF001AD7E0 /* InputManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputManager.swift; sourceTree = ""; }; 1A273F96291A6B8B001E1B02 /* iOS15TerminationNews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOS15TerminationNews.swift; sourceTree = ""; }; @@ -343,7 +340,6 @@ 1AD4454526AAB8E4003CF854 /* DisclosuringList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisclosuringList.swift; sourceTree = ""; }; 1AD5E17726AB230F001B4FF7 /* CustomKeysSettingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomKeysSettingView.swift; sourceTree = ""; }; 1AD8FDF02988076F00DA4296 /* ConverterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConverterTests.swift; sourceTree = ""; }; - 1AE1023525D0C99200CA7277 /* PhotoPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoPicker.swift; sourceTree = ""; }; 1AE1025525D1788300CA7277 /* Capture.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Capture.swift; sourceTree = ""; }; 1AE102CE25D3713C00CA7277 /* TrimmingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrimmingView.swift; sourceTree = ""; }; 1AE1913525D4A3370044EE4B /* ThemeShareView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeShareView.swift; sourceTree = ""; }; @@ -429,6 +425,7 @@ 1A7F37812A698741009AC382 /* KeyboardThemes in Frameworks */, 1AD96FB82A22F9C800FD4EA4 /* SwiftUIUtils in Frameworks */, 1AED0A612A6D22CB005B87E5 /* AzooKeyUtils in Frameworks */, + 55950E542AF8E09400ACACAB /* KeyboardExtensionUtils in Frameworks */, 1A606B08292E53C500CEDB15 /* CustardExpressionEvaluator in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -463,7 +460,6 @@ 1A10D81325E506460095CB67 /* Pickers */ = { isa = PBXGroup; children = ( - 1AE1023525D0C99200CA7277 /* PhotoPicker.swift */, 1A18424225DD6857003985AB /* FontPicker.swift */, ); path = Pickers; @@ -514,7 +510,6 @@ 1A1ECCA0295DF8A2001AD7E0 /* Display */ = { isa = PBXGroup; children = ( - 1A1ECCA1295DF8DE001AD7E0 /* DisplayedTextManager.swift */, 1A1ECCA3295DF9D4001AD7E0 /* LiveConversionManager.swift */, 5598472D2AB84F5200B18C15 /* PredictionManager.swift */, 1A1ECCA5295DFADF001AD7E0 /* InputManager.swift */, @@ -1081,6 +1076,7 @@ 1A7F37802A698741009AC382 /* KeyboardThemes */, 1A7F37892A6A1A99009AC382 /* KeyboardViews */, 1AED0A602A6D22CB005B87E5 /* AzooKeyUtils */, + 55950E532AF8E09400ACACAB /* KeyboardExtensionUtils */, ); productName = Keyboard; productReference = 1A3DC1F92500D488002CAA93 /* Keyboard.appex */; @@ -1365,7 +1361,6 @@ 1AFA57662584815B00477DC2 /* QwertyCustomKeysItemView.swift in Sources */, 1AFB68422518C48100C649C4 /* OpenSourceSoftwaresLicenseView.swift in Sources */, 1A5C7EAC25F36A6E00A7CBA8 /* PreferredLanguageSettingView.swift in Sources */, - 1AE1023625D0C99200CA7277 /* PhotoPicker.swift in Sources */, 1A2C293926273E9900DFE465 /* DraggableView.swift in Sources */, 1AE1025625D1788300CA7277 /* Capture.swift in Sources */, 1A10D7F825E4E8D30095CB67 /* CustardInformationView.swift in Sources */, @@ -1404,7 +1399,6 @@ 1AC09DBE299533E0009BDBC7 /* DicdataStoreTests.swift in Sources */, 1A2E585A2951EC87004F959B /* (null) in Sources */, 1A2E58542951EC87004F959B /* (null) in Sources */, - 1A73F20A29C0A6E000833C11 /* DisplayedTextManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1420,7 +1414,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 1A1ECCA2295DF8DE001AD7E0 /* DisplayedTextManager.swift in Sources */, 5598472E2AB84F5200B18C15 /* PredictionManager.swift in Sources */, 1A1ECCA6295DFADF001AD7E0 /* InputManager.swift in Sources */, 1A1ECCA4295DF9D4001AD7E0 /* LiveConversionManager.swift in Sources */, @@ -1670,7 +1663,7 @@ ENABLE_PREVIEWS = YES; INFOPLIST_FILE = MainApp/Info.plist; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1706,7 +1699,7 @@ "GCC_OPTIMIZATION_LEVEL[arch=*]" = s; INFOPLIST_FILE = MainApp/Info.plist; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1735,7 +1728,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 9S3UXHYP65; INFOPLIST_FILE = azooKeyTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1759,7 +1752,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 9S3UXHYP65; INFOPLIST_FILE = azooKeyTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1785,7 +1778,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 9S3UXHYP65; INFOPLIST_FILE = MainAppUITests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1810,7 +1803,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = 9S3UXHYP65; INFOPLIST_FILE = MainAppUITests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1839,7 +1832,7 @@ GCC_OPTIMIZATION_LEVEL = fast; GCC_WARN_UNUSED_PARAMETER = YES; INFOPLIST_FILE = Keyboard/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1874,7 +1867,7 @@ GCC_OPTIMIZATION_LEVEL = fast; GCC_WARN_UNUSED_PARAMETER = YES; INFOPLIST_FILE = Keyboard/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2067,6 +2060,10 @@ isa = XCSwiftPackageProductDependency; productName = KanaKanjiConverterModule; }; + 55950E532AF8E09400ACACAB /* KeyboardExtensionUtils */ = { + isa = XCSwiftPackageProductDependency; + productName = KeyboardExtensionUtils; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 1A3DC1BA2500D44A002CAA93 /* Project object */;