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