Skip to content

Commit

Permalink
Update to use dialUp and dialDown from SD 6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenquyhy committed Dec 16, 2024
1 parent 1d3d772 commit d9a5534
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "SharpDeck"]
path = SharpDeck
url = https://github.com/nguyenquyhy/SharpDeck
2 changes: 1 addition & 1 deletion FlightStreamDeck.AddOn/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,6 @@
}
],
"Software": {
"MinimumVersion": "4.1"
"MinimumVersion": "6.1"
}
}
27 changes: 13 additions & 14 deletions FlightStreamDeck.Logics/Actions/BaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,26 @@ public async Task SetFeedbackSafeAsync(object feedback)

protected virtual Task OnDialLongPress(ActionEventArgs<DialPayload> args) => Task.CompletedTask;

protected override Task OnDialPress(ActionEventArgs<DialPayload> args)
protected override Task OnDialDown(ActionEventArgs<DialPayload> args)
{
if (args.Payload.Pressed)
DialPressStack.Push(args);
if (LongKeyPressInterval > TimeSpan.Zero)
{
DialPressStack.Push(args);
if (LongKeyPressInterval > TimeSpan.Zero)
Task.Run(async delegate
{
Task.Run(async delegate
{
await Task.Delay(LongKeyPressInterval);
TryHandleDialPress(OnDialLongPress);
});
}
}
else
{
TryHandleDialPress(OnDialShortPress);
await Task.Delay(LongKeyPressInterval);
TryHandleDialPress(OnDialLongPress);
});
}
return Task.CompletedTask;
}

protected override Task OnDialUp(ActionEventArgs<DialPayload> args)
{
TryHandleDialPress(OnDialShortPress);
return Task.CompletedTask;
}

private void TryHandleDialPress(Func<ActionEventArgs<DialPayload>, Task> handler)
{
if (DialPressStack.TryPop(out var result))
Expand Down
2 changes: 1 addition & 1 deletion FlightStreamDeck.Logics/FlightStreamDeck.Logics.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SharpDeck" Version="7.0.0-beta1" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\FlightStreamDeck.Core\FlightStreamDeck.Core.csproj" />
<ProjectReference Include="..\SharpDeck\src\SharpDeck\SharpDeck.csproj" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions FlightStreamDeck.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlightStreamDeck.Core", "Fl
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlightStreamDeck.LogicsTests", "FlightStreamDeck.LogicsTests\FlightStreamDeck.LogicsTests.csproj", "{2476F8A1-5018-414A-AF30-D75C7B189C25}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDeck", "SharpDeck\src\SharpDeck\SharpDeck.csproj", "{56FE4160-9205-44D5-A70C-F31B5D42B53A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -48,6 +50,10 @@ Global
{2476F8A1-5018-414A-AF30-D75C7B189C25}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2476F8A1-5018-414A-AF30-D75C7B189C25}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2476F8A1-5018-414A-AF30-D75C7B189C25}.Release|Any CPU.Build.0 = Release|Any CPU
{56FE4160-9205-44D5-A70C-F31B5D42B53A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{56FE4160-9205-44D5-A70C-F31B5D42B53A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{56FE4160-9205-44D5-A70C-F31B5D42B53A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{56FE4160-9205-44D5-A70C-F31B5D42B53A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions SharpDeck
Submodule SharpDeck added at 3bffaa

0 comments on commit d9a5534

Please sign in to comment.