Skip to content

Commit 1359570

Browse files
authored
Merge pull request #137 from karbassi/fix/deployment-target-and-occlusion
Modernize codebase: Swift 6, tests, and cleanup
2 parents 0f6ad38 + d1b7d16 commit 1359570

41 files changed

Lines changed: 3018 additions & 1595 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
runs-on: macos-latest
1212
steps:
1313
- name: Checkout code
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v4
1515

1616
- name: Clean project
17-
run: xcodebuild clean
17+
run: xcodebuild clean
1818

1919
- name: Build project
2020
run: xcodebuild build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
@@ -24,24 +24,8 @@ jobs:
2424
cd ./build/Release/
2525
zip -r "../../Timer.app.zip" "Timer.app/"
2626
27-
- name: Create Release
28-
id: create_release
29-
uses: actions/create-release@v1
30-
env:
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
- name: Create Release and Upload Asset
28+
uses: softprops/action-gh-release@v2
3229
with:
33-
tag_name: ${{ github.ref }}
34-
release_name: ${{ github.ref }}
3530
draft: true
36-
prerelease: false
37-
38-
- name: Upload Release Asset
39-
id: upload-release-asset
40-
uses: actions/upload-release-asset@v1
41-
env:
42-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
with:
44-
upload_url: ${{ steps.create_release.outputs.upload_url }}
45-
asset_path: ./Timer.app.zip
46-
asset_name: Timer.app.zip
47-
asset_content_type: application/zip
31+
files: Timer.app.zip

.github/workflows/swift.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@ name: Swift
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [ main ]
66
pull_request:
7-
branches: [ master ]
7+
branches: [ main ]
88

99
jobs:
1010
build:
1111

1212
runs-on: macos-latest
1313

1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616
- name: Clean
1717
run: xcodebuild clean
1818
- name: Build
19-
run: xcodebuild build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
20-
19+
run: xcodebuild build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
20+
- name: Test
21+
run: xcodebuild test -scheme Timer -destination 'platform=macOS' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

.github/workflows/swiftlint.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,10 @@ on:
99

1010
jobs:
1111
SwiftLint:
12-
runs-on: ubuntu-latest
12+
runs-on: macos-latest
1313
steps:
14-
- uses: actions/checkout@v1
15-
- name: GitHub Action for SwiftLint
16-
uses: norio-nomura/action-swiftlint@3.1.0
17-
- name: GitHub Action for SwiftLint with --strict
18-
uses: norio-nomura/action-swiftlint@3.1.0
19-
with:
20-
args: --strict
21-
- name: GitHub Action for SwiftLint (Only files changed in the PR)
22-
uses: norio-nomura/action-swiftlint@3.1.0
23-
env:
24-
DIFF_BASE: ${{ github.base_ref }}
14+
- uses: actions/checkout@v4
15+
- name: Install SwiftLint
16+
run: brew install swiftlint
17+
- name: Lint
18+
run: swiftlint --strict

.swiftlint.yml

Lines changed: 60 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,91 @@
1-
# rule identifiers to exclude from running
2-
disabled_rules:
3-
- type_body_length
4-
- function_body_length
5-
- file_length
6-
- unneeded_break_in_switch
7-
81
# some rules are only opt-in
92
# Find all the available rules by running: swiftlint rules
103
opt_in_rules:
11-
- anyobject_protocol
4+
- array_init
5+
- balanced_xctest_lifecycle
126
- closure_end_indentation
137
- closure_spacing
148
- collection_alignment
9+
- comma_inheritance
10+
- contains_over_filter_count
11+
- contains_over_filter_is_empty
12+
- contains_over_first_not_nil
13+
- contains_over_range_nil_comparison
14+
- convenience_type
15+
- direct_return
16+
- discarded_notification_center_observer
17+
- discouraged_optional_boolean
18+
- discouraged_optional_collection
19+
- empty_collection_literal
1520
- empty_count
21+
- empty_string
22+
- empty_xctest_method
1623
- explicit_init
17-
- explicit_self
24+
- fatal_error_message
25+
- final_test_case
26+
- first_where
27+
- flatmap_over_map_reduce
28+
- force_unwrapping
29+
- function_default_parameter_at_end
30+
- identical_operands
1831
- implicit_return
32+
- implicitly_unwrapped_optional
1933
- joined_default_parameter
34+
- last_where
35+
- legacy_multiple
2036
- literal_expression_end_indentation
37+
- lower_acl_than_parent
2138
- modifier_order
22-
# - number_separator
39+
- no_empty_block
40+
- non_overridable_class_declaration
41+
- number_separator
2342
- operator_usage_whitespace
2443
- optional_enum_case_matching
44+
- pattern_matching_keywords
45+
- period_spacing
46+
- prefer_condition_list
47+
- prefer_key_path
48+
- prefer_self_in_static_references
2549
- prefer_self_type_over_type_of_self
50+
- prefer_zero_over_explicit_init
51+
- private_over_fileprivate
52+
- reduce_into
2653
- redundant_nil_coalescing
2754
- redundant_type_annotation
55+
- return_value_from_void_function
56+
- self_binding
57+
- shorthand_argument
58+
- shorthand_optional_binding
59+
- sorted_enum_cases
60+
- sorted_first_last
2861
- sorted_imports
62+
- static_over_final_class
63+
- superfluous_else
2964
- toggle_bool
65+
- trailing_closure
66+
- unhandled_throwing_task
3067
- unneeded_parentheses_in_closure_argument
68+
- unowned_variable_capture
3169
- untyped_error_in_catch
32-
- unused_import
70+
- unused_parameter
71+
- vertical_parameter_alignment_on_call
3372
- vertical_whitespace_between_cases
3473
- vertical_whitespace_closing_braces
3574
- vertical_whitespace_opening_braces
75+
- weak_delegate
76+
- xct_specific_matcher
77+
- yoda_condition
78+
79+
analyzer_rules:
80+
- explicit_self
81+
- unused_import
3682

