Skip to content

Commit

Permalink
修复在用户空间动态页中转发动态
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmoyue committed Apr 8, 2024
1 parent 40c2eaa commit df99813
Show file tree
Hide file tree
Showing 26 changed files with 1,119 additions and 492 deletions.
24 changes: 20 additions & 4 deletions src/BiliLite.UWP/BiliLite.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,21 @@
<Compile Include="Controls\UserFollowingTagsFlyout.xaml.cs">
<DependentUpon>UserFollowingTagsFlyout.xaml</DependentUpon>
</Compile>
<Compile Include="Dialogs\SendDynamicV2Dialog.xaml.cs">
<DependentUpon>SendDynamicV2Dialog.xaml</DependentUpon>
</Compile>
<Compile Include="Extensions\ControlsExtensions.cs" />
<Compile Include="Extensions\QrCodeExtensions.cs" />
<Compile Include="Models\Common\Anime\ISeasonItem.cs" />
<Compile Include="Models\Common\Comment\HotReply.cs" />
<Compile Include="Models\Common\Danmaku\BiliDanmakuItem.cs" />
<Compile Include="Models\Common\Dynamic\DynamicUgcSeasonCardModel.cs" />
<Compile Include="Models\Common\UserDynamic\DynLiveInfo.cs" />
<Compile Include="Models\Common\User\SendDynamic\AtDisplayModel.cs" />
<Compile Include="Models\Common\User\SendDynamic\AtModel.cs" />
<Compile Include="Models\Common\User\SendDynamic\SendImagesModel.cs" />
<Compile Include="Models\Common\User\SendDynamic\UploadImagesModel.cs" />
<Compile Include="Models\Common\User\SendDynamic\RcmdTopicModel.cs" />
<Compile Include="ViewModels\UserDynamic\DynamicV2ItemViewModel.cs" />
<Compile Include="Models\Common\Home\DefaultHomeNavItems.cs" />
<Compile Include="Models\Common\Live\DefaultPlayUrlSourceOptions.cs" />
Expand Down Expand Up @@ -205,6 +214,8 @@
<DependentUpon>DynamicSpacePage.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModels\UserDynamic\UserDynamicSpaceViewModel.cs" />
<Compile Include="Models\Common\User\SendDynamic\AtUserModel.cs" />
<Compile Include="ViewModels\User\SendDynamic\SendDynamicV2ViewModel.cs" />
<Compile Include="ViewModels\User\UserAttentionButtonViewModel.cs" />
<Compile Include="ViewModels\User\UserFollowingTagsFlyoutViewModel.cs" />
<Compile Include="ViewModels\User\UserRelationFollowingTagViewModel.cs" />
Expand Down Expand Up @@ -613,7 +624,7 @@
<Compile Include="Models\ReturnModel.cs" />
<Compile Include="Models\UserModels.cs" />
<Compile Include="Modules\Detail\FavoriteDetailVM.cs" />
<Compile Include="Modules\EmoteVM.cs" />
<Compile Include="ViewModels\EmoteViewModel.cs" />
<Compile Include="Modules\Home\RegionVM.cs" />
<Compile Include="Modules\Live\LiveAreaDetailVM.cs" />
<Compile Include="Modules\Live\LiveAreaVM.cs" />
Expand Down Expand Up @@ -645,7 +656,7 @@
<Compile Include="ViewModels\UserDynamic\UserDynamicRepostViewModel.cs" />
<Compile Include="ViewModels\UserDynamic\UserDynamicViewModel.cs" />
<Compile Include="Modules\User\LoginVM.cs" />
<Compile Include="Modules\User\SendDynamic\AtVM.cs" />
<Compile Include="ViewModels\User\SendDynamic\AtViewModel.cs" />
<Compile Include="ViewModels\User\HistoryViewModel.cs" />
<Compile Include="Modules\User\MyFollowSeasonVM.cs" />
<Compile Include="Modules\Player\PlayerVM.cs" />
Expand All @@ -657,8 +668,8 @@
<Compile Include="Modules\SettingVM.cs" />
<Compile Include="ViewModels\Video\VideoDetailPageViewModel.cs" />
<Compile Include="Modules\User\MyFollowVideoVM.cs" />
<Compile Include="Modules\User\SendDynamic\SendDynamicVM.cs" />
<Compile Include="Modules\User\SendDynamic\TopicVM.cs" />
<Compile Include="ViewModels\User\SendDynamic\SendDynamicViewModel.cs" />
<Compile Include="ViewModels\User\SendDynamic\TopicViewModel.cs" />
<Compile Include="ViewModels\User\UserDetailViewModel.cs" />
<Compile Include="Modules\User\UserDetail\UserFavlistVM.cs" />
<Compile Include="Modules\User\UserDetail\UserFollowVM.cs" />
Expand Down Expand Up @@ -951,6 +962,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Dialogs\SendDynamicV2Dialog.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\User\DynamicSpacePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -1334,6 +1349,7 @@
<ItemGroup>
<Folder Include="Assets\Tools\" />
<Folder Include="Models\Requests\Api\Grpc\" />
<Folder Include="Modules\User\SendDynamic\" />
</ItemGroup>
<ItemGroup>
<SDKReference Include="WindowsDesktop, Version=10.0.17763.0">
Expand Down
3 changes: 2 additions & 1 deletion src/BiliLite.UWP/Controls/CommentControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
xmlns:convert="using:BiliLite.Converters" xmlns:modules="using:BiliLite.Modules"
xmlns:comment="using:BiliLite.ViewModels.Comment"
xmlns:common="using:BiliLite.Models.Common"
xmlns:viewModels="using:BiliLite.ViewModels"
d:DesignHeight="300"
d:DesignWidth="400"
x:Name="CommentControlContent"
Expand Down Expand Up @@ -43,7 +44,7 @@
<Grid Width="320">
<Pivot x:Name="PivotFace" ItemsSource="{x:Bind Path=emoteVM.Packages,Mode=OneWay}">
<Pivot.HeaderTemplate>
<DataTemplate x:DataType="modules:EmotePackageModel">
<DataTemplate x:DataType="viewModels:EmotePackageModel">
<TextBlock FontSize="18" Text="{x:Bind text}"></TextBlock>
</DataTemplate>
</Pivot.HeaderTemplate>
Expand Down
5 changes: 3 additions & 2 deletions src/BiliLite.UWP/Controls/CommentControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using BiliLite.Models.Exceptions;
using BiliLite.Models.Requests.Api;
using BiliLite.Services;
using BiliLite.ViewModels;
using BiliLite.ViewModels.Comment;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Toolkit.Uwp.UI.Controls;
Expand All @@ -30,7 +31,7 @@ public sealed partial class CommentControl : UserControl
#region Fields

