Skip to content
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

Release 3.5.0 #117

Merged
merged 13 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/cicd-wfw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.302
dotnet-version: 8.0.303

# GitHub Actions Windows Runners come with NSIS pre-installed
# https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md
Expand All @@ -93,6 +93,11 @@ jobs:
$jsonObj = (dotnet list $projectPath package --vulnerable --include-transitive --format json) | ConvertFrom-Json;
$hasAnyVulnerability = ($jsonObj.projects[0].frameworks -ne $null);
if ($hasAnyVulnerability) {
if ($jsonObj.projects[0].frameworks.transitivePackages.id -eq "System.Text.Json") {
# remove this when upgrading to Avalonia 11.1.x
echo "::warning file=Pororoca.Desktop.csproj::Vulnerability ignored: System.Text.Json"
exit 0;
}
dotnet list package --vulnerable --include-transitive;
exit 1;
}
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog

* [3.5.0](#350-2024-08-07)
* [3.4.2](#342-2024-07-02)
* [3.4.1](#341-2024-06-12)
* [3.4.0](#340-2024-05-29)
Expand Down Expand Up @@ -27,6 +28,25 @@
* [1.1.0](#110-2022-03-20)
* [1.0.0](#100-2022-03-08)

## [3.5.0](https://github.com/alexandrehtrb/Pororoca/tree/3.5.0) (2024-08-07)

### Features

* Mouse drag-and-drop in collections' tree 🙌
* Collection and environments export redesigned. For collections, now you can select which environments you wish to include and whether to include their secret variables. (issue #82)
* Insomnia collections can now be imported.
* A dialog now appears when trying to import an invalid collection or environment file. (issue #35)
* A folder icon now appears to indicate a collection folder.

## Bug Fixes

* Postman collections and environments are now exported to files with UTF-8 without BOM encoding. Now you can export files from Pororoca to Insomnia, using Postman format.

### Others

* Raised .NET SDK to 8.0.303.
* Raised Microsoft.OpenAPI and test libs versions.

## [3.4.2](https://github.com/alexandrehtrb/Pororoca/tree/3.4.2) (2024-07-02)

### Features
Expand Down
2 changes: 1 addition & 1 deletion src/Pororoca.Desktop.Debian/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: pororoca
Version: 3.4.2
Version: 3.5.0
Section: devel
Priority: optional
Architecture: amd64
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand All @@ -11,36 +11,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Text.Json" Version="7.0.3" GeneratePathProperty="true" PrivateAssets="all" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" GeneratePathProperty="true" PrivateAssets="all" />
<!--PackageReference Include="System.Buffers" Version="4.5.1" GeneratePathProperty="true" PrivateAssets="all" /-->
<!--PackageReference Include="System.Memory" Version="4.5.5" GeneratePathProperty="true" PrivateAssets="all" /-->
<!--PackageReference Include="System.Numerics.Vectors" Version="4.5.0" GeneratePathProperty="true" PrivateAssets="all" /-->
<!--PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" GeneratePathProperty="true" PrivateAssets="all" /-->
<PackageReference Include="System.Text.Encodings.Web" Version="7.0.0" GeneratePathProperty="true" PrivateAssets="all" />
<!--PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" GeneratePathProperty="true" PrivateAssets="all" /-->
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" PrivateAssets="all" />
</ItemGroup>

<PropertyGroup>
<GetTargetPathDependsOn>$(GetTargetPathDependsOn);GetDependencyTargetPaths</GetTargetPathDependsOn>
</PropertyGroup>

<Target Name="GetDependencyTargetPaths">
<ItemGroup>
<TargetPathWithTargetPlatformMoniker Include="$(PKGSystem_Text_Json)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" />
<TargetPathWithTargetPlatformMoniker Include="$(PKGSystem_Text_Encodings_Web)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" />
<!--TargetPathWithTargetPlatformMoniker Include="$(PKGSystem_Buffers)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" /-->
<!--TargetPathWithTargetPlatformMoniker Include="$(PKGSystem_Memory)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" /-->
<!--TargetPathWithTargetPlatformMoniker Include="$(PKGSystem_Numerics_Vectors)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" /-->
<!--TargetPathWithTargetPlatformMoniker Include="$(PKGSystem_Runtime_CompilerServices_Unsafe)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" /-->
<TargetPathWithTargetPlatformMoniker Include="$(PKGMicrosoft_Bcl_AsyncInterfaces)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" />
<!--TargetPathWithTargetPlatformMoniker Include="$(PKGSystem_Threading_Tasks_Extensions)\lib\netstandard2.0\*.dll" IncludeRuntimeDependency="false" /-->
</ItemGroup>
</Target>

</Project>
4 changes: 2 additions & 2 deletions src/Pororoca.Desktop.MacOSX/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<key>CFBundleDisplayName</key>
<string>Pororoca</string>
<key>CFBundleVersion</key>
<string>3.4.2</string>
<string>3.5.0</string>
<key>CFBundleShortVersionString</key>
<string>3.4.2</string>
<string>3.5.0</string>
<key>LSMinimumSystemVersion</key>
<string>10.12</string>
<key>CFBundleExecutable</key>
Expand Down
2 changes: 1 addition & 1 deletion src/Pororoca.Desktop/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<FluentTheme/>
<StyleInclude Source="avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml"/>
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
<StyleInclude Source="/Styles/DataGridDragAndDrop.xaml"/>
<StyleInclude Source="/Styles/DragAndDrop.xaml"/>
<StyleInclude Source="/Styles/Fonts.xaml"/>
<StyleInclude Source="/Styles/Icons.xaml"/>
<StyleInclude Source="/Styles/BrushesDefinitions.xaml"/>
Expand Down
133 changes: 133 additions & 0 deletions src/Pororoca.Desktop/Behaviors/BaseTreeViewDropHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.LogicalTree;
using Avalonia.VisualTree;
using Avalonia.Xaml.Interactions.DragAndDrop;

namespace Pororoca.Desktop.Behaviors;

public abstract class BaseTreeViewDropHandler : DropHandlerBase
{
private const string rowDraggingUpStyleClass = "DraggingUp";
private const string rowDraggingDownStyleClass = "DraggingDown";
private const string targetHighlightStyleClass = "TargetHighlight";

protected abstract (bool Valid, bool WillSourceItemBeMovedToDifferentParent) Validate(TreeView tv, DragEventArgs e, object? sourceContext, object? targetContext, bool bExecute);

public override bool Validate(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state)
{
if (e.Source is Control && sender is TreeView tv)
{
var (valid, willSourceItemChangeParent) = Validate(tv, e, sourceContext, targetContext, false);
var targetVisual = tv.GetVisualAt(e.GetPosition(tv));
if (valid)
{
var targetItem = FindTreeViewItemFromChildView(targetVisual);
// If its a movement within the same tree level,
// then an adorner layer will be applied.
// But, if the source item will move to a different level,
// the level's owner will receive a background highlight.
// In the case of being moved to a root target item,
// (with targetItem.Parent not being another TreeViewItem,
// e.g., CollectionViewModel), then this root target item
// will receive this style.
var itemToApplyStyle = (willSourceItemChangeParent && targetItem?.Parent is TreeViewItem tviParent) ?
tviParent : targetItem;
string direction = e.Data.Contains("direction") ? (string)e.Data.Get("direction")! : "down";
ApplyDraggingStyleToItem(itemToApplyStyle!, direction, willSourceItemChangeParent);
ClearDraggingStyleFromAllItems(sender, exceptThis: itemToApplyStyle);
}
return valid;
}
ClearDraggingStyleFromAllItems(sender);
return false;
}

public override bool Execute(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state)
{
ClearDraggingStyleFromAllItems(sender);
if (e.Source is Control && sender is TreeView tv)
{
var (valid, _) = Validate(tv, e, sourceContext, targetContext, true);
return valid;
}
return false;
}

public override void Cancel(object? sender, RoutedEventArgs e)
{
base.Cancel(sender, e);
// This is necessary to clear styles
// when mouse exists TreeView, else,
// they would remain even after changing screens.
ClearDraggingStyleFromAllItems(sender);
}

private static TreeViewItem? FindTreeViewItemFromChildView(StyledElement? sourceChild)
{
if (sourceChild is null)
return null;

int maxDepth = 16;
StyledElement? current = sourceChild;
while (maxDepth-- > 0)
{
if (current is TreeViewItem tvi)
return tvi;
else
current = current?.Parent;
}
return null;
}

private static void ClearDraggingStyleFromAllItems(object? sender, TreeViewItem? exceptThis = null)
{
if (sender is not Visual rootVisual)
return;

foreach (var item in rootVisual.GetLogicalChildren().OfType<TreeViewItem>())
{
if (item == exceptThis)
continue;

if (item.Classes is not null)
{
item.Classes.Remove(rowDraggingUpStyleClass);
item.Classes.Remove(rowDraggingDownStyleClass);
item.Classes.Remove(targetHighlightStyleClass);
}
ClearDraggingStyleFromAllItems(item, exceptThis);
}
}

private static void ApplyDraggingStyleToItem(TreeViewItem? item, string direction, bool willSourceItemBeMovedToDifferentParent)
{
if (item is null)
return;

// Avalonia's Classes.Add() verifies
// if a class has already been added
// (avoiding duplications); no need to
// verify .Contains() here.
if (willSourceItemBeMovedToDifferentParent)
{
item.Classes.Remove(rowDraggingDownStyleClass);
item.Classes.Remove(rowDraggingUpStyleClass);
item.Classes.Add(targetHighlightStyleClass);
}
else if (direction == "up")
{
item.Classes.Remove(rowDraggingDownStyleClass);
item.Classes.Remove(targetHighlightStyleClass);
item.Classes.Add(rowDraggingUpStyleClass);
}
else if (direction == "down")
{
item.Classes.Remove(rowDraggingUpStyleClass);
item.Classes.Remove(targetHighlightStyleClass);
item.Classes.Add(rowDraggingDownStyleClass);
}
}
}
Loading
Loading