Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ClickIt/ClickIt.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<key>com.apple.security.app-sandbox</key>
<false/>

<!-- Essential entitlement for Accessibility API access -->
<key>com.apple.security.automation.apple-events</key>
<true/>
Comment on lines +10 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The comment "Essential entitlement for Accessibility API access" is imprecise. This entitlement grants permission to send Apple Events to control other applications. While related to accessibility, it's distinct from the main Accessibility permission. For clarity, describe its specific purpose.

	<!-- Allows the app to send Apple Events to control other applications -->
	<key>com.apple.security.automation.apple-events</key>
	<true/>


<!-- Allow ClickIt to read user-selected files if needed -->
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
Expand Down
24 changes: 13 additions & 11 deletions Sources/ClickIt/UI/Components/ActiveTimerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,17 @@ struct ActiveTimerView: View {
}
}

#Preview {
ActiveTimerView(viewModel: {
let vm = ClickItViewModel()
vm.isCountingDown = true
vm.remainingTime = 123 // 2:03
vm.timerDurationMinutes = 2
vm.timerDurationSeconds = 30
return vm
}())
.frame(width: 350)
.padding()
struct ActiveTimerView_Previews: PreviewProvider {
static var previews: some View {
ActiveTimerView(viewModel: {
let vm = ClickItViewModel()
vm.isCountingDown = true
vm.remainingTime = 123 // 2:03
vm.timerDurationMinutes = 2
vm.timerDurationSeconds = 30
return vm
}())
.frame(width: 350)
.padding()
}
}
Comment on lines +103 to 116
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    ActiveTimerView(viewModel: {
        let vm = ClickItViewModel()
        vm.isCountingDown = true
        vm.remainingTime = 123 // 2:03
        vm.timerDurationMinutes = 2
        vm.timerDurationSeconds = 30
        return vm
    }())
    .frame(width: 350)
    .padding()
}

10 changes: 6 additions & 4 deletions Sources/ClickIt/UI/Components/AdvancedSettingsButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ struct AdvancedSettingsButton: View {
}
}

#Preview {
AdvancedSettingsButton(viewModel: ClickItViewModel())
.frame(width: 400)
.padding()
struct AdvancedSettingsButton_Previews: PreviewProvider {
static var previews: some View {
AdvancedSettingsButton(viewModel: ClickItViewModel())
.frame(width: 400)
.padding()
}
}
Comment on lines +49 to 55
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    AdvancedSettingsButton(viewModel: ClickItViewModel())
        .frame(width: 400)
        .padding()
}

10 changes: 6 additions & 4 deletions Sources/ClickIt/UI/Components/ClickPointSelector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,11 @@ struct ClickCoordinateCapture {
}
}

#Preview {
ClickPointSelector { point in
print("Selected point: \(point)")
struct ClickPointSelector_Previews: PreviewProvider {
static var previews: some View {
ClickPointSelector { point in
print("Selected point: \(point)")
}
.frame(width: 400, height: 500)
}
.frame(width: 400, height: 500)
}
Comment on lines +227 to 234
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    ClickPointSelector { point in
        print("Selected point: \(point)")
    }
    .frame(width: 400, height: 500)
}

10 changes: 6 additions & 4 deletions Sources/ClickIt/UI/Components/ConfigurationPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,10 @@ struct ConfigurationPanel: View {
}
}

#Preview {
ConfigurationPanel(selectedClickPoint: CGPoint(x: 100, y: 100))
.environmentObject(ClickCoordinator.shared)
.frame(width: 400, height: 600)
struct ConfigurationPanel_Previews: PreviewProvider {
static var previews: some View {
ConfigurationPanel(selectedClickPoint: CGPoint(x: 100, y: 100))
.environmentObject(ClickCoordinator.shared)
.frame(width: 400, height: 600)
}
}
Comment on lines +397 to 403
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    ConfigurationPanel(selectedClickPoint: CGPoint(x: 100, y: 100))
        .environmentObject(ClickCoordinator.shared)
        .frame(width: 400, height: 600)
}

20 changes: 11 additions & 9 deletions Sources/ClickIt/UI/Components/ConfigurationPanelCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,15 @@ struct TimeInputField: View {
}
}

