Skip to content

Commit b1af2dc

Browse files
committed
Add support for selecting a refresh rate
1 parent 12853bd commit b1af2dc

12 files changed

Lines changed: 62 additions & 12 deletions

File tree

‎Clockify.csproj‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<PublishDir>bin\Publish\dev.duerrenberger.clockify.sdPlugin\</PublishDir>
3636
</PropertyGroup>
3737
<ItemGroup>
38-
<PackageReference Include="ClockifyClient" Version="1.2.1" />
38+
<PackageReference Include="ClockifyClient" Version="1.2.2" />
3939
<PackageReference Include="CommandLineParser" Version="2.9.1" />
4040
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="4.14.0">
4141
<PrivateAssets>all</PrivateAssets>
@@ -93,8 +93,4 @@
9393
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
9494
</None>
9595
</ItemGroup>
96-
<ItemGroup>
97-
<Folder Include="macOS\" />
98-
<Folder Include="Windows\" />
99-
</ItemGroup>
10096
</Project>

‎Clockify/PluginSettings.cs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public class PluginSettings
3131
[JsonProperty(PropertyName = "titleFormat")]
3232
public string TitleFormat { get; set; } = string.Empty;
3333

34+
[JsonProperty(PropertyName = "refreshRate")]
35+
public uint RefreshRate { get; set; } = 5;
36+
3437
[JsonProperty(PropertyName = "serverUrl")]
3538
public string ServerUrl { get; set; } = "https://api.clockify.me/api";
3639

‎Clockify/ToggleAction.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public override async void KeyReleased(KeyPayload payload)
4848
}
4949

5050
// Immediately update the button
51-
_buttonState.Ticks = 5;
51+
_buttonState.Ticks = _settings.RefreshRate;
5252
OnTick();
5353
}
5454

@@ -59,7 +59,7 @@ public override async void OnTick()
5959
return;
6060
}
6161

62-
if (_buttonState.Ticks >= 5)
62+
if (_buttonState.Ticks >= _settings.RefreshRate)
6363
{
6464
var timer = await _clockifyService.GetRunningTimerAsync();
6565
var timerTime = string.Empty;

‎PropertyInspector/PluginActionPI.html‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@
5757
<textarea class="sdpi-item-value sdProperty" id="titleFormat" type="textarea" maxlength="100" oninput="setSettings()"></textarea>
5858
</div>
5959
</div>
60+
<div class="sdpi-item">
61+
<div class="sdpi-item-label">Refresh Rate</div>
62+
<select class="sdpi-item-value sdProperty" id="refreshRate" oninput="setSettings()">
63+
<option value="1">1 Second</option>
64+
<option value="2">2 Seconds</option>
65+
<option value="5" selected>5 Seconds</option>
66+
<option value="10">10 Seconds</option>
67+
<option value="20">20 Seconds</option>
68+
</select>
69+
</div>
6070
<div class="sdpi-item">
6171
<div class="sdpi-item-label">Server Url</div>
6272
<input class="sdpi-item-value sdProperty" id="serverUrl" value="https://api.clockify.me/api/v1" placeholder="Enter the ULR of the Server" oninput="setSettings()" required>

‎PropertyInspector/caret.svg‎

Lines changed: 3 additions & 0 deletions
Loading

‎PropertyInspector/check.png‎

234 Bytes
Loading

‎PropertyInspector/check.svg‎

Lines changed: 3 additions & 0 deletions
Loading

‎PropertyInspector/elg_calendar.svg‎

Lines changed: 24 additions & 0 deletions
Loading
Lines changed: 7 additions & 0 deletions
Loading

‎PropertyInspector/rcheck.svg‎

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)