Compare commits

..

6 commits

Author SHA1 Message Date
leo
7526def448
project: rename dotnet publish option -p:SourceGitNoAot=true|false to -p:DisableAOT=true|false
Some checks are pending
Continuous Integration / Build (push) Waiting to run
Continuous Integration / Prepare version string (push) Waiting to run
Continuous Integration / Package (push) Blocked by required conditions
2024-12-18 10:17:00 +08:00
leo
e4fb9eeb52
refactor: built-in default avatar 2024-12-18 10:00:25 +08:00
leo
cb3727b524
feature: remember --force check state in git fetch popup (#824) 2024-12-18 09:36:25 +08:00
Martin Garstenauer
39dff8a93f
ux: change text selection brush to improve readability (#825) 2024-12-18 09:25:56 +08:00
leo
23326d179a
refactor: commit hash detection in message 2024-12-17 14:39:18 +08:00
leo
6768a2c1fe
ux: new notification theme 2024-12-17 12:08:25 +08:00
8 changed files with 38 additions and 11 deletions

View file

@ -35,7 +35,7 @@ namespace SourceGit.Models
private static AvatarManager _instance = null;
[GeneratedRegex(@"^(?:(\d+)\+)?(.+?)@users\.noreply\.github\.com$")]
[GeneratedRegex(@"^(?:(\d+)\+)?(.+?)@.+\.github\.com$")]
private static partial Regex REG_GITHUB_USER_EMAIL();
private object _synclock = new object();
@ -43,6 +43,7 @@ namespace SourceGit.Models
private List<IAvatarHost> _avatars = new List<IAvatarHost>();
private Dictionary<string, Bitmap> _resources = new Dictionary<string, Bitmap>();
private HashSet<string> _requesting = new HashSet<string>();
private HashSet<string> _defaultAvatars = new HashSet<string>();
public void Start()
{
@ -50,8 +51,8 @@ namespace SourceGit.Models
if (!Directory.Exists(_storePath))
Directory.CreateDirectory(_storePath);
var icon = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/Images/github.png", UriKind.RelativeOrAbsolute));
_resources.Add("noreply@github.com", new Bitmap(icon));
LoadDefaultAvatar("noreply@github.com", "github.png");
LoadDefaultAvatar("unrealbot@epicgames.com", "unreal.png");
Task.Run(() =>
{
@ -140,7 +141,7 @@ namespace SourceGit.Models
{
if (forceRefetch)
{
if (email.Equals("noreply@github.com", StringComparison.Ordinal))
if (_defaultAvatars.Contains(email))
return null;
if (_resources.ContainsKey(email))
@ -185,6 +186,13 @@ namespace SourceGit.Models
return null;
}
private void LoadDefaultAvatar(string key, string img)
{
var icon = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/Images/{img}", UriKind.RelativeOrAbsolute));
_resources.Add(key, new Bitmap(icon));
_defaultAvatars.Add(key);
}
private string GetEmailHash(string email)
{
var lowered = email.ToLower(CultureInfo.CurrentCulture).Trim();

View file

@ -26,6 +26,12 @@ namespace SourceGit.Models
set;
} = false;
public bool EnableForceOnFetch
{
get;
set;
} = false;
public bool FetchWithoutTags
{
get;

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -4,6 +4,7 @@
xmlns:vm="using:SourceGit.ViewModels"
xmlns:c="using:SourceGit.Converters"
xmlns:ae="using:AvaloniaEdit"
xmlns:aee="using:AvaloniaEdit.Editing"
xmlns:aes="using:AvaloniaEdit.Search">
<Design.PreviewWith>
<StackPanel Orientation="Vertical">
@ -580,6 +581,19 @@
</Style>
</Style>
<Style Selector="aee|TextArea">
<Setter Property="SelectionBorder">
<Setter.Value>
<Pen Brush="{DynamicResource SystemAccentColor}" Thickness="1" />
</Setter.Value>
</Setter>
<Setter Property="SelectionBrush">
<Setter.Value>
<SolidColorBrush Opacity="0.5" Color="{DynamicResource SystemAccentColor}" />
</Setter.Value>
</Setter>
</Style>
<Style Selector="aes|SearchPanel">
<Setter Property="Template">
<ControlTemplate TargetType="aes:SearchPanel">

View file

@ -20,7 +20,7 @@
<RepositoryType>Public</RepositoryType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release' and '$(SourceGitNoAot)' != 'true'">
<PropertyGroup Condition="'$(DisableAOT)' != 'true'">
<PublishAot>true</PublishAot>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>link</TrimMode>

View file

@ -30,15 +30,14 @@ namespace SourceGit.ViewModels
public bool Force
{
get;
set;
get => _repo.Settings.EnableForceOnFetch;
set => _repo.Settings.EnableForceOnFetch = value;
}
public Fetch(Repository repo, Models.Remote preferedRemote = null)
{
_repo = repo;
_fetchAllRemotes = preferedRemote == null;
Force = false;
SelectedRemote = preferedRemote != null ? preferedRemote : _repo.Remotes[0];
View = new Views.Fetch() { DataContext = this };
}
@ -49,7 +48,7 @@ namespace SourceGit.ViewModels
var notags = _repo.Settings.FetchWithoutTags;
var prune = _repo.Settings.EnablePruneOnFetch;
var force = Force;
var force = _repo.Settings.EnableForceOnFetch;
return Task.Run(() =>
{
if (FetchAllRemotes)

View file

@ -15,7 +15,7 @@ namespace SourceGit.Views
{
public partial class CommitMessagePresenter : SelectableTextBlock
{
[GeneratedRegex(@"\b([0-9a-fA-F]{8,40})\b")]
[GeneratedRegex(@"\b([0-9a-fA-F]{10,40})\b")]
private static partial Regex REG_SHA_FORMAT();
public static readonly StyledProperty<string> MessageProperty =

View file

@ -125,7 +125,7 @@
</Button>
</Grid>
<Border Grid.Row="1" Margin="8" Background="{DynamicResource Brush.Contents}" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
<Border Grid.Row="1" Margin="8" Background="Transparent">
<ScrollViewer MaxHeight="200" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<TextBlock Margin="4,2" TextWrapping="NoWrap" Text="{Binding Message}"/>
</ScrollViewer>