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

dependencies: update to Avalonia 11.0.4 #1383

Merged
merged 2 commits into from
Aug 28, 2023
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
12 changes: 6 additions & 6 deletions src/shared/Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Web" />
<PackageReference Include="Microsoft.Identity.Client.Broker" Version="4.54.0" />
<PackageReference Include="Avalonia.Win32" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Win32" Version="11.0.4" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net472'">
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.4" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client" Version="4.54.0" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="2.28.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="Avalonia" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Skia" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia" Version="11.0.4" />
<PackageReference Include="Avalonia.Skia" Version="11.0.4" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.4" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Debug'">
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.0-preview6" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.4" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/shared/Core/UI/AvaloniaUi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ private static void SetParentExternal(Window window, IntPtr parentHandle)
return;
}

IntPtr ourHandle = window.PlatformImpl.Handle.Handle;
IntPtr ourHandle = window.TryGetPlatformHandle()!.Handle;

// Get the desktop scaling factor from our window instance so we
// can calculate rects correctly for both our window, and the parent window.
double scaling = window.PlatformImpl.DesktopScaling;
double scaling = window.RenderScaling;

// Get our window rect
var ourRect = new PixelRect(
Expand Down
16 changes: 5 additions & 11 deletions src/shared/GitHub/UI/Controls/SixDigitInput.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Input;
using Avalonia.Input.Platform;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using GitCredentialManager;
Expand All @@ -22,8 +21,6 @@ public partial class SixDigitInput : UserControl, IFocusable
(o, v) => o.Text = v,
defaultBindingMode: BindingMode.TwoWay);

private PlatformHotkeyConfiguration _keyMap;
private IClipboard _clipboard;
private bool _ignoreTextBoxUpdate;
private TextBox[] _textBoxes;
private string _text;
Expand All @@ -37,8 +34,6 @@ private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);

_keyMap = AvaloniaLocator.Current.GetService<PlatformHotkeyConfiguration>();
_clipboard = AvaloniaLocator.Current.GetService<IClipboard>();
_textBoxes = new[]
{
this.FindControl<TextBox>("one"),
Expand Down Expand Up @@ -89,7 +84,7 @@ public void SetFocus()
{
// Workaround: https://github.com/git-ecosystem/git-credential-manager/issues/1293
if (!PlatformUtils.IsMacOS())
KeyboardDevice.Instance.SetFocusedElement(_textBoxes[0], NavigationMethod.Tab, KeyModifiers.None);
_textBoxes[0].Focus(NavigationMethod.Tab, KeyModifiers.None);
}

private void SetUpTextBox(TextBox textBox)
Expand All @@ -99,7 +94,7 @@ private void SetUpTextBox(TextBox textBox)
void OnPreviewKeyDown(object sender, KeyEventArgs e)
{
// Handle paste
if (_keyMap.Paste.Any(x => x.Matches(e)))
if (TopLevel.GetTopLevel(this)?.PlatformSettings?.HotkeyConfiguration.Paste.Any(x => x.Matches(e)) ?? false)
{
OnPaste();
e.Handled = true;
Expand Down Expand Up @@ -166,8 +161,7 @@ void OnPreviewKeyDown(object sender, KeyEventArgs e)

private void OnPaste()
{
string text = _clipboard.GetTextAsync().GetAwaiter().GetResult();
Text = text;
Text = TopLevel.GetTopLevel(this)?.Clipboard?.GetTextAsync().GetAwaiter().GetResult();
}

private bool MoveNext() => MoveFocus(true);
Expand All @@ -177,7 +171,7 @@ private void OnPaste()
private bool MoveFocus(bool next)
{
// Get currently focused text box
if (FocusManager.Instance.Current is TextBox textBox)
if (TopLevel.GetTopLevel(this)?.FocusManager?.GetFocusedElement() is TextBox textBox)
{
int textBoxIndex = Array.IndexOf(_textBoxes, textBox);
if (textBoxIndex > -1)
Expand All @@ -186,7 +180,7 @@ private bool MoveFocus(bool next)
? Math.Min(_textBoxes.Length - 1, textBoxIndex + 1)
: Math.Max(0, textBoxIndex - 1);

KeyboardDevice.Instance.SetFocusedElement(_textBoxes[nextIndex], NavigationMethod.Tab, KeyModifiers.None);
_textBoxes[nextIndex].Focus(NavigationMethod.Tab, KeyModifiers.None);
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/GitHub/UI/Views/SelectAccountView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</StackPanel>

<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<ListBox Items="{Binding Accounts}"
<ListBox ItemsSource="{Binding Accounts}"
SelectedItem="{Binding SelectedAccount}"
Margin="20,0,20,10"
MaxHeight="200"
Expand Down