-
Notifications
You must be signed in to change notification settings - Fork 0
Improve error handling in API requests #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #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()
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
AdvancedSettingsButton(viewModel: ClickItViewModel())
.frame(width: 400)
.padding()
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
ClickPointSelector { point in
print("Selected point: \(point)")
}
.frame(width: 400, height: 500)
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
ConfigurationPanel(selectedClickPoint: CGPoint(x: 100, y: 100))
.environmentObject(ClickCoordinator.shared)
.frame(width: 400, height: 600)
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
ConfigurationPanelCard(viewModel: {
let vm = ClickItViewModel()
vm.intervalSeconds = 1
vm.intervalMilliseconds = 500
return vm
}())
.frame(width: 400)
.padding()
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
DeveloperUpdateButton(updaterManager: UpdaterManager())
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
FooterInfoCard()
.frame(width: 400)
.padding()
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview("Permission Status Indicator") {
VStack(spacing: 16) {
PermissionStatusIndicator()
CompactPermissionStatus()
PermissionHealthBadge()
}
.padding()
.environmentObject(PermissionManager.shared)
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #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()
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
StatisticsView()
.environmentObject(ClickCoordinator.shared)
.frame(width: 300, height: 100)
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
StatusHeaderCard(viewModel: ClickItViewModel())
.frame(width: 400)
.padding()
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
TargetPointSelectionCard(viewModel: {
let vm = ClickItViewModel()
vm.setTargetPoint(CGPoint(x: 1007, y: 260))
return vm
}())
.frame(width: 400)
.padding()
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
TimerConfigurationView(viewModel: {
let vm = ClickItViewModel()
vm.timerDurationMinutes = 0
vm.timerDurationSeconds = 15
return vm
}())
.frame(width: 350)
.padding()
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
UpdateNotificationCard(updaterManager: UpdaterManager())
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
AdvancedSettingsWindow(viewModel: ClickItViewModel())
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
ContentView()
.environmentObject(PermissionManager.shared)
.environmentObject(HotkeyManager.shared)
.environmentObject(ClickItViewModel())
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
PermissionRequestView()
.environmentObject(PermissionManager.shared)
} |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change replaces the modern #Preview {
PermissionsGateView()
} |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.