Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 7a9d377

Browse files
committed
Hack to display avatars at 100x100.
We need a better avatar cache...
1 parent 652ade4 commit 7a9d377

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

src/GitHub.App/Models/Account.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public Account(Octokit.Account account, IObservable<BitmapSource> bitmapSource)
8080

8181
public long PrivateReposInPlan { get; private set; }
8282

83-
public string AvatarUrl { get; private set; }
83+
public string AvatarUrl { get; set; }
8484

8585
public BitmapSource Avatar
8686
{

src/GitHub.App/SampleData/ForkRepositorySelectViewModelDesigner.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public ForkRepositorySelectViewModelDesigner()
1414
{
1515
Accounts = new[]
1616
{
17-
new AccountDesigner { Login = "Myself" },
18-
new AccountDesigner { Login = "MyOrg1" },
19-
new AccountDesigner { Login = "MyOrg2" },
20-
new AccountDesigner { Login = "MyOrg3" },
21-
new AccountDesigner { Login = "a-long-org-name" },
17+
new AccountDesigner { Login = "Myself", AvatarUrl = "https://identicons.github.com/myself.png" },
18+
new AccountDesigner { Login = "MyOrg1", AvatarUrl = "https://identicons.github.com/myorg1.png" },
19+
new AccountDesigner { Login = "MyOrg2", AvatarUrl = "https://identicons.github.com/myorg2.png" },
20+
new AccountDesigner { Login = "MyOrg3", AvatarUrl = "https://identicons.github.com/myorg3.png" },
21+
new AccountDesigner { Login = "a-long-org-name", AvatarUrl = "https://identicons.github.com/a-long-org-name.png" },
2222
};
2323

2424
ExistingForks = new[]

src/GitHub.App/ViewModels/Dialog/ForkRepositorySelectViewModel.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ void BuildAccounts(IReadOnlyList<IAccount> accessibleAccounts, ILocalRepositoryM
108108

109109
Accounts = readOnlyList.Where(arg => arg.Fork == null).Select(arg => arg.Account).ToList();
110110
ExistingForks = readOnlyList.Where(arg => arg.Fork != null).Select(arg => arg.Fork).ToList();
111+
112+
// HACK: Our avatar cache only provides avatars in a very small size, but we want to
113+
// display them 100x100 in the Fork view. For now, wse the AvatarUrl directly to get
114+
// the avatar, appending "s=100" to the URL to get the correct size.
115+
foreach (Account account in Accounts)
116+
{
117+
account.AvatarUrl += "&s=100";
118+
}
111119
}
112120
}
113121
}

src/GitHub.VisualStudio/Views/Dialog/ForkRepositorySelectView.xaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@
6565
Text="{Binding Login, StringFormat=@{0}}"
6666
TextAlignment="Center"
6767
TextTrimming="CharacterEllipsis"/>
68-
<Image
69-
Margin="4"
70-
MaxWidth="100"
71-
Source="{Binding Avatar}" />
68+
<Image Margin="4"
69+
Width="100"
70+
Height="100"
71+
Stretch="Uniform"
72+
Source="{Binding AvatarUrl}" />
7273
</DockPanel>
7374
</Border>
7475
</DataTemplate>

0 commit comments

Comments
 (0)