Commit f03130c
feat: Convert Lite click interval to CPS with extended range (#19)
* feat: Convert Lite click interval to CPS with extended range
- Replace fixed interval slider (0.1-10s) with logarithmic CPS slider
- Support range from 100 CPS (0.01s) to 1 click per 5 minutes (300s)
- Add dynamic formatting: shows CPS for fast speeds, descriptive text for slow
- Include human-readable descriptions with emojis (⚡ Very Fast to 🦥 Ultra Slow)
- Implement logarithmic scale for smooth control across wide range
- Add validation clamping (0.01s min, 300s max) to prevent unsafe speeds
- Update UI labels and help text to reflect new CPS-based interface
Addresses user request for more precise control over click timing,
especially for high-speed automation (up to 100 CPS).
* refactor: Extract magic numbers and use switch statements
Code quality improvements based on code review:
- Add SpeedLimit enum with named constants for intervals and CPS limits
- minInterval (0.01s = 100 CPS)
- maxInterval (300s = 1 click per 5 min)
- safeGuardInterval (0.001s to prevent division by zero)
- Add SpeedThreshold enum with named constants for speed tiers
- CPS thresholds for formatting (high/medium/low)
- CPS thresholds for descriptions (veryFast/fast/normal)
- Interval thresholds for slow speeds (slow/verySlow)
- Refactor formatClickSpeed() to use switch statement
- Replace if/else chain with pattern matching
- More idiomatic Swift code
- Refactor describeClickSpeed() to use nested switch statements
- Primary switch on CPS for fast speeds
- Secondary switch on interval for slow speeds
- Eliminates all magic numbers
Benefits:
- Self-documenting code with clear intent
- Easier to maintain and adjust thresholds
- More idiomatic Swift patterns
- Better readability
---------
Co-authored-by: Claude <[email protected]>1 parent fe58959 commit f03130c
1 file changed
+110
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
12 | 40 | | |
13 | 41 | | |
14 | 42 | | |
| |||
164 | 192 | | |
165 | 193 | | |
166 | 194 | | |
167 | | - | |
| 195 | + | |
168 | 196 | | |
169 | 197 | | |
170 | | - | |
| 198 | + | |
171 | 199 | | |
172 | 200 | | |
173 | 201 | | |
174 | 202 | | |
175 | | - | |
176 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
177 | 223 | | |
178 | 224 | | |
179 | | - | |
| 225 | + | |
180 | 226 | | |
181 | 227 | | |
182 | 228 | | |
183 | | - | |
| 229 | + | |
184 | 230 | | |
185 | 231 | | |
186 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
187 | 291 | | |
188 | 292 | | |
189 | 293 | | |
| |||
0 commit comments