Commit 918254a
authored
refactor: guard
## 📜 Description
Make configuration for `KeyboardTrackingView`.
## 💡 Motivation and Context
In `1.22.x` I want to re-write the algorithm for tracking keyboard (yes,
again) and switch back to legacy path (it looks like I found a better
way of managing things and I can deliver better experience than
`KeyboardLayoutGuide`).
But at the same time I don't want to drop the current code with
`KeyboardLayoutGuide`. So I decided to hide it under feature flag. If
users discover regressions - they can just toggle feature flag and
restore old behavior.
Also in future if my method stops to work again I can also toggle
feature flag and use modern path (when `KeyboardLayoutGuide` will be
stable).
To achieve this I added `KeyboardControllerConfiguration` with
`usesKeyboardLayoutGuideTracking` field. And repalced corresponding
`#available(iOS 26.0, *)` condition to `usesKeyboardLayoutGuideTracking`
field. Such code helps us:
- reduce code fragmentation;
- control things from one place;
- simplify the codebase and maintenance in the future.
While refactoring it I also realised that we don't need to attach
invisible `KeyboardLayoutGuide` on older iOS versions so I also guarded
this code with `usesKeyboardLayoutGuideTracking` flag.
## 📢 Changelog
<!-- High level overview of important changes -->
<!-- For example: fixed status bar manipulation; added new types
declarations; -->
<!-- If your changes don't affect one of platform/language below - then
remove this platform/language -->
### iOS
- added `KeyboardControllerConfiguration` file;
- guard `KeyboardLayoutGuide` code under
`usesKeyboardLayoutGuideTracking` flag;
## 🤔 How Has This Been Tested?
Tested via e2e test.
## 📸 Screenshots (if appropriate):
<img width="777" height="313" alt="Screenshot 2026-06-26 at 17 51 28"
src="https://github.com/user-attachments/assets/d1f24f3d-509f-4dfa-a914-a9413ca84b25"
/>
## 📝 Checklist
- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changedKeyboardLayoutGuide path through config (instead of direct checks) (#1517)1 parent 83e622e commit 918254a
2 files changed
Lines changed: 22 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
120 | 122 | | |
121 | 123 | | |
122 | 124 | | |
123 | | - | |
| 125 | + | |
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| |||
135 | 137 | | |
136 | 138 | | |
137 | 139 | | |
138 | | - | |
| 140 | + | |
139 | 141 | | |
140 | 142 | | |
141 | 143 | | |
| |||
0 commit comments