Skip to content

Commit 8b46ee8

Browse files
authored
支持分享 (Richasy#49)
* 添加分享按钮 * 调整直播UI,添加账户关系检查 * 更新PGC内容历史记录,添加消息页面的徽章文本
1 parent 59cbe76 commit 8b46ee8

28 files changed

Lines changed: 307 additions & 17 deletions

File tree

src/App/App.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@
366366
<Compile Include="Resources\Converter\EpisodeCoverConverter.cs" />
367367
<Compile Include="Resources\Converter\EpisodeTitleConverter.cs" />
368368
<Compile Include="Resources\Converter\FavoriteTypeConverter.cs" />
369+
<Compile Include="Resources\Converter\NumberToVisibilityConverter.cs" />
369370
<Compile Include="Resources\Converter\PgcFollowTextConverter.cs" />
370371
<Compile Include="Resources\Converter\MTCControlModeConverter.cs" />
371372
<Compile Include="Resources\Converter\PlayerDisplayModeConverter.cs" />

src/App/App.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<converter:ColorConverter x:Key="BrushConverter" IsBrush="True" />
3737
<converter:FavoriteTypeConverter x:Key="FavoriteTypeConverter" />
3838
<converter:DanmakuLocationConverter x:Key="DanmakuLocationConverter" />
39+
<converter:NumberToVisibilityConverter x:Key="NumberToVisibilityConverter" />
3940
</ResourceDictionary>
4041
</Application.Resources>
4142
</Application>

src/App/Controls/App/TipPopup.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@
5656
<icons:RegularFluentIcon
5757
x:Name="WarningIcon"
5858
FontSize="14"
59-
Foreground="{ThemeResource InfoBarSuccessSeverityIconBackground}"
59+
Foreground="{ThemeResource InfoBarWarningSeverityIconBackground}"
6060
Symbol="Warning16"
6161
Visibility="Collapsed" />
6262
<icons:RegularFluentIcon
6363
x:Name="SuccessIcon"
6464
FontSize="14"
65-
Foreground="{ThemeResource InfoBarWarningSeverityIconBackground}"
65+
Foreground="{ThemeResource InfoBarSuccessSeverityIconBackground}"
6666
Symbol="CheckmarkCircle20"
6767
Visibility="Collapsed" />
6868
<icons:RegularFluentIcon

src/App/Controls/Common/ArticleItem.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
<Grid
6969
x:Name="CoverContainer"
7070
Height="124"
71+
Margin="1,1,1,0"
7172
VerticalAlignment="Stretch"
7273
CornerRadius="4,4,0,0">
7374
<local:CommonImageEx x:Name="CoverImage" ImageUrl="{x:Bind ViewModel.CoverUrl, Mode=OneWay}" />

src/App/Controls/Common/VideoItem.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
<Grid
8383
x:Name="CoverContainer"
8484
Height="124"
85+
Margin="1,1,1,0"
8586
VerticalAlignment="Stretch"
8687
CornerRadius="4,4,0,0">
8788
<local:CommonImageEx x:Name="CoverImage" ImageUrl="{x:Bind ViewModel.CoverUrl, Mode=OneWay}" />

src/App/Controls/Player/PlayerDashboard.xaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,20 @@
187187
</Button>
188188
</StackPanel>
189189

190+
<StackPanel
191+
x:Name="LiveControlContainer"
192+
Margin="0,0,0,4"
193+
HorizontalAlignment="Stretch"
194+
Visibility="{x:Bind ViewModel.IsLive, Mode=OneWay}">
195+
<TextBlock
196+
Style="{StaticResource BodyTextBlockStyle}"
197+
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
198+
Text="{x:Bind ViewModel.LivePartition, Mode=OneWay}" />
199+
</StackPanel>
200+
190201
<Button
191202
x:Name="ShareButton"
203+
MinWidth="120"
192204
Margin="0,0,0,8"
193205
HorizontalAlignment="Stretch"
194206
Click="OnShareButtonClick">

src/App/Controls/Player/PlayerDashboard.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ private async void OnLikeButtonHoldingCompletedAsync(object sender, System.Event
3131

3232
private void OnShareButtonClick(object sender, RoutedEventArgs e)
3333
{
34+
ViewModel.Share();
3435
}
3536

3637
private void OnPgcDetailButtonClick(object sender, RoutedEventArgs e)

src/App/Controls/Player/PlayerDescriptor.xaml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,43 @@
2626
HorizontalAlignment="Left"
2727
Orientation="Horizontal"
2828
Spacing="12"
29-
Tapped="OnUserTappedAsync"
3029
Visibility="{x:Bind ViewModel.Publisher, Mode=OneWay, Converter={StaticResource ObjectToVisibilityConverter}}">
3130
<local:UserAvatar
32-
Width="32"
33-
Height="32"
31+
Width="36"
32+
Height="36"
3433
Avatar="{x:Bind ViewModel.Publisher.Avatar, Mode=OneWay}"
34+
Tapped="OnUserTappedAsync"
3535
UserName="{x:Bind ViewModel.Publisher.Name, Mode=OneWay}" />
36-
<TextBlock VerticalAlignment="Center" Text="{x:Bind ViewModel.Publisher.Name, Mode=OneWay}" />
36+
<StackPanel Spacing="4">
37+
<TextBlock VerticalAlignment="Center" Text="{x:Bind ViewModel.Publisher.Name, Mode=OneWay}" />
38+
<Grid HorizontalAlignment="Left">
39+
<Button
40+
x:Name="FollowButton"
41+
Style="{StaticResource AccentButtonStyle}"
42+
Padding="8,2"
43+
Click="OnFollowButtonClickAsync"
44+
Visibility="{x:Bind ViewModel.Publisher.IsFollow, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}">
45+
<local:IconTextBlock
46+
FontSize="10"
47+
IconFontSize="12"
48+
Spacing="2"
49+
Symbol="Add12"
50+
Text="{loc:LocaleLocator Name=Follow}" />
51+
</Button>
52+
<Button
53+
x:Name="UnfollowButton"
54+
Padding="8,2"
55+
Click="OnFollowButtonClickAsync"
56+
Visibility="{x:Bind ViewModel.Publisher.IsFollow, Mode=OneWay}">
57+
<local:IconTextBlock
58+
FontSize="10"
59+
IconFontSize="12"
60+
Spacing="2"
61+
Symbol="EyeShow12"
62+
Text="{loc:LocaleLocator Name=Followed}" />
63+
</Button>
64+
</Grid>
65+
</StackPanel>
3766
</StackPanel>
3867

3968
<Grid Grid.Row="1">

src/App/Controls/Player/PlayerDescriptor.xaml.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Copyright (c) Richasy. All rights reserved.
22

3+
using Windows.UI.Xaml.Controls;
4+
35
namespace Richasy.Bili.App.Controls
46
{
57
/// <summary>
@@ -19,5 +21,13 @@ private async void OnUserTappedAsync(object sender, Windows.UI.Xaml.Input.Tapped
1921
{
2022
await UserView.Instance.ShowAsync(ViewModel.Publisher);
2123
}
24+
25+
private async void OnFollowButtonClickAsync(object sender, Windows.UI.Xaml.RoutedEventArgs e)
26+
{
27+
var btn = sender as Button;
28+
btn.IsEnabled = false;
29+
await ViewModel.Publisher.ToggleFollowStateAsync();
30+
btn.IsEnabled = true;
31+
}
2232
}
2333
}

src/App/Pages/Overlay/MessagePage.xaml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,21 @@
4949
ItemInvoked="OnNavItemInvokedAsync"
5050
PaneDisplayMode="Top">
5151
<muxc:NavigationView.MenuItems>
52-
<muxc:NavigationViewItem x:Name="ReplyMeNavItem" Content="{loc:LocaleLocator Name=ReplyMe}" />
53-
<muxc:NavigationViewItem x:Name="AtMeNavItem" Content="{loc:LocaleLocator Name=AtMe}" />
54-
<muxc:NavigationViewItem x:Name="LikeMeNavItem" Content="{loc:LocaleLocator Name=LikeMe}" />
52+
<muxc:NavigationViewItem x:Name="ReplyMeNavItem" Content="{loc:LocaleLocator Name=ReplyMe}">
53+
<muxc:NavigationViewItem.InfoBadge>
54+
<muxc:InfoBadge Visibility="{x:Bind ViewModel.NewReplyMessageCount, Mode=OneWay, Converter={StaticResource NumberToVisibilityConverter}}" Value="{x:Bind ViewModel.NewReplyMessageCount, Mode=OneWay}" />
55+
</muxc:NavigationViewItem.InfoBadge>
56+
</muxc:NavigationViewItem>
57+
<muxc:NavigationViewItem x:Name="AtMeNavItem" Content="{loc:LocaleLocator Name=AtMe}">
58+
<muxc:NavigationViewItem.InfoBadge>
59+
<muxc:InfoBadge Visibility="{x:Bind ViewModel.NewAtMessageCount, Mode=OneWay, Converter={StaticResource NumberToVisibilityConverter}}" Value="{x:Bind ViewModel.NewAtMessageCount, Mode=OneWay}" />
60+
</muxc:NavigationViewItem.InfoBadge>
61+
</muxc:NavigationViewItem>
62+
<muxc:NavigationViewItem x:Name="LikeMeNavItem" Content="{loc:LocaleLocator Name=LikeMe}">
63+
<muxc:NavigationViewItem.InfoBadge>
64+
<muxc:InfoBadge Visibility="{x:Bind ViewModel.NewLikeMessageCount, Mode=OneWay, Converter={StaticResource NumberToVisibilityConverter}}" Value="{x:Bind ViewModel.NewLikeMessageCount, Mode=OneWay}" />
65+
</muxc:NavigationViewItem.InfoBadge>
66+
</muxc:NavigationViewItem>
5567
</muxc:NavigationView.MenuItems>
5668

5769
<muxc:NavigationView.PaneFooter>

0 commit comments

Comments
 (0)