3783
included:
3884
- Timer
85+
- TimerTests
86+
- TimerUITests
87+
3988

40-
excluded:
41-
- Timer/Keycodes.swift
4289

4390
# reporter type (xcode, json, csv, checkstyle, junit, html, emoji, sonarqube, markdown)
4491
reporter: 'xcode'

CHANGELOG.md

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- 43 unit tests and 38 UI tests
13+
- Xcode schemes for running tests; `make test` and `make uitest` targets
14+
- `make lint`, `make analyze`, and `make format` targets
15+
- CI test step in build workflow
16+
- Sound choice persists across launches
17+
- Dark mode color support
18+
- VoiceOver accessibility for timer state and arrow control
19+
20+
### Changed
21+
22+
- Upgraded to Swift 6
23+
- Raised deployment target to macOS 14 (Sonoma)
24+
- Replaced deprecated `NSUserNotification` with `UNUserNotificationCenter`
25+
- Adopted `async`/`await` throughout (timers, notifications, authorization)
26+
- Improved keyboard input to use character-based matching (better international keyboard support)
27+
- Reduced per-frame allocations by caching gradients, images, paths, and formatters
28+
- Extracted reusable logic into `TimerLogic` for testability
29+
- Split large files to stay within default SwiftLint thresholds
30+
- Modernized Xcode project settings and build configuration
31+
- Expanded SwiftLint opt-in rules from 6 to 73
32+
- General code cleanup: tightened access control, removed force unwraps, reduced Obj-C surface
33+
34+
### Removed
35+
36+
- `Keycodes.swift` (replaced by character-based key matching)
37+
- ~500 lines of unused XIB menus and dead code
38+
- Deprecated `Info.plist` keys
39+
40+
### Fixed
41+
42+
- Window occlusion detection now checks actual visibility, not just window ordering
43+
- Secondary timer windows no longer overwrite the primary window's saved position
44+
45+
### CI
46+
47+
- Updated all GitHub Actions to current versions
48+
- Replaced deprecated SwiftLint and release actions
49+
50+
## [1.6.0] - 2021-01-08
51+
52+
### Added
53+
54+
- Sound selection menu: choose between 3 sounds or no sound (#107)
55+
56+
### Changed
57+
58+
- Updated cask install instructions (#106)
59+
- Updated brew cask command format (#98)
60+
61+
## [1.5.5] - 2020-07-16
62+
63+
### Fixed
64+
65+
- Simplified and fixed countdown display skipping seconds (#94)
66+
67+
### Changed
68+
69+
- Added SwiftLint for code style enforcement (#87)
70+
71+
## [1.5.4] - 2020-07-09
72+
73+
### Changed
74+
75+
- Use fixed-width font for less jittery countdown display (#86)
76+
77+
## [1.5.3] - 2020-04-23
78+
79+
### Changed
80+
81+
- Switch to `AVAudioPlayer` for playing the alert sound (#80)
82+
83+
## [1.5.2] - 2020-04-12
84+
85+
### Added
86+
87+
- Press `R` to restart with the last timer after Escape or completion (#75)
88+
89+
### Changed
90+
91+
- Updated text for "Show in Dock" menu option (#74)
92+
93+
## [1.5.1] - 2020-04-11
94+
95+
### Fixed
96+
97+
- Fixed buggy mouse control (#72)
98+
99+
## [1.5.0] - 2020-04-11
100+
101+
### Added
102+
103+
- Dark mode support (#67)
104+
- GitHub Actions for build and release (#62)
105+
- Issue templates and Code of Conduct (#63, #64)
106+
- Keyboard shortcuts documented in README (#65)
107+
- Makefile for build process (#47)
108+
109+
### Changed
110+
111+
- Updated window layout for Mojave compatibility (#50)
112+
- Improved battery life with timer tolerance and reduced display updates (#44)
113+
- Improved countdown precision to ~1/30 second with pre-timer for seconds-boundary alignment (#44)
114+
- Reduced CPU usage by 20x when window is hidden by tracking visibility (#44)
115+
- Window position auto-saved and restored across launches (#39)
116+
- Locale-aware time formatting with small-caps AM/PM (#38)
117+
- Migrated to Swift 4.1 (#37)
118+
- Windows properly deallocated when closed with weak references (#39)
119+
120+
### Fixed
121+
122+
- Fixed crash when reopening dock timer after switching dock assignment (#39)
123+
- Fixed memory leak in mouse event handling (#45)
124+
- Dock badge properly removed when unchecking "Show in Dock" (#42)
125+
126+
## [1.4] - 2018-08-08
127+
128+
### Added
129+
130+
- Keypad Enter support (#35)
131+
- Dock badge with timer countdown (#29)
132+
- Context menu with dock badge toggle (#29)
133+
- Current time label when idle (#27)
134+
- LICENSE file (#18)
135+
- `.gitignore` (#33)
136+
137+
### Changed
138+
139+
- Hidden unused menus (#34)
140+
- Compressed image assets (#32)
141+
142+
### Fixed
143+
144+
- Replaced `CGFloat(M_PI)` with `.pi` (#30)
145+
146+
## [1.3] - 2017-06-01
147+
148+
### Added
149+
150+
- Type seconds from keyboard — e.g., `.150` sets timer to 2:30 (#14)
151+
- Accept second values up to 599 (#14)
152+
153+
### Fixed
154+
155+
- Reduced beeping on key down (#15)
156+
157+
## [1.2] - 2017-02-13
158+
159+
### Added
160+
161+
- Homebrew cask install instructions
162+
- Stay on Top toggle with preference persistence (#9)
163+
164+
### Changed
165+
166+
- Migrated to Swift 3 (#8)
167+
168+
## [1.1.0] - 2016-05-18
169+
170+
### Added
171+
172+
- Keyboard input support
173+
- macOS 10.10 support
174+
175+
### Fixed
176+
177+
- Fixed countdown timing
178+
179+
## [1.0.2] - 2016-03-30
180+
181+
### Changed
182+
183+
- README updates
184+
185+
## [1.0.1] - 2016-03-30
186+
187+
### Fixed
188+
189+
- Fixed crash on launch
190+
191+
[Unreleased]: https://github.com/karbassi/timer-app/compare/1.6.0...HEAD
192+
[1.6.0]: https://github.com/michaelvillar/timer-app/compare/1.5.5...1.6.0
193+
[1.5.5]: https://github.com/michaelvillar/timer-app/compare/1.5.4...1.5.5
194+
[1.5.4]: https://github.com/michaelvillar/timer-app/compare/1.5.3...1.5.4
195+
[1.5.3]: https://github.com/michaelvillar/timer-app/compare/1.5.2...1.5.3
196+
[1.5.2]: https://github.com/michaelvillar/timer-app/compare/1.5.1...1.5.2
197+
[1.5.1]: https://github.com/michaelvillar/timer-app/compare/1.5.0...1.5.1
198+
[1.5.0]: https://github.com/michaelvillar/timer-app/compare/1.4...1.5.0
199+
[1.4]: https://github.com/michaelvillar/timer-app/compare/1.3...1.4
200+
[1.3]: https://github.com/michaelvillar/timer-app/compare/1.2...1.3
201+
[1.2]: https://github.com/michaelvillar/timer-app/compare/1.1.0...1.2
202+
[1.1.0]: https://github.com/michaelvillar/timer-app/compare/1.0.2...1.1.0
203+
[1.0.2]: https://github.com/michaelvillar/timer-app/compare/1.0.1...1.0.2
204+
[1.0.1]: https://github.com/michaelvillar/timer-app/releases/tag/1.0.1

0 commit comments

Comments
 (0)