diff --git a/FoxTube/Assets/Data/Patchnotes.xml b/FoxTube/Assets/Data/Patchnotes.xml index e74565d..9b9a1e3 100644 --- a/FoxTube/Assets/Data/Patchnotes.xml +++ b/FoxTube/Assets/Data/Patchnotes.xml @@ -6,11 +6,15 @@ - Fixed some cases when playlist cards aren't displayed - Fixed some cases when the app crashes - Fixed app crashes on trying to navigate to not existing channel/playlist/video +- You can now report comments as spam +- You can now report videos ### Что нового: - Исправлены некоторые случаи при которых карточки плейлистов не отображались - Исправлены некоторые случай при которых приложение вылетало - Исправлены вылеты приложения при попытке перейти на несуществующий канал/плейлист/видео +- Теперь вы можете помечать комментарии как спам +- Теперь вы можете отправлять жалобы на видео diff --git a/FoxTube/Controls/CommentCard.xaml b/FoxTube/Controls/CommentCard.xaml index 13e4747..9a99864 100644 --- a/FoxTube/Controls/CommentCard.xaml +++ b/FoxTube/Controls/CommentCard.xaml @@ -36,7 +36,7 @@ FontFamily="Segoe MDL2 Assets" Text="" FontSize="20"/> - - - + + diff --git a/FoxTube/Controls/CommentCard.xaml.cs b/FoxTube/Controls/CommentCard.xaml.cs index 8d98e5a..7ffa2b0 100644 --- a/FoxTube/Controls/CommentCard.xaml.cs +++ b/FoxTube/Controls/CommentCard.xaml.cs @@ -39,6 +39,7 @@ namespace FoxTube.Controls thread = comment; replyBtn.Visibility = comment.Snippet.CanReply.Value && SecretsVault.IsAuthorized ? Visibility.Visible : Visibility.Collapsed; + spam.Visibility = SecretsVault.IsAuthorized ? Visibility.Visible : Visibility.Collapsed; if (!comment.Snippet.TotalReplyCount.HasValue || comment.Snippet.TotalReplyCount.Value == 0) showReplies.Visibility = Visibility.Collapsed; else @@ -101,6 +102,7 @@ namespace FoxTube.Controls replyBtn.Visibility = Visibility.Collapsed; showReplies.Visibility = Visibility.Collapsed; + spam.Visibility = SecretsVault.IsAuthorized ? Visibility.Visible : Visibility.Collapsed; if (comment.Snippet.CanRate == false) { @@ -327,5 +329,17 @@ namespace FoxTube.Controls await dialog.ShowAsync(); } + + private async void MarkAsSpam_Click(object sender, RoutedEventArgs e) + { + ResourceLoader resources = ResourceLoader.GetForCurrentView("Report"); + try { await SecretsVault.Service.Comments.MarkAsSpam(item.Id).ExecuteAsync(); } + catch + { + await new MessageDialog(resources.GetString("/Report/err")).ShowAsync(); + return; + } + await new MessageDialog(resources.GetString("/Report/submittedHeader"), resources.GetString("/Report/submittedBody")).ShowAsync(); + } } } diff --git a/FoxTube/Controls/ReportVideo.xaml b/FoxTube/Controls/ReportVideo.xaml new file mode 100644 index 0000000..e5f2dd2 --- /dev/null +++ b/FoxTube/Controls/ReportVideo.xaml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/FoxTube/Controls/ReportVideo.xaml.cs b/FoxTube/Controls/ReportVideo.xaml.cs new file mode 100644 index 0000000..7b1272f --- /dev/null +++ b/FoxTube/Controls/ReportVideo.xaml.cs @@ -0,0 +1,69 @@ +using Windows.UI.Xaml.Controls; +using Google.Apis.YouTube.v3.Data; +using Google.Apis.YouTube.v3; +using Windows.UI.Xaml; +using System; +using Windows.UI.Popups; +using Windows.ApplicationModel.Resources; + +namespace FoxTube.Controls +{ + public sealed partial class ReportVideo : ContentDialog + { + string videoId; + public ReportVideo(string id) + { + InitializeComponent(); + Initialize(); + videoId = id; + } + + async void Initialize() + { + VideoAbuseReportReasonsResource.ListRequest req = SecretsVault.Service.VideoAbuseReportReasons.List("id,snippet"); + req.Hl = SettingsStorage.RelevanceLanguage; + VideoAbuseReportReasonListResponse reasons = await req.ExecuteAsync(); + + foreach (VideoAbuseReportReason i in reasons.Items) + primaryReason.Items.Add(new ComboBoxItem + { + Tag = i, + Content = i.Snippet.Label + }); + } + + private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) + { + VideoAbuseReport report = new VideoAbuseReport + { + Comments = Methods.GuardFromNull(comment.Text), + VideoId = videoId, + ReasonId = ((primaryReason.SelectedItem as ComboBoxItem).Tag as VideoAbuseReportReason).Id, + SecondaryReasonId = secondaryReason.SelectedItem == null ? null : (secondaryReason.SelectedItem as ComboBoxItem).Tag as string + }; + + ResourceLoader resources = ResourceLoader.GetForCurrentView("Report"); + try { await SecretsVault.Service.Videos.ReportAbuse(report).ExecuteAsync(); } + catch + { + await new MessageDialog(resources.GetString("/Report/err")).ShowAsync(); + return; + } + await new MessageDialog(resources.GetString("/Report/submittedHeader"), resources.GetString("/Report/submittedBody")).ShowAsync(); + } + + private void PrimaryReason_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + IsPrimaryButtonEnabled = true; + secondaryReason.Items.Clear(); + foreach (VideoAbuseReportSecondaryReason i in ((primaryReason.SelectedItem as ComboBoxItem).Tag as VideoAbuseReportReason).Snippet.SecondaryReasons) + secondaryReason.Items.Add(new ComboBoxItem + { + Tag = i.Id, + Content = i.Label + }); + + secondaryReason.Visibility = secondaryReason.Items.Count == 0 ? Visibility.Collapsed : Visibility.Visible; + } + } +} diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj index f13388e..07e15a2 100644 --- a/FoxTube/FoxTube.csproj +++ b/FoxTube/FoxTube.csproj @@ -145,6 +145,9 @@ PlaylistCard.xaml + + ReportVideo.xaml + ShowMore.xaml @@ -284,6 +287,8 @@ + + @@ -336,6 +341,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/FoxTube/Pages/VideoPage.xaml b/FoxTube/Pages/VideoPage.xaml index 4bc704c..c889205 100644 --- a/FoxTube/Pages/VideoPage.xaml +++ b/FoxTube/Pages/VideoPage.xaml @@ -128,6 +128,10 @@ + + + + diff --git a/FoxTube/Pages/VideoPage.xaml.cs b/FoxTube/Pages/VideoPage.xaml.cs index c0bb70c..b8f1e8e 100644 --- a/FoxTube/Pages/VideoPage.xaml.cs +++ b/FoxTube/Pages/VideoPage.xaml.cs @@ -786,5 +786,11 @@ namespace FoxTube.Pages { Player.Player.Position = history.LeftOn; } + + private async void Report_Click(object sender, RoutedEventArgs e) + { + await new ReportVideo(item.Id).ShowAsync(); + + } } } diff --git a/FoxTube/Strings/en-US/CommentsPage.resw b/FoxTube/Strings/en-US/CommentsPage.resw index c60c8cd..be9ffda 100644 --- a/FoxTube/Strings/en-US/CommentsPage.resw +++ b/FoxTube/Strings/en-US/CommentsPage.resw @@ -174,6 +174,9 @@ Sort by: + + Report as spam + Add a public comment diff --git a/FoxTube/Strings/en-US/Report.resw b/FoxTube/Strings/en-US/Report.resw new file mode 100644 index 0000000..4775246 --- /dev/null +++ b/FoxTube/Strings/en-US/Report.resw @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Additional information (optional) + + + We are unable to send your report right now. Please, try again later + + + Reason + + + Select a reason... + + + Cancel + + + Report + + + Report a video + + + Select a category... + + + Thanks for making YouTube community better + + + Your report has been sent + + \ No newline at end of file diff --git a/FoxTube/Strings/en-US/VideoPage.resw b/FoxTube/Strings/en-US/VideoPage.resw index 1b3e246..6860e65 100644 --- a/FoxTube/Strings/en-US/VideoPage.resw +++ b/FoxTube/Strings/en-US/VideoPage.resw @@ -306,4 +306,7 @@ Playback speed + + Report this video + \ No newline at end of file diff --git a/FoxTube/Strings/ru-RU/CommentsPage.resw b/FoxTube/Strings/ru-RU/CommentsPage.resw index 4befdf2..bedef53 100644 --- a/FoxTube/Strings/ru-RU/CommentsPage.resw +++ b/FoxTube/Strings/ru-RU/CommentsPage.resw @@ -174,6 +174,9 @@ Сортировать по: + + Отметить как спам + Оставить комментарий diff --git a/FoxTube/Strings/ru-RU/Report.resw b/FoxTube/Strings/ru-RU/Report.resw new file mode 100644 index 0000000..938d7c9 --- /dev/null +++ b/FoxTube/Strings/ru-RU/Report.resw @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Дополнительная информация (необязательно) + + + Нам не удалось отправить жалобу прямо сейчас. Пожалуйста, попробуйте позже + + + Причина + + + Выберите причину... + + + Отмена + + + Пожаловаться + + + Пожаловаться на видео + + + Выберите категорию... + + + Спасибо что помогаете делать сообщество YouTube лучше + + + Ваша жалоба отправлена + + \ No newline at end of file diff --git a/FoxTube/Strings/ru-RU/VideoPage.resw b/FoxTube/Strings/ru-RU/VideoPage.resw index 76c703f..525c73a 100644 --- a/FoxTube/Strings/ru-RU/VideoPage.resw +++ b/FoxTube/Strings/ru-RU/VideoPage.resw @@ -306,4 +306,7 @@ Скорость видео + + Пожаловаться на видео + \ No newline at end of file