From 02516e5a2b12f6a89029efb5f26062babfd74f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20D=C3=BCrrenberger?= Date: Thu, 21 Nov 2024 23:30:33 +0100 Subject: [PATCH] Add support for billable/non-billable setting --- Clockify/ClockifyContext.cs | 7 +++++-- Clockify/PluginSettings.cs | 3 +++ PropertyInspector/PluginActionPI.html | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Clockify/ClockifyContext.cs b/Clockify/ClockifyContext.cs index b901d59..7dd0d76 100644 --- a/Clockify/ClockifyContext.cs +++ b/Clockify/ClockifyContext.cs @@ -26,6 +26,7 @@ public class ClockifyContext private string _taskName = string.Empty; private string _timerName = string.Empty; private string _workspaceName = string.Empty; + private bool _billable = true; public ClockifyContext(Logger logger) { @@ -66,7 +67,8 @@ public async Task ToggleTimerAsync() UserId = _currentUser.Id, WorkspaceId = workspace.Id, Description = _timerName ?? string.Empty, - Start = DateTimeOffset.UtcNow + Start = DateTimeOffset.UtcNow, + Billable = _billable }; if (!string.IsNullOrEmpty(_projectName)) @@ -183,6 +185,7 @@ public async Task UpdateSettings(PluginSettings settings) _taskName = settings.TaskName; _timerName = settings.TimerName; _clientName = settings.ClientName; + _billable = settings.Billable; } private async Task ReloadCacheAsync() @@ -223,7 +226,7 @@ private async Task StopRunningTimerAsync() End = DateTimeOffset.UtcNow, ProjectId = runningTimer.ProjectId, TaskId = runningTimer.TaskId, - Description = runningTimer.Description + Description = runningTimer.Description, }; await _clockifyClient.UpdateTimeEntryAsync(workspace.Id, runningTimer.Id, timerUpdate); diff --git a/Clockify/PluginSettings.cs b/Clockify/PluginSettings.cs index 525d256..39afd37 100644 --- a/Clockify/PluginSettings.cs +++ b/Clockify/PluginSettings.cs @@ -21,6 +21,9 @@ public class PluginSettings [JsonProperty(PropertyName = "clientName")] public string ClientName { get; set; } = string.Empty; + + [JsonProperty(PropertyName = "billable")] + public bool Billable { get; set; } = true; [JsonProperty(PropertyName = "titleFormat")] public string TitleFormat { get; set; } = string.Empty; diff --git a/PropertyInspector/PluginActionPI.html b/PropertyInspector/PluginActionPI.html index e868d97..35fc3f7 100644 --- a/PropertyInspector/PluginActionPI.html +++ b/PropertyInspector/PluginActionPI.html @@ -34,11 +34,15 @@
Advanced
-
+
Client Name
+
+
Billable
+ +
Title Format