Skip to content

Commit

Permalink
Merge pull request #427 from ensan-hcl/develop_2.2.3
Browse files Browse the repository at this point in the history
[Release] Version 2.2.3🎉
  • Loading branch information
ensan-hcl authored Feb 19, 2024
2 parents 73ef762 + fdcc384 commit 4099def
Show file tree
Hide file tree
Showing 49 changed files with 6,159 additions and 4,722 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "azooKey_dictionary_storage"]
path = azooKey_dictionary_storage
url = https://github.com/ensan-hcl/azooKey_dictionary_storage
2 changes: 1 addition & 1 deletion AzooKeyCore/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let package = Package(
// MARK: `_: .upToNextMinor(Version)` or `exact: Version` or `revision: Version`.
// MARK: For develop branch, you can use `revision:` specification.
// MARK: For main branch, you must use `upToNextMinor` specification.
.package(url: "https://github.com/ensan-hcl/AzooKeyKanaKanjiConverter", .upToNextMinor(from: "0.4.0"))
.package(url: "https://github.com/ensan-hcl/AzooKeyKanaKanjiConverter", .upToNextMinor(from: "0.5.0"))
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ public enum AzooKeyKeyboardViewExtension: ApplicationSpecificKeyboardViewExtensi
UseShiftKey.value
}

public static var keepDeprecatedShiftKeyBehavior: Bool {
KeepDeprecatedShiftKeyBehavior.value
}

public static var useNextCandidateKey: Bool {
UseNextCandidateKey.value
}
Expand Down
25 changes: 23 additions & 2 deletions AzooKeyCore/Sources/AzooKeyUtils/AzooKeyMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ 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 iOS17_4_new_emoji = "iOS_17_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"

Expand All @@ -33,7 +34,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 .iOS15_4_new_emoji, .iOS16_4_new_emoji, .iOS17_4_new_emoji, .mock:
return false
}
}
Expand All @@ -47,7 +48,6 @@ public enum AzooKeyMessageProvider: ApplicationSpecificKeyboardViewMessageProvid
public typealias MessageID = MessageIdentifier

public static var userDefaults: UserDefaults { UserDefaults(suiteName: SharedStore.appGroupKey)! }

