diff --git a/FoxTube/Classes/SecretsVault.cs b/FoxTube/Classes/SecretsVault.cs index bd40783..588957d 100644 --- a/FoxTube/Classes/SecretsVault.cs +++ b/FoxTube/Classes/SecretsVault.cs @@ -32,6 +32,7 @@ namespace FoxTube #region Static Information public static NetworkCredential EmailCredential { get => new NetworkCredential("youwillneverknowthisadress@gmail.com", "thisisthepassword12345"); } public static SecretsVault Vault { get => Methods.MainPage.Vault; } + public static string AccountId => Methods.MainPage.Vault.userId; private static ClientSecrets Secrets { get => new ClientSecrets() @@ -63,6 +64,7 @@ namespace FoxTube #region Object containers public bool IsLoged = false; + public string userId; public UserCredential Credential; public event EventHandler AuthorizationStateChanged; @@ -75,6 +77,10 @@ namespace FoxTube IsLoged = true; AuthorizationStateChanged.Invoke(this, null); } + + var request = Service.Channels.List("snippet"); + request.Mine = true; + userId = (await request.ExecuteAsync()).Items[0].Id; } public async void Deauthenticate() diff --git a/FoxTube/Controls/CommentCard.xaml b/FoxTube/Controls/CommentCard.xaml index d5040f7..5fea065 100644 --- a/FoxTube/Controls/CommentCard.xaml +++ b/FoxTube/Controls/CommentCard.xaml @@ -30,11 +30,19 @@ + + + + + + diff --git a/FoxTube/Controls/CommentCard.xaml.cs b/FoxTube/Controls/CommentCard.xaml.cs index 3f26ea2..b49a863 100644 --- a/FoxTube/Controls/CommentCard.xaml.cs +++ b/FoxTube/Controls/CommentCard.xaml.cs @@ -23,9 +23,11 @@ using Windows.UI.Popups; namespace FoxTube.Controls { + public enum CommentType { TopLevel, Reply } public sealed partial class CommentCard : UserControl { Comment item; + CommentType type = CommentType.TopLevel; string NextPageToken; public CommentCard(CommentThread comment) @@ -52,6 +54,9 @@ namespace FoxTube.Controls else rating.Text = comment.Snippet.TopLevelComment.Snippet.LikeCount.HasValue ? comment.Snippet.TopLevelComment.Snippet.LikeCount.ToString() : ""; + if (item.Snippet.AuthorChannelId.ToString().Split('"')[3] == SecretsVault.AccountId) + editBtn.Visibility = Visibility.Visible; + meta.Text = string.Format("{0} | {1} {2}", comment.Snippet.TopLevelComment.Snippet.AuthorDisplayName, Methods.GetAgo(comment.Snippet.TopLevelComment.Snippet.PublishedAt.Value), comment.Snippet.TopLevelComment.Snippet.UpdatedAt != comment.Snippet.TopLevelComment.Snippet.PublishedAt ? "(edited)" : ""); Methods.FormatText(ref text, comment.Snippet.TopLevelComment.Snippet.TextDisplay); @@ -90,6 +95,7 @@ namespace FoxTube.Controls public void Initialize(Comment comment) { item = comment; + type = CommentType.Reply; replyBtn.Visibility = Visibility.Collapsed; showReplies.Visibility = Visibility.Collapsed; @@ -186,5 +192,39 @@ namespace FoxTube.Controls reply.IsEnabled = true; sending.Visibility = Visibility.Collapsed; } + + private void editorClose_Click(object sender, RoutedEventArgs e) + { + ((grid.Children[0] as Grid).Children[1] as Grid).RowDefinitions[2].Height = GridLength.Auto; + text.Visibility = Visibility.Visible; + editor.Visibility = Visibility.Collapsed; + } + + private void editorSend_Click(object sender, RoutedEventArgs e) + { + if(type == CommentType.Reply) + { + + } + else + { + + } + } + + private void editorText_TextChanged(object sender, TextChangedEventArgs e) + { + if (editorText.Text.Length == 0) + editorSend.IsEnabled = false; + else editorSend.IsEnabled = true; + } + + private void editBtn_Click(object sender, RoutedEventArgs e) + { + ((grid.Children[0] as Grid).Children[1] as Grid).RowDefinitions[2].Height = new GridLength(0); + text.Visibility = Visibility.Collapsed; + editorText.Text = text.Text; + editor.Visibility = Visibility.Visible; + } } }