Skip to content

Commit 782a58e

Browse files
committed
Add support for macOS builds
- Update dependencies - Small refactorings - Add publish run scripts
1 parent e74694b commit 782a58e

8 files changed

+65
-21
lines changed

.run/Publish for Windows.run.xml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Publish for Windows" type="DotNetFolderPublish" factoryName="Publish to folder">
3+
<riderPublish configuration="Release" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" ready_to_run="true" runtime="win-x64" self_contained="true" target_folder="$PROJECT_DIR$/bin/Publish/dev.duerrenberger.clockify.sdPlugin/Windows" target_framework="net5.0-windows" trim_unused_assemblies="true" uuid_high="3080948972394662106" uuid_low="-5338808962525310719" />
4+
<method v="2" />
5+
</configuration>
6+
</component>

.run/Publish for macOS.run.xml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Publish for macOS" type="DotNetFolderPublish" factoryName="Publish to folder">
3+
<riderPublish configuration="Release" include_native_libs_for_self_extract="true" platform="Any CPU" produce_single_file="true" ready_to_run="true" runtime="osx-x64" self_contained="true" target_folder="$PROJECT_DIR$/bin/Publish/dev.duerrenberger.clockify.sdPlugin/macOS" target_framework="net5.0-windows" trim_unused_assemblies="true" uuid_high="3080948972394662106" uuid_low="-5338808962525310719" />
4+
<method v="2" />
5+
</configuration>
6+
</component>

Clockify.csproj

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<CodeAnalysisRuleSet>StyleCop.ruleset</CodeAnalysisRuleSet>
1212
<EnableNETAnalyzers>false</EnableNETAnalyzers>
1313
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
14-
<AssemblyVersion>1.3</AssemblyVersion>
15-
<PackageVersion>1.3</PackageVersion>
14+
<AssemblyVersion>1.4</AssemblyVersion>
15+
<PackageVersion>1.4</PackageVersion>
1616
<Title>Clockify</Title>
1717
<Authors>Lukas Dürrenberger</Authors>
1818
<Description>This plugin allows you to track, start and stop Clockify timers on your Elgato Stream Deck</Description>
@@ -34,10 +34,11 @@
3434
<PublishDir>bin\Publish\dev.duerrenberger.clockify.sdPlugin\</PublishDir>
3535
</PropertyGroup>
3636
<ItemGroup>
37-
<PackageReference Include="Clockify.Net" Version="1.14.0" />
37+
<PackageReference Include="Clockify.Net" Version="2.0.0" />
3838
<PackageReference Include="CommandLineParser" Version="2.8.0" />
3939
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
40-
<PackageReference Include="NLog" Version="4.7.13" />
40+
<PackageReference Include="NLog" Version="4.7.15" />
41+
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="6.0.5.128" />
4142
<PackageReference Include="streamdeck-client-csharp" Version="4.3.0" />
4243
<PackageReference Include="StreamDeck-Tools" Version="3.2.0" />
4344
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">