public static var messages: [MessageData<MessageIdentifier>] {
[
MessageData(
Expand Down Expand Up @@ -96,6 +96,27 @@ public enum AzooKeyMessageProvider: ApplicationSpecificKeyboardViewMessageProvid
},
containerAppShouldMakeItDone: { false }
),
MessageData(
id: .iOS17_4_new_emoji,
title: "お知らせ",
description: "iOS17.4で「🙂‍↕️️ (うなづく顔)」「🙂‍↔️️ (首を振る顔)」「🐦‍🔥️ (不死鳥)」などの新しい絵文字が追加されました。本体アプリを開き、データを更新しますか?",
button: .two(primary: .openContainer(text: "更新"), secondary: .later),
precondition: {
if #available(iOS 17.4, *) {
return true
} else {
return false
}
},
silentDoneCondition: {
// ダウンロードがv2.0.2以降の場合はDone
if (SharedStore.initialAppVersion ?? .azooKey_v1_7_1) >= .azooKey_v2_2_3 {
return true
}
return false
},
containerAppShouldMakeItDone: { false }
),
MessageData(
id: .ver1_9_user_dictionary_update,
title: "お願い",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ public extension KeyboardSettingKey where Self == UseShiftKey {
static var useShiftKey: Self { .init() }
}

public struct KeepDeprecatedShiftKeyBehavior: BoolKeyboardSettingKey {
public static let title: LocalizedStringKey = "シフトキーの古い挙動を使う"
public static let explanation: LocalizedStringKey = "シフトキーの以前の挙動を利用します。iOS 18以降では廃止されます。"
public static var defaultValue: Bool = true
public static let key: String = "keep_deprecated_shift_key_behavior"
}

public extension KeyboardSettingKey where Self == KeepDeprecatedShiftKeyBehavior {
static var keepDeprecatedShiftKeyBehavior: Self { .init() }
}

public struct UseNextCandidateKey: BoolKeyboardSettingKey {
public static let title: LocalizedStringKey = "次候補キーを使う"
public static let explanation: LocalizedStringKey = "キーボードで入力中、空白キーに「次候補」機能を表示します"
Expand Down
2 changes: 2 additions & 0 deletions AzooKeyCore/Sources/AzooKeyUtils/SharedStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public enum SharedStore {
}

public extension AppVersion {
static let azooKey_v2_2_3 = AppVersion("2.2.3")!
static let azooKey_v2_2_2 = AppVersion("2.2.2")!
static let azooKey_v2_0_2 = AppVersion("2.0.2")!
static let azooKey_v1_9 = AppVersion("1.9")!
static let azooKey_v1_8_1 = AppVersion("1.8.1")!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import Foundation
static var enablePasteButton: Bool { get }
static var hideResetButtonInOneHandedMode: Bool { get }
static var useShiftKey: Bool { get }
static var keepDeprecatedShiftKeyBehavior: Bool { get }
static var useNextCandidateKey: Bool { get }

/// タブバーボタンを表示する
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ public struct ClipboardHistoryManager {
while self.items.count > config.maxCount {
self.items.removeLast()
}
debug("checkUpdate", self.items)
}

private static func historyFileURL(config: any ClipboardHistoryManagerConfiguration) -> URL? {
Expand Down
8 changes: 4 additions & 4 deletions AzooKeyCore/Sources/KeyboardViews/Tab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ public enum Tab: Equatable {
case flick_numbersymbols
case qwerty_hira
case qwerty_abc
case qwerty_number
case qwerty_numbers
case qwerty_symbols
case custard(Custard)
case special(SpecialTab)

public static func == (lhs: ExistentialTab, rhs: ExistentialTab) -> Bool {
switch (lhs, rhs) {
case (.flick_hira, .flick_hira), (.flick_abc, .flick_abc), (.flick_numbersymbols, .flick_numbersymbols), (.qwerty_hira, .qwerty_hira), (.qwerty_abc, .qwerty_abc), (.qwerty_number, .qwerty_number), (.qwerty_symbols, .qwerty_symbols): return true
case (.flick_hira, .flick_hira), (.flick_abc, .flick_abc), (.flick_numbersymbols, .flick_numbersymbols), (.qwerty_hira, .qwerty_hira), (.qwerty_abc, .qwerty_abc), (.qwerty_numbers, .qwerty_numbers), (.qwerty_symbols, .qwerty_symbols): return true
case (.custard(let l), .custard(let r)):
return l.identifier == r.identifier
&& l.input_style == r.input_style
Expand Down Expand Up @@ -63,7 +63,7 @@ public enum Tab: Equatable {
switch self {
case .flick_hira, .flick_abc, .flick_numbersymbols:
return .flick
case .qwerty_hira, .qwerty_abc, .qwerty_number, .qwerty_symbols:
case .qwerty_hira, .qwerty_abc, .qwerty_numbers, .qwerty_symbols:
return .qwerty
case let .custard(custard):
switch custard.interface.keyStyle {
Expand Down Expand Up @@ -97,7 +97,7 @@ public enum Tab: Equatable {
case .none:
return KeyboardLanguage.none
}
case .flick_numbersymbols, .qwerty_number, .qwerty_symbols:
case .flick_numbersymbols, .qwerty_numbers, .qwerty_symbols:
return nil
case .special:
return KeyboardLanguage.none
Expand Down
2 changes: 1 addition & 1 deletion AzooKeyCore/Sources/KeyboardViews/TabManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extension TabData {
case .qwerty_english:
return .existential(.qwerty_abc)
case .qwerty_numbers:
return .existential(.qwerty_number)
return .existential(.qwerty_numbers)
case .qwerty_symbols:
return .existential(.qwerty_symbols)
case .user_japanese:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,47 @@ extension CustardInterfaceKey {
}

@MainActor func qwertyKeyModel<Extension: ApplicationSpecificKeyboardViewExtension>(layout: CustardInterfaceLayout, extension: Extension.Type) -> any QwertyKeyModelProtocol {
let rowInfo = switch layout {
case let .gridFit(value): (normal: value.rowCount, functional: 0, space: 0, enter: 0)
case let .gridScroll(value): (normal: Int(value.rowCount), functional: 0, space: 0, enter: 0)
}
switch self {
case let .system(value):
switch value {
case .changeKeyboard:
let changeKeyboardKey: QwertyChangeKeyboardKeyModel<Extension>
if let second = Extension.SettingProvider.preferredLanguage.second {
changeKeyboardKey = .init(keySizeType: .normal(of: 1, for: 1), fallBackType: .secondTab(secondLanguage: second))
let changeKeyboardKeySize: QwertyKeySizeType = .normal(of: 1, for: 1)
return if let second = Extension.SettingProvider.preferredLanguage.second {
QwertyConditionalKeyModel<Extension>(keySizeType: changeKeyboardKeySize, needSuggestView: false, unpressedKeyColorType: .special) { states in
if SemiStaticStates.shared.needsInputModeSwitchKey {
return QwertyChangeKeyboardKeyModel(keySizeType: changeKeyboardKeySize)
} else {
// 普通のキーで良い場合
let targetTab: TabData = switch second {
case .en_US:
.system(.user_english)
case .ja_JP, .none, .el_GR:
.system(.user_japanese)
}
return switch states.tabManager.existentialTab() {
case .qwerty_hira, .qwerty_abc:
QwertyFunctionalKeyModel(labelType: .text("#+="), rowInfo: rowInfo, pressActions: [.moveTab(.system(.qwerty_symbols))], longPressActions: .init(start: [.setTabBar(.toggle)]))
case .qwerty_numbers, .qwerty_symbols:
QwertyFunctionalKeyModel(labelType: .text(second.symbol), rowInfo: rowInfo, pressActions: [.moveTab(targetTab)])
default:
QwertyFunctionalKeyModel(labelType: .image("arrowtriangle.left.and.line.vertical.and.arrowtriangle.right"), rowInfo: rowInfo, pressActions: [.setCursorBar(.toggle)])
}
}
}
} else {
changeKeyboardKey = .init(keySizeType: .normal(of: 1, for: 1), fallBackType: .tabBar)
QwertyConditionalKeyModel<Extension>(keySizeType: changeKeyboardKeySize, needSuggestView: false, unpressedKeyColorType: .special) { states in
if SemiStaticStates.shared.needsInputModeSwitchKey {
// 地球儀キーが必要な場合
QwertyChangeKeyboardKeyModel(keySizeType: changeKeyboardKeySize)
} else {
QwertyFunctionalKeyModel(labelType: .image("arrowtriangle.left.and.line.vertical.and.arrowtriangle.right"), rowInfo: rowInfo, pressActions: [.setCursorBar(.toggle)])
}
}
}
return changeKeyboardKey
case .enter:
return QwertyEnterKeyModel<Extension>(keySizeType: .enter)
case .upperLower:
Expand Down Expand Up @@ -351,12 +381,14 @@ public struct CustardFlickKeysView<Extension: ApplicationSpecificKeyboardViewExt
private let layout: CustardInterfaceLayoutGridValue
private let blur: Bool

@MainActor private func flickKeyData(x: Int, y: Int, width: Int, height: Int) -> (position: CGPoint, size: CGSize) {
@MainActor private func flickKeyData(x: Int, y: Int, width: Int, height: Int) -> (position: CGPoint, size: CGSize, contentSize: CGSize) {
let width = tabDesign.keyViewWidth(widthCount: width)
let height = tabDesign.keyViewHeight(heightCount: height)
let dx = width * 0.5 + tabDesign.keyViewWidth * CGFloat(x) + tabDesign.horizontalSpacing * CGFloat(x)
let dy = height * 0.5 + tabDesign.keyViewHeight * CGFloat(y) + tabDesign.verticalSpacing * CGFloat(y)
return (CGPoint(x: dx, y: dy), CGSize(width: width, height: height))
let contentWidth = width + tabDesign.horizontalSpacing
let contentHeight = height + tabDesign.verticalSpacing
return (CGPoint(x: dx, y: dy), CGSize(width: width, height: height), CGSize(width: contentWidth, height: contentHeight))
}

public var body: some View {
Expand All @@ -372,13 +404,16 @@ public struct CustardFlickKeysView<Extension: ApplicationSpecificKeyboardViewExt
let info = flickKeyData(x: x, y: y, width: data.width, height: data.height)
let suggestState = columnSuggestStates[y]
let needBlur = needKeyboardBlur && !needColumnWideBlur && suggestState == nil
contentGenerator(FlickKeyView(model: data.model, size: info.size, position: (x, y), suggestState: $suggestState), x, y) .zIndex(suggestState != nil ? 1 : 0)
contentGenerator(FlickKeyView(model: data.model, size: info.size, position: (x, y), suggestState: $suggestState), x, y)
.zIndex(suggestState != nil ? 1 : 0)
.overlay(alignment: .center) {
if let suggestType = suggestState {
FlickSuggestView<Extension>(model: data.model, tabDesign: tabDesign, size: info.size, suggestType: suggestType)
.zIndex(2)
}
}
.frame(width: info.contentSize.width, height: info.contentSize.height)
.contentShape(Rectangle())
.position(x: info.position.x, y: info.position.y)
.blur(radius: needBlur ? 0.75 : 0)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,19 @@ struct ResultContextMenuView: View {
action.notifyForgetCandidate(candidate, variableStates: variableStates)
}
}
if SemiStaticStates.shared.hasFullAccess {
Button("誤変換を報告", systemImage: "exclamationmark.bubble") {
Section(SemiStaticStates.shared.hasFullAccess ? "フィードバックを送信" : "フルアクセスが必要です") {
Button("意図した変換ではない", systemImage: "exclamationmark.bubble") {
Task { @MainActor in
await action.notifyReportWrongConversion(candidate, index: index, variableStates: variableStates)
}
}
.disabled(!SemiStaticStates.shared.hasFullAccess)
Button("欲しい変換がない", systemImage: "questionmark.bubble") {
Task { @MainActor in
await action.notifyReportWrongConversion(candidate, index: index, variableStates: variableStates)
}
}
.disabled(!SemiStaticStates.shared.hasFullAccess)
}
#if DEBUG
Button("デバッグ情報を表示する", systemImage: "ladybug.fill"){
Expand Down
2 changes: 1 addition & 1 deletion AzooKeyCore/Sources/KeyboardViews/View/KeyboardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public struct KeyboardView<Extension: ApplicationSpecificKeyboardViewExtension>:
QwertyKeyboardView<Extension>(keyModels: QwertyDataProvider<Extension>.hiraKeyboard(), interfaceSize: variableStates.interfaceSize, keyboardOrientation: variableStates.keyboardOrientation)
case .qwerty_abc:
QwertyKeyboardView<Extension>(keyModels: QwertyDataProvider<Extension>.abcKeyboard(), interfaceSize: variableStates.interfaceSize, keyboardOrientation: variableStates.keyboardOrientation)
case .qwerty_number:
case .qwerty_numbers:
QwertyKeyboardView<Extension>(keyModels: QwertyDataProvider<Extension>.numberKeyboard, interfaceSize: variableStates.interfaceSize, keyboardOrientation: variableStates.keyboardOrientation)
case .qwerty_symbols:
QwertyKeyboardView<Extension>(keyModels: QwertyDataProvider<Extension>.symbolsKeyboard(), interfaceSize: variableStates.interfaceSize, keyboardOrientation: variableStates.keyboardOrientation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,9 @@ import enum CustardKit.TabData
import enum KanaKanjiConverterModule.KeyboardLanguage

struct QwertyChangeKeyboardKeyModel<Extension: ApplicationSpecificKeyboardViewExtension>: QwertyKeyModelProtocol {

enum FallBackType {
case tabBar
case secondTab(secondLanguage: KeyboardLanguage)
}

func pressActions(variableStates: VariableStates) -> [ActionType] {
if SemiStaticStates.shared.needsInputModeSwitchKey {
return []
}
switch self.fallBackType {
case let .secondTab(secondLanguage: language):
let targetTab: TabData = {
switch language {
case .en_US:
return .system(.user_english)
case .ja_JP:
return .system(.user_japanese)
case .none, .el_GR:
return.system(.user_japanese)
}
}()
switch variableStates.tabManager.existentialTab() {
case .qwerty_hira:
return [.moveTab(.system(.qwerty_symbols))]
case .qwerty_abc:
return [.moveTab(.system(.qwerty_symbols))]
case .qwerty_number:
return [.moveTab(targetTab)]
case .qwerty_symbols:
return [.moveTab(targetTab)]
default:
return [.setCursorBar(.toggle)]
}
case .tabBar:
return [.setTabBar(.toggle)]
}
[]
}
let fallBackType: FallBackType

func longPressActions(variableStates _: VariableStates) -> LongpressActionType {
.none
Expand All @@ -63,32 +27,12 @@ struct QwertyChangeKeyboardKeyModel<Extension: ApplicationSpecificKeyboardViewEx
let keySizeType: QwertyKeySizeType
let unpressedKeyColorType: QwertyUnpressedKeyColorType = .special

init(keySizeType: QwertyKeySizeType, fallBackType: FallBackType) {
init(keySizeType: QwertyKeySizeType) {
self.keySizeType = keySizeType
self.fallBackType = fallBackType
}

func label<E: ApplicationSpecificKeyboardViewExtension>(width: CGFloat, states: VariableStates, color: Color?) -> KeyLabel<E> {
if SemiStaticStates.shared.needsInputModeSwitchKey {
return KeyLabel(.changeKeyboard, width: width, textColor: color)
}
switch self.fallBackType {
case let .secondTab(secondLanguage: language):
switch states.tabManager.existentialTab() {
case .qwerty_hira:
return KeyLabel(.text("#+="), width: width, textColor: color)
case .qwerty_abc:
return KeyLabel(.text("#+="), width: width, textColor: color)
case .qwerty_number:
return KeyLabel(.text(language.symbol), width: width, textColor: color)
case .qwerty_symbols:
return KeyLabel(.text(language.symbol), width: width, textColor: color)
default:
return KeyLabel(.image("arrowtriangle.left.and.line.vertical.and.arrowtriangle.right"), width: width)
}
case .tabBar:
return KeyLabel(.image("list.bullet"), width: width, textColor: color)
}
KeyLabel(.changeKeyboard, width: width, textColor: color)
}

func feedback(variableStates: VariableStates) {
Expand Down
Loading

0 comments on commit 4099def

Please sign in to comment.