#Preview {
ConfigurationPanelCard(viewModel: {
let vm = ClickItViewModel()
vm.intervalSeconds = 1
vm.intervalMilliseconds = 500
return vm
}())
.frame(width: 400)
.padding()
struct ConfigurationPanelCard_Previews: PreviewProvider {
static var previews: some View {
ConfigurationPanelCard(viewModel: {
let vm = ClickItViewModel()
vm.intervalSeconds = 1
vm.intervalMilliseconds = 500
return vm
}())
.frame(width: 400)
.padding()
}
}
Comment on lines +187 to 198
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    ConfigurationPanelCard(viewModel: {
        let vm = ClickItViewModel()
        vm.intervalSeconds = 1
        vm.intervalMilliseconds = 500
        return vm
    }())
    .frame(width: 400)
    .padding()
}

6 changes: 4 additions & 2 deletions Sources/ClickIt/UI/Components/DeveloperUpdateButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ struct DeveloperUpdateButton: View {
}
}

#Preview {
DeveloperUpdateButton(updaterManager: UpdaterManager())
struct DeveloperUpdateButton_Previews: PreviewProvider {
static var previews: some View {
DeveloperUpdateButton(updaterManager: UpdaterManager())
}
}
Comment on lines +57 to 61
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    DeveloperUpdateButton(updaterManager: UpdaterManager())
}

10 changes: 6 additions & 4 deletions Sources/ClickIt/UI/Components/FooterInfoCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ struct FooterInfoCard: View {
}
}

#Preview {
FooterInfoCard()
.frame(width: 400)
.padding()
struct FooterInfoCard_Previews: PreviewProvider {
static var previews: some View {
FooterInfoCard()
.frame(width: 400)
.padding()
}
}
Comment on lines +32 to 38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    FooterInfoCard()
        .frame(width: 400)
        .padding()
}

16 changes: 9 additions & 7 deletions Sources/ClickIt/UI/Components/PermissionStatusIndicator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,14 @@ struct PermissionHealthBadge: View {
}
}

#Preview("Permission Status Indicator") {
VStack(spacing: 16) {
PermissionStatusIndicator()
CompactPermissionStatus()
PermissionHealthBadge()
struct PermissionStatusIndicator_Previews: PreviewProvider {
static var previews: some View {
VStack(spacing: 16) {
PermissionStatusIndicator()
CompactPermissionStatus()
PermissionHealthBadge()
}
.padding()
.environmentObject(PermissionManager.shared)
}
.padding()
.environmentObject(PermissionManager.shared)
}
Comment on lines +199 to 209
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview("Permission Status Indicator") {
    VStack(spacing: 16) {
        PermissionStatusIndicator()
        CompactPermissionStatus()
        PermissionHealthBadge()
    }
    .padding()
    .environmentObject(PermissionManager.shared)
}

76 changes: 39 additions & 37 deletions Sources/ClickIt/UI/Components/RealTimeElapsedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,45 +45,47 @@ struct ElapsedTimeStatisticView: View {
}
}

