Skip to content

Commit

Permalink
Merge pull request #351 from ensan-hcl/refactoring/apply_format_and_lint
Browse files Browse the repository at this point in the history
[Refactoring] swiftlintを適用
  • Loading branch information
ensan-hcl authored Oct 29, 2023
2 parents c161f7f + 66f2e4f commit 87cb9e4
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct SimpleKeyModel<Extension: ApplicationSpecificKeyboardViewExtension>: Simp
func pressActions(variableStates: VariableStates) -> [ActionType] {
pressActions
}

func longPressActions(variableStates: VariableStates) -> LongpressActionType {
longPressActions
}
Expand Down Expand Up @@ -132,7 +132,7 @@ struct SimpleEnterKeyModel<Extension: ApplicationSpecificKeyboardViewExtension>:

struct SimpleNextCandidateKeyModel<Extension: ApplicationSpecificKeyboardViewExtension>: SimpleKeyModelProtocol {
var unpressedKeyColorType: SimpleUnpressedKeyColorType = .normal

func pressActions(variableStates: VariableStates) -> [ActionType] {
if variableStates.resultModel.results.isEmpty {
[.input(" ")]
Expand Down Expand Up @@ -168,7 +168,6 @@ struct SimpleNextCandidateKeyModel<Extension: ApplicationSpecificKeyboardViewExt
}
}


struct SimpleChangeKeyboardKeyModel<Extension: ApplicationSpecificKeyboardViewExtension>: SimpleKeyModelProtocol {
func pressActions(variableStates: VariableStates) -> [ActionType] {
if SemiStaticStates.shared.needsInputModeSwitchKey {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct FlickChangeKeyboardModel<Extension: ApplicationSpecificKeyboardViewExtens
return [.setCursorBar(.toggle)]
}
}
func longPressActions(variableStates _: VariableStates) -> LongpressActionType {
func longPressActions(variableStates _: VariableStates) -> LongpressActionType {
.none
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct KeyboardBarView<Extension: ApplicationSpecificKeyboardViewExtension>: Vie
@Binding private var isResultViewExpanded: Bool
@Environment(Extension.Theme.self) private var theme
// CursorBarは操作がない場合に非表示にする。これをハンドルするためのタスク
@State private var dismissTask: Task<(), any Error>? = nil
@State private var dismissTask: Task<(), any Error>?

private var useReflectStyleCursorBar: Bool {
Extension.SettingProvider.useReflectStyleCursorBar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ private struct CursorBarState: Equatable, Hashable, Sendable {

struct ReflectStyleCursorBar<Extension: ApplicationSpecificKeyboardViewExtension>: View {
init() {}

@EnvironmentObject private var variableStates: VariableStates
@Environment(Extension.Theme.self) private var theme
@Environment(\.userActionManager) private var action

private enum SwipeGestureState {
case inactive
case tap(l1: CGPoint, l2: CGPoint, l3: CGPoint)
Expand All @@ -86,22 +86,22 @@ struct ReflectStyleCursorBar<Extension: ApplicationSpecificKeyboardViewExtension
@State private var swipeGestureState: SwipeGestureState = .inactive
@State private var cursorBarState = CursorBarState()
@State private var longPressTask: Task<(), any Error>?

@MainActor
private var fontSize: CGFloat {
Design.fonts.resultViewFontSize(userPrefrerence: Extension.SettingProvider.resultViewFontSize)
}

@MainActor
fileprivate var itemWidth: CGFloat {
fontSize * 1.3
}

@MainActor
fileprivate var viewWidth: CGFloat {
variableStates.interfaceSize.width * 0.85
}

@MainActor
var swipeGesture: some Gesture {
DragGesture(minimumDistance: 0, coordinateSpace: .global)
Expand Down Expand Up @@ -181,34 +181,34 @@ struct ReflectStyleCursorBar<Extension: ApplicationSpecificKeyboardViewExtension
swipeGestureState = .inactive
}
}

private var centerColor: Color {
theme.pushedKeyFillColor.color
}

private var edgeColor: Color {
theme.backgroundColor.color
}

private var symbolsFontWeight: Font.Weight {
theme.textFont.weight
}

private var symbolsColor: Color {
theme.resultTextColor.color
}

@MainActor
private var background: some View {
RadialGradient(gradient: Gradient(colors: [centerColor, edgeColor]), center: .center, startRadius: 1, endRadius: viewWidth / 2)
.cornerRadius(20)
.gesture(swipeGesture)
}

private func symbolFont(size: CGFloat) -> Font {
.system(size: size, weight: symbolsFontWeight, design: .default)
}

@MainActor
private var textView: some View {
HStack(spacing: .zero) {
Expand All @@ -232,7 +232,7 @@ struct ReflectStyleCursorBar<Extension: ApplicationSpecificKeyboardViewExtension
.frame(width: viewWidth)
.clipped()
}

@MainActor
private var foregroundButtons: some View {
ZStack(alignment: .center) {
Expand Down Expand Up @@ -292,7 +292,7 @@ struct ReflectStyleCursorBar<Extension: ApplicationSpecificKeyboardViewExtension
}
}
}

var body: some View {
background
.overlay(foregroundButtons)
Expand Down Expand Up @@ -323,4 +323,3 @@ struct ReflectStyleCursorBar<Extension: ApplicationSpecificKeyboardViewExtension
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct SliderStyleCursorBar<Extension: ApplicationSpecificKeyboardViewExtension>
swipeGestureState = .moving(l1: value.location, l2: l1, l3: l2, count: count)
}
}
.onEnded {value in
.onEnded {_ in
swipeGestureState = .inactive
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import SwiftUI

struct QwertyNextCandidateKeyModel<Extension: ApplicationSpecificKeyboardViewExtension>: QwertyKeyModelProtocol {
let keySizeType: QwertyKeySizeType = .space

let needSuggestView: Bool = false

let variationsModel: VariationsModel = .init([])

let unpressedKeyColorType: QwertyUnpressedKeyColorType = .normal

static var shared: Self { QwertyNextCandidateKeyModel<Extension>() }

func pressActions(variableStates: VariableStates) -> [ActionType] {
Expand Down
2 changes: 1 addition & 1 deletion MainApp/Customize/CodableActionDataEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extension CodableActionData {
case .paste: return "ペーストする"
case .moveTab: return "タブの移動"
case .replaceLastCharacters: return "文字を置換"
case let .selectCandidate(selection):
case let .selectCandidate(selection):
return switch selection {
case .first: "最初の候補を選択"
case .last: "最後の候補を選択"
Expand Down
2 changes: 1 addition & 1 deletion MainApp/Setting/OpenSourceSoftwaresLicenseView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private struct FunnyAzooKeyIcon: View {
init(stage: Stage = .normal) {
self._stage = .init(initialValue: stage)
}

struct NormalAnimationValue {
// degrees
var angle: Double = -10
Expand Down

0 comments on commit 87cb9e4

Please sign in to comment.