Clockify/ClockifyContext.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public async Task ToggleTimerAsync(string workspaceName, string projectName = nu
5050
{
5151
UserId = _currentUser.Id,
5252
WorkspaceId = workspace.Id,
53-
Description = timerName,
53+
Description = timerName ?? string.Empty,
5454
Start = DateTimeOffset.UtcNow
5555
};
5656

@@ -113,7 +113,7 @@ public async Task<TimeEntryDtoImpl> GetRunningTimerAsync(string workspaceName, s
113113

114114
var workspace = _workspaces.Single(w => w.Name == workspaceName);
115115
var timeEntries = await _clockifyClient.FindAllTimeEntriesForUserAsync(workspace.Id, _currentUser.Id, inProgress: true);
116-
if (!timeEntries.IsSuccessful)
116+
if (!timeEntries.IsSuccessful || timeEntries.Data == null)
117117
{
118118
return null;
119119
}
@@ -227,7 +227,7 @@ private async Task<string> FindOrCreateTaskAsync(WorkspaceDto workspace, Project
227227
{
228228
var taskResponse = await _clockifyClient.FindAllTasksAsync(workspace.Id, project.Id, name: taskName, pageSize: 5000);
229229

230-
if (!taskResponse.IsSuccessful)
230+
if (!taskResponse.IsSuccessful || taskResponse.Data == null)
231231
{
232232
return null;
233233
}
@@ -244,7 +244,7 @@ private async Task<string> FindOrCreateTaskAsync(WorkspaceDto workspace, Project
244244

245245
var creationResponse = await _clockifyClient.CreateTaskAsync(workspace.Id, project.Id, taskRequest);
246246

247-
if (!creationResponse.IsSuccessful)
247+
if (!creationResponse.IsSuccessful || creationResponse.Data == null)
248248
{
249249
return null;
250250
}

Clockify/ToggleAction.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ namespace Clockify
88
[PluginActionId("dev.duerrenberger.clockify.toggle")]
99
public class ToggleAction : PluginBase
1010
{
11-
private static readonly uint InactiveState = 0;
12-
private static readonly uint ActiveState = 1;
11+
private const uint InactiveState = 0;
12+
private const uint ActiveState = 1;
13+
1314
private readonly ClockifyContext _clockifyContext;
1415
private readonly PluginSettings _settings;
1516

PropertyInspector/sdtools.common.js

+30-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
// ****************************************************************
2-
// * EasyPI v1.3
2+
// * EasyPI v1.3.3
33
// * Author: BarRaider
44
// *
55
// * JS library to simplify the communication between the
66
// * Stream Deck's Property Inspector and the plugin.
77
// *
88
// * Project page: https://github.com/BarRaider/streamdeck-easypi
99
// * Support: http://discord.barraider.com
10+
// *
11+
// * Initially forked from Elgato's common.js file
1012
// ****************************************************************
1113

1214
var websocket = null,
@@ -35,6 +37,7 @@ function connectElgatoStreamDeckSocket(inPort, inUUID, inRegisterEvent, inInfo,
3537
document.dispatchEvent(event);
3638

3739
loadConfiguration(actionInfo.payload.settings);
40+
initPropertyInspector();
3841
}
3942

4043
function websocketOnOpen() {
@@ -52,16 +55,12 @@ function websocketOnMessage(evt) {
5255
// Received message from Stream Deck
5356
var jsonObj = JSON.parse(evt.data);
5457

55-
if (jsonObj.event === 'sendToPropertyInspector') {
56-
var payload = jsonObj.payload;
57-
loadConfiguration(payload);
58-
}
59-
else if (jsonObj.event === 'didReceiveSettings') {
58+
if (jsonObj.event === 'didReceiveSettings') {
6059
var payload = jsonObj.payload;
6160
loadConfiguration(payload.settings);
6261
}
6362
else {
64-
console.log("Unhandled websocketOnMessage: " + jsonObj.event);
63+
console.log("Ignored websocketOnMessage: " + jsonObj.event);
6564
}
6665
}
6766

@@ -216,8 +215,31 @@ window.addEventListener('beforeunload', function (e) {
216215
// Don't set a returnValue to the event, otherwise Chromium with throw an error.
217216
});
218217

218+
function prepareDOMElements(baseElement) {
219+
baseElement = baseElement || document;
220+
221+
/**
222+
* You could add a 'label' to a textares, e.g. to show the number of charactes already typed
223+
* or contained in the textarea. This helper updates this label for you.
224+
*/
225+
baseElement.querySelectorAll('textarea').forEach((e) => {
226+
const maxl = e.getAttribute('maxlength');
227+
e.targets = baseElement.querySelectorAll(`[for='${e.id}']`);
228+
if (e.targets.length) {
229+
let fn = () => {
230+
for (let x of e.targets) {
231+
x.textContent = maxl ? `${e.value.length}/${maxl}` : `${e.value.length}`;
232+
}
233+
};
234+
fn();
235+
e.onkeyup = fn;
236+
}
237+
});
238+
}
239+
219240
function initPropertyInspector() {
220241
// Place to add functions
242+
prepareDOMElements(document);
221243
}
222244

223245

@@ -296,4 +318,4 @@ function fadeColor(col, amt) {
296318
const g = min(255, max((num & 0x0000FF) + amt, 0));
297319
const b = min(255, max(((num >> 8) & 0x00FF) + amt, 0));
298320
return '#' + (g | (b << 8) | (r << 16)).toString(16).padStart(6, 0);
299-
}
321+
}

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ https://user-images.githubusercontent.com/920861/132741561-6f9f3ff0-a920-408d-82
2525
- Your API Key is likely incorrect
2626
- Why am I not seeing the running timer on my button?
2727
- Make sure you haven't set a title, as this will override any other content
28-
- Make sure the API Key, Workspace name and optional the project and timer name match
28+
- Make sure the API Key, Workspace name and optional the project and timer name
29+
- Why does the timer always start with a negative number?
30+
- This can happen when your local computer time isn't in sync with the Clockify server time
31+
- Make sure you synchronize your clock with a time server
2932
- Why can't I select my Workspace and Project in a dropdown menu?
3033
- Because I was lazy 😅
3134
- IT DOESN'T WORK, WHY?!?

manifest.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,19 @@
2828
"Description": "Stream Deck integration for Clockify, the most popular free time tracker available for an unlimited numbers of users for free.",
2929
"Icon": "Images/clockifyIcon",
3030
"URL": "https://duerrenberger.dev",
31-
"Version": "1.3",
32-
"CodePath": "dev.duerrenberger.clockify",
31+
"Version": "1.4",
32+
"CodePathWin": "Windows/dev.duerrenberger.clockify.exe",
33+
"CodePathMac": "macOS/dev.duerrenberger.clockify",
3334
"Category": "Time Tracking",
3435
"CategoryIcon": "Images/categoryTimerIcon",
3536
"OS": [
3637
{
3738
"Platform": "windows",
3839
"MinimumVersion": "10"
40+
},
41+
{
42+
"Platform": "mac",
43+
"MinimumVersion": "10.11"
3944
}
4045
],
4146
"SDKVersion": 2,

0 commit comments

Comments
 (0)