private readonly CommentApi m_commentApi;
EmoteVM emoteVM;
EmoteViewModel emoteVM;
private bool m_disableShowPicture = false;
private static readonly ILogger _logger = GlobalLogger.FromCurrentType();
private CommentCursor m_nextCursor;
Expand All @@ -50,10 +51,10 @@ public CommentControl()
{
m_mapper = App.ServiceProvider.GetService<IMapper>();
m_viewModel = App.ServiceProvider.GetService<CommentControlViewModel>();
emoteVM = App.ServiceProvider.GetService<EmoteViewModel>();
DataContext = m_viewModel;
this.InitializeComponent();
m_commentApi = new CommentApi();
emoteVM = new EmoteVM();
Unloaded += CommentControl_Unloaded;
}

Expand Down
3 changes: 2 additions & 1 deletion src/BiliLite.UWP/Dialogs/SendCommentDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
mc:Ignorable="d"
Title="发表评论"
xmlns:modules="using:BiliLite.Modules"
xmlns:viewModels="using:BiliLite.ViewModels"
PrimaryButtonText="发送"
SecondaryButtonText="取消"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
Expand All @@ -17,7 +18,7 @@
<Grid Width="320">
<Pivot x:Name="pivot_face" ItemsSource="{x:Bind Path=emoteVM.Packages,Mode=OneWay}">
<Pivot.HeaderTemplate>
<DataTemplate x:DataType="modules:EmotePackageModel">
<DataTemplate x:DataType="viewModels:EmotePackageModel">
<TextBlock FontSize="18" Text="{x:Bind text}"></TextBlock>
</DataTemplate>
</Pivot.HeaderTemplate>
Expand Down
7 changes: 4 additions & 3 deletions src/BiliLite.UWP/Dialogs/SendCommentDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using BiliLite.Models.Requests.Api;
using BiliLite.Modules;
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using BiliLite.Extensions;
using BiliLite.ViewModels;
using static BiliLite.Models.Requests.Api.CommentApi;
using Microsoft.Extensions.DependencyInjection;

// https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“内容对话框”项模板

