File tree Expand file tree Collapse file tree 4 files changed +80
-3
lines changed
CoreKit/Sources/Data/Client/Keyboard
Feature/FeatureCategorySetting/Sources Expand file tree Collapse file tree 4 files changed +80
-3
lines changed Original file line number Diff line number Diff line change 1+ //
2+ // KeyboardClient+LiveKey.swift
3+ // CoreKit
4+ //
5+ // Created by ๊น๋ฏผํธ on 3/31/25.
6+ //
7+
8+ import UIKit
9+ import Combine
10+ import Dependencies
11+
12+ extension KeyboardClient : DependencyKey {
13+ public static let liveValue : Self = {
14+ . init(
15+ isVisible: {
16+ AsyncStream { continuation in
17+ let notificationCenter = NotificationCenter . default
18+
19+ let showObserver = notificationCenter
20+ . publisher ( for: UIResponder . keyboardWillShowNotification)
21+ . map { _ in true }
22+
23+ let hideObserver = notificationCenter
24+ . publisher ( for: UIResponder . keyboardWillHideNotification)
25+ . map { _ in false }
26+
27+ let cancellable = Publishers . Merge ( showObserver, hideObserver)
28+ . removeDuplicates ( )
29+ . sink { isVisible in
30+ continuation. yield ( isVisible)
31+ }
32+
33+ continuation. onTermination = { _ in cancellable. cancel ( ) }
34+ }
35+ }
36+ )
37+ } ( )
38+ }
39+
Original file line number Diff line number Diff line change 1+ //
2+ // KeyboardClient+TestKey.swift
3+ // CoreKit
4+ //
5+ // Created by ๊น๋ฏผํธ on 3/31/25.
6+ //
7+
8+ import Foundation
9+
10+ import Dependencies
11+
12+ extension KeyboardClient : TestDependencyKey {
13+ public static let previewValue = Self . noop
14+ }
15+
16+ extension KeyboardClient {
17+ public static let noop = Self (
18+ isVisible: { . finished }
19+ )
20+ }
Original file line number Diff line number Diff line change 1+ //
2+ // KeyboardClient.swift
3+ // CoreKit
4+ //
5+ // Created by ๊น๋ฏผํธ on 3/31/25.
6+ //
7+
8+ import Foundation
9+
10+ import DependenciesMacros
11+
12+ @DependencyClient
13+ public struct KeyboardClient : Sendable {
14+ public var isVisible : @Sendable ( ) async -> AsyncStream < Bool > = { . finished }
15+ }
Original file line number Diff line number Diff line change @@ -37,13 +37,16 @@ public extension PokitCategorySettingView {
3737 openTypeSettingSection
3838 keywordSection
3939 Spacer ( )
40+ }
41+ . padding ( . top, 16 )
42+ . pokitNavigationBar { navigationBar }
43+ . overlay ( alignment: . bottom) {
4044 saveButton
45+ . padding ( . bottom, store. isKeyboardVisible ? - 26 : 0 )
4146 }
4247 . padding ( . horizontal, 20 )
43- . padding ( . top, 16 )
4448 . pokitMaxWidth ( )
45- . pokitNavigationBar { navigationBar }
46- . ignoresSafeArea ( edges: isFocused ? [ ] : . bottom)
49+ . ignoresSafeArea ( . container, edges: . bottom)
4750 . sheet ( isPresented: $store. isProfileSheetPresented) {
4851 PokitProfileBottomSheet (
4952 selectedImage: store. selectedProfile,
You canโt perform that action at this time.
0 commit comments