#Preview("Real Time Elapsed View") {
VStack(spacing: 20) {
Text("Real-Time Elapsed Time Display")
.font(.headline)

RealTimeElapsedView(timeManager: {
let manager = ElapsedTimeManager.shared
manager.startTracking()
return manager
}())

Button("Start/Stop Tracking") {
let manager = ElapsedTimeManager.shared
if manager.isTracking {
manager.stopTracking()
} else {
struct RealTimeElapsedView_Previews: PreviewProvider {
static var previews: some View {
VStack(spacing: 20) {
Text("Real-Time Elapsed Time Display")
.font(.headline)

RealTimeElapsedView(timeManager: {
let manager = ElapsedTimeManager.shared
manager.startTracking()
return manager
}())

Button("Start/Stop Tracking") {
let manager = ElapsedTimeManager.shared
if manager.isTracking {
manager.stopTracking()
} else {
manager.startTracking()
}
}
.buttonStyle(.borderedProminent)
}
.buttonStyle(.borderedProminent)
}
.padding()
.frame(width: 300)
}

#Preview("Elapsed Time Statistic") {
ElapsedTimeStatisticView(
timeManager: ElapsedTimeManager.shared,
fallbackStatistics: SessionStatistics(
duration: 125,
totalClicks: 50,
successfulClicks: 48,
failedClicks: 2,
successRate: 0.96,
averageClickTime: 0.05,
clicksPerSecond: 2.4,
isActive: false
.padding()
.frame(width: 300)
.previewDisplayName("Real Time Elapsed View")

ElapsedTimeStatisticView(
timeManager: ElapsedTimeManager.shared,
fallbackStatistics: SessionStatistics(
duration: 125,
totalClicks: 50,
successfulClicks: 48,
failedClicks: 2,
successRate: 0.96,
averageClickTime: 0.05,
clicksPerSecond: 2.4,
isActive: false
)
)
)
.frame(width: 120, height: 100)
.padding()
.frame(width: 120, height: 100)
.padding()
.previewDisplayName("Elapsed Time Statistic")
}
}
Comment on lines +48 to 91
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview("Real Time Elapsed View") {
    VStack(spacing: 20) {
        Text("Real-Time Elapsed Time Display")
            .font(.headline)
        
        RealTimeElapsedView(timeManager: {
            let manager = ElapsedTimeManager.shared
            manager.startTracking()
            return manager
        }())
        
        Button("Start/Stop Tracking") {
            let manager = ElapsedTimeManager.shared
            if manager.isTracking {
                manager.stopTracking()
            } else {
                manager.startTracking()
            }
        }
        .buttonStyle(.borderedProminent)
    }
    .padding()
    .frame(width: 300)
}

#Preview("Elapsed Time Statistic") {
    ElapsedTimeStatisticView(
        timeManager: ElapsedTimeManager.shared,
        fallbackStatistics: SessionStatistics(
            duration: 125,
            totalClicks: 50,
            successfulClicks: 48,
            failedClicks: 2,
            successRate: 0.96,
            averageClickTime: 0.05,
            clicksPerSecond: 2.4,
            isActive: false
        )
    )
    .frame(width: 120, height: 100)
    .padding()
}

10 changes: 6 additions & 4 deletions Sources/ClickIt/UI/Components/StatisticsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ struct StatisticsView: View {
}
}

#Preview {
StatisticsView()
.environmentObject(ClickCoordinator.shared)
.frame(width: 300, height: 100)
struct StatisticsView_Previews: PreviewProvider {
static var previews: some View {
StatisticsView()
.environmentObject(ClickCoordinator.shared)
.frame(width: 300, height: 100)
}
}
Comment on lines +63 to 69
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    StatisticsView()
        .environmentObject(ClickCoordinator.shared)
        .frame(width: 300, height: 100)
}

10 changes: 6 additions & 4 deletions Sources/ClickIt/UI/Components/StatusHeaderCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ struct StatisticView: View {
}
}

#Preview {
StatusHeaderCard(viewModel: ClickItViewModel())
.frame(width: 400)
.padding()
struct StatusHeaderCard_Previews: PreviewProvider {
static var previews: some View {
StatusHeaderCard(viewModel: ClickItViewModel())
.frame(width: 400)
.padding()
}
}
Comment on lines +126 to 132
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    StatusHeaderCard(viewModel: ClickItViewModel())
        .frame(width: 400)
        .padding()
}

18 changes: 10 additions & 8 deletions Sources/ClickIt/UI/Components/TargetPointSelectionCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,14 @@ struct CoordinateDisplay: View {
}
}

#Preview {
TargetPointSelectionCard(viewModel: {
let vm = ClickItViewModel()
vm.setTargetPoint(CGPoint(x: 1007, y: 260))
return vm
}())
.frame(width: 400)
.padding()
struct TargetPointSelectionCard_Previews: PreviewProvider {
static var previews: some View {
TargetPointSelectionCard(viewModel: {
let vm = ClickItViewModel()
vm.setTargetPoint(CGPoint(x: 1007, y: 260))
return vm
}())
.frame(width: 400)
.padding()
}
}
Comment on lines +294 to 304
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    TargetPointSelectionCard(viewModel: {
        let vm = ClickItViewModel()
        vm.setTargetPoint(CGPoint(x: 1007, y: 260))
        return vm
    }())
    .frame(width: 400)
    .padding()
}