Expand All @@ -13,14 +14,14 @@ namespace BiliLite.Dialogs
public sealed partial class SendCommentDialog : ContentDialog
{
readonly CommentApi commentApi;
readonly EmoteVM emoteVM;
readonly EmoteViewModel emoteVM;
readonly string oid;
readonly CommentType commentType;
public SendCommentDialog(string oid, CommentType commentType)
{
emoteVM = App.ServiceProvider.GetService<EmoteViewModel>();
this.InitializeComponent();
commentApi = new CommentApi();
emoteVM = new EmoteVM();
this.oid = oid;
this.commentType = commentType;
}
Expand Down
33 changes: 17 additions & 16 deletions src/BiliLite.UWP/Dialogs/SendDynamicDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
xmlns:modules="using:BiliLite.Modules"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="using:BiliLite.ViewModels"
mc:Ignorable="d">
<ContentDialog.Resources>
<Flyout x:Key="FaceFlyout" x:Name="FaceFlyout">
<Grid Width="320">
<Pivot x:Name="pivot_face" ItemsSource="{x:Bind Path=emoteVM.Packages,Mode=OneWay}">
<Pivot.HeaderTemplate>
<DataTemplate x:DataType="modules:EmotePackageModel">
<DataTemplate x:DataType="viewModels:EmotePackageModel">
<TextBlock FontSize="18" Text="{x:Bind text}"></TextBlock>
</DataTemplate>
</Pivot.HeaderTemplate>
Expand All @@ -30,7 +31,7 @@
<DataTemplate>
<StackPanel >
<Image Visibility="{Binding Path=showImage}" Source="{Binding url}" Width="36" Margin="4 0"></Image>
<TextBlock Width="90" TextAlignment="Center" Visibility="{Binding Path=showImage,Converter={StaticResource display}}" FontSize="12" HorizontalAlignment="Center" Text="{Binding text}"></TextBlock>
<TextBlock Width="90" TextAlignment="Center" Visibility="{Binding Path=showImage,Converter={StaticResource display}}" FontSize="12" HorizontalAlignment="Center" Text="{Binding Text}"></TextBlock>


</StackPanel>
Expand Down Expand Up @@ -99,21 +100,21 @@
<Grid>

<StackPanel x:Name="st" Width="440">
<TextBlock Visibility="{x:Bind Path=sendDynamicVM.IsRepost,Mode=OneWay}" Margin="4 0">转发动态</TextBlock>
<TextBlock Visibility="{x:Bind Path=sendDynamicVM.IsRepost,Mode=OneWay,Converter={StaticResource display}}" Margin="4 0">发表动态</TextBlock>
<TextBlock Visibility="{x:Bind Path=m_viewModel.IsRepost,Mode=OneWay}" Margin="4 0">转发动态</TextBlock>
<TextBlock Visibility="{x:Bind Path=m_viewModel.IsRepost,Mode=OneWay,Converter={StaticResource display}}" Margin="4 0">发表动态</TextBlock>
<TextBox x:Name="txtContent" TextChanged="txtContent_TextChanged" MinHeight="120" Margin="0 4 0 0" TextWrapping="Wrap" MaxLength="233" AcceptsReturn="True" PlaceholderText="说点什么吧..."></TextBox>

<StackPanel Visibility="{x:Bind Path=sendDynamicVM.IsRepost,Mode=OneWay}" Margin="0 8" Padding="8" Background="#33808080">
<StackPanel Visibility="{x:Bind Path=m_viewModel.IsRepost,Mode=OneWay}" Margin="0 8" Padding="8" Background="#33808080">
<TextBlock
MaxLines="1"
TextTrimming="CharacterEllipsis"
Visibility="{x:Bind Path=sendDynamicVM.IsRepost,Mode=OneWay}" >
Visibility="{x:Bind Path=m_viewModel.IsRepost,Mode=OneWay}" >
@
<Run Text="{x:Bind Path=sendDynamicVM.RepostInfo.UserName,Mode=OneWay}"></Run>
<Run Text="{x:Bind Path=m_viewModel.RepostInfo.UserName,Mode=OneWay}"></Run>
</TextBlock>
<TextBlock
Visibility="{x:Bind Path=sendDynamicVM.IsRepost,Mode=OneWay}"
Text="{x:Bind Path=sendDynamicVM.RepostInfo.ContentStr,Mode=OneWay}"
Visibility="{x:Bind Path=m_viewModel.IsRepost,Mode=OneWay}"
Text="{x:Bind Path=m_viewModel.RepostInfo.ContentStr,Mode=OneWay}"
MaxLines="1"
TextTrimming="CharacterEllipsis"
FontSize="14"
Expand All @@ -133,7 +134,7 @@
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="14" Glyph="&#xE1E9;" />
</StackPanel>
</Button>-->
<Button x:Name="btnImage" Click="btnImage_Click" Visibility="{x:Bind Path=sendDynamicVM.IsRepost,Mode=OneWay,Converter={StaticResource display}}" ToolTipService.ToolTip="上传图片" Width="36" Height="36" Margin="4 0 0 0" >
<Button x:Name="btnImage" Click="btnImage_Click" Visibility="{x:Bind Path=m_viewModel.IsRepost,Mode=OneWay,Converter={StaticResource display}}" ToolTipService.ToolTip="上传图片" Width="36" Height="36" Margin="4 0 0 0" >
<StackPanel Orientation="Horizontal">
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="14" Glyph="&#xEB9F;" />

Expand All @@ -145,7 +146,7 @@
</StackPanel>

</Button>
<Button x:Name="btnTopic" Click="btnTopic_Click" Visibility="{x:Bind Path=sendDynamicVM.IsRepost,Mode=OneWay,Converter={StaticResource display}}" Width="36" Height="36" Margin="4 0 0 0" ToolTipService.ToolTip="话题" >
<Button x:Name="btnTopic" Click="btnTopic_Click" Visibility="{x:Bind Path=m_viewModel.IsRepost,Mode=OneWay,Converter={StaticResource display}}" Width="36" Height="36" Margin="4 0 0 0" ToolTipService.ToolTip="话题" >
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="18" Text="#" />
</StackPanel>
Expand All @@ -163,19 +164,19 @@
<Button x:Name="btnSend" Click="btnSend_Click" Width="64" Foreground="White" Background="{ThemeResource SystemAccentColor}" >发表</Button>
</StackPanel>
</Grid>
<StackPanel x:Name="pr_Upload" Margin="0 4" Visibility="{x:Bind Path=sendDynamicVM.Uploading,Mode=OneWay}">
<StackPanel x:Name="pr_Upload" Margin="0 4" Visibility="{x:Bind Path=m_viewModel.Uploading,Mode=OneWay}">
<ProgressBar Background="#00000000" IsIndeterminate="True" ></ProgressBar>
<TextBlock FontSize="14" Foreground="Gray" Margin="4 0" VerticalAlignment="Center">图片上传中...</TextBlock>
</StackPanel>

<StackPanel x:Name="pics" Visibility="{x:Bind Path=sendDynamicVM.ShowImage,Mode=OneWay}" Margin="0 4" Padding="4" Background="#33808080">
<TextBlock Margin="0 4"><Run Text="{x:Bind Path=sendDynamicVM.Images.Count,Mode=OneWay}"></Run>/9张图片</TextBlock>
<GridView x:Name="gv_Pics" ItemsSource="{x:Bind Path=sendDynamicVM.Images,Mode=OneWay}" HorizontalAlignment="Center" SelectionMode="None" IsItemClickEnabled="True" MaxHeight="200" Margin="0 4 0 0">
<StackPanel x:Name="pics" Visibility="{x:Bind Path=m_viewModel.ShowImage,Mode=OneWay}" Margin="0 4" Padding="4" Background="#33808080">
<TextBlock Margin="0 4"><Run Text="{x:Bind Path=m_viewModel.Images.Count,Mode=OneWay}"></Run>/9张图片</TextBlock>
<GridView x:Name="gv_Pics" ItemsSource="{x:Bind Path=m_viewModel.Images,Mode=OneWay}" HorizontalAlignment="Center" SelectionMode="None" IsItemClickEnabled="True" MaxHeight="200" Margin="0 4 0 0">

<GridView.ItemTemplate>
<DataTemplate>
<Grid>
<Image Width="100" Source="{Binding image}" Stretch="UniformToFill"></Image>
<Image Width="100" Source="{Binding Image}" Stretch="UniformToFill"></Image>
<Button Click="btn_RemovePic_Click" Foreground="White" HorizontalAlignment="Right" VerticalAlignment="Top" BorderThickness="0" Width="24" Height="24" Padding="0" Background="#33000000">
<FontIcon FontFamily="Segoe MDL2 Assets" FontSize="14" Glyph="&#xE947;" />
</Button>
Expand Down
Loading

0 comments on commit df99813

Please sign in to comment.