Skip to content

Commit

Permalink
Allow clicking hyperlinks in markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Heufneutje committed Apr 7, 2024
1 parent ae1505c commit 00e7de2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions SpeedrunTracker/ViewModels/RunDetailsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public EmbeddableUrl SelectedVideo

public ICommand NavigateToUserCommand => new AsyncRelayCommand<User>(NavigateToUserAsync);

public ICommand OpenLinkCommand => new AsyncRelayCommand<string>(OpenLinkAsync);

public string Title => RunDetails == null ? "RunDetails" : $"{_runDetails.Category.Name} in {_runDetails.Run.Times.PrimaryTimeSpan} by {_runDetails.Run.Players.First().DisplayName}";

public bool HasInGameTime => ShouldShowTimingType(TimingType.InGame);
Expand Down Expand Up @@ -159,4 +161,9 @@ private async Task NavigateToUserAsync(User user)
if (!string.IsNullOrEmpty(user.Id))
await Shell.Current.GoToAsync(Routes.UserDetailPageRoute, "User", user);
}

private async Task OpenLinkAsync(string uri)
{
await _browserService.OpenAsync(uri);
}
}
2 changes: 1 addition & 1 deletion SpeedrunTracker/Views/RunDetailsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</VerticalStackLayout>
<Label Text="No Video Available" IsVisible="{Binding Path=HasVideo, Converter={StaticResource InverseBoolConverter}}" Margin="5,-5,0,5" />
<controls:RunPropertyControl Title="Description" IsVisible="{Binding RunComment, Converter={StaticResource IsNotNullConverter}}" ImageSource="comment" IsValueVisible="False" />
<markdown:MarkdownView MarkdownText="{Binding RunComment}" IsVisible="{Binding RunComment, Converter={StaticResource IsNotNullConverter}}" Margin="5,-5,0,5" />
<markdown:MarkdownView MarkdownText="{Binding RunComment}" IsVisible="{Binding RunComment, Converter={StaticResource IsNotNullConverter}}" Margin="5,-5,0,5" LinkCommand="{Binding OpenLinkCommand}" />
</VerticalStackLayout>
</Border>

Expand Down

0 comments on commit 00e7de2

Please sign in to comment.