20 changes: 11 additions & 9 deletions Sources/ClickIt/UI/Components/TimerConfigurationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,15 @@ struct TimerConfigurationView: View {
}
}

#Preview {
TimerConfigurationView(viewModel: {
let vm = ClickItViewModel()
vm.timerDurationMinutes = 0
vm.timerDurationSeconds = 15
return vm
}())
.frame(width: 350)
.padding()
struct TimerConfigurationView_Previews: PreviewProvider {
static var previews: some View {
TimerConfigurationView(viewModel: {
let vm = ClickItViewModel()
vm.timerDurationMinutes = 0
vm.timerDurationSeconds = 15
return vm
}())
.frame(width: 350)
.padding()
}
}
Comment on lines +151 to 162
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    TimerConfigurationView(viewModel: {
        let vm = ClickItViewModel()
        vm.timerDurationMinutes = 0
        vm.timerDurationSeconds = 15
        return vm
    }())
    .frame(width: 350)
    .padding()
}

6 changes: 4 additions & 2 deletions Sources/ClickIt/UI/Components/UpdateNotificationCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ struct InfoRow: View {
}
}

#Preview {
UpdateNotificationCard(updaterManager: UpdaterManager())
struct UpdateNotificationCard_Previews: PreviewProvider {
static var previews: some View {
UpdateNotificationCard(updaterManager: UpdaterManager())
}
}
Comment on lines +207 to 211
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    UpdateNotificationCard(updaterManager: UpdaterManager())
}

6 changes: 4 additions & 2 deletions Sources/ClickIt/UI/Views/AdvancedSettingsWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ struct AdvancedSettingsWindow: View {
}
}

#Preview {
AdvancedSettingsWindow(viewModel: ClickItViewModel())
struct AdvancedSettingsWindow_Previews: PreviewProvider {
static var previews: some View {
AdvancedSettingsWindow(viewModel: ClickItViewModel())
}
}
Comment on lines +109 to 113
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    AdvancedSettingsWindow(viewModel: ClickItViewModel())
}

12 changes: 7 additions & 5 deletions Sources/ClickIt/UI/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,11 @@ struct ContentView: View {
}
}

#Preview {
ContentView()
.environmentObject(PermissionManager.shared)
.environmentObject(HotkeyManager.shared)
.environmentObject(ClickItViewModel())
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.environmentObject(PermissionManager.shared)
.environmentObject(HotkeyManager.shared)
.environmentObject(ClickItViewModel())
}
}
Comment on lines +152 to 159
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    ContentView()
        .environmentObject(PermissionManager.shared)
        .environmentObject(HotkeyManager.shared)
        .environmentObject(ClickItViewModel())
}

8 changes: 5 additions & 3 deletions Sources/ClickIt/UI/Views/PermissionRequestView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ struct PermissionInstructionsView: View {
}
}

#Preview {
PermissionRequestView()
.environmentObject(PermissionManager.shared)
struct PermissionRequestView_Previews: PreviewProvider {
static var previews: some View {
PermissionRequestView()
.environmentObject(PermissionManager.shared)
}
}
Comment on lines +345 to 350
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    PermissionRequestView()
        .environmentObject(PermissionManager.shared)
}

6 changes: 4 additions & 2 deletions Sources/ClickIt/UI/Views/PermissionsGateView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ struct PermissionGateRow: View {
}
}

#Preview {
PermissionsGateView()
struct PermissionsGateView_Previews: PreviewProvider {
static var previews: some View {
PermissionsGateView()
}
}
Comment on lines +254 to 258
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change replaces the modern #Preview macro with the older PreviewProvider struct. Given that AppConstants.minimumOSVersion is set to "macOS 15.0", the #Preview macro is fully supported. Unless there's a specific reason for this change, revert to the #Preview macro for better code clarity.

#Preview {
    PermissionsGateView()
}

Loading
Loading