Skip to content

Commit 1fae5e0

Browse files
committed
Improve instant view title
1 parent dbe8412 commit 1fae5e0

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎Telegram/Controls/TabbedPageHeader.xaml.cs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,16 @@ public Uri Source
117117
{
118118
if (value != null)
119119
{
120-
SourceText.Text = value.Host + value.PathAndQuery + value.Fragment;
120+
var pathAndQuery = value.PathAndQuery;
121+
if (pathAndQuery == "/")
122+
{
123+
pathAndQuery = string.Empty;
124+
}
125+
126+
SourceText.Text = value.Host + pathAndQuery + value.Fragment;
121127

122128
DomainText.Text = value.Host;
123-
PathText.Text = value.PathAndQuery + value.Fragment;
129+
PathText.Text = pathAndQuery + value.Fragment;
124130
}
125131
}
126132
}

‎Telegram/ViewModels/InstantViewModel.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ protected override async Task OnNavigatedToAsync(object parameter, NavigationMod
4747
if (response is LinkPreview linkPreview)
4848
{
4949
Title = linkPreview.SiteName;
50+
return;
51+
}
52+
53+
if (Uri.TryCreate(args.Url, UriKind.Absolute, out Uri uri))
54+
{
55+
Title = uri.Host;
5056
}
5157
}
5258
else

0 commit comments

Comments
 (0)