Archived
1
0

Feedback hub removed, Subscription page development, changelog notifications

This commit is contained in:
Michael Gordeev
2018-08-19 00:14:20 +03:00
parent 4c4f4ed967
commit bf4262426d
16 changed files with 306 additions and 385 deletions
+2 -1
View File
@@ -8,7 +8,7 @@
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Padding="10" Name="grid">
<Grid Name="grid">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
@@ -50,6 +50,7 @@
<HyperlinkButton Content="YouTube Community Guidelines" NavigateUri="https://youtube.com/t/community_guidelines" Padding="0,0,0,10"/>
<TextBlock Text="© 2018 Michael Gordeev"/>
<TextBlock Text="© 2018 YouTube, LLC"/>
<Button Content="Leave feedback" Margin="5" Click="Button_Click"/>
</StackPanel>
<Image Grid.Column="1" Source="/Assets/LogoAvatar.png" VerticalAlignment="Top" Width="128"/>
</Grid>
@@ -29,5 +29,10 @@ namespace FoxTube.Pages.SettingsPages
this.InitializeComponent();
version.Text = string.Format("{0}.{1}.{2}", ver.Major, ver.Minor, ver.Build);
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(new Uri("feedback-hub:"));
}
}
}
-60
View File
@@ -1,60 +0,0 @@
<Page
x:Class="FoxTube.Pages.SettingsPages.Feedback"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FoxTube"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MaxWidth="1000"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Text="Feedback Hub" FontSize="28"/>
<TextBlock Text="What kind of feedback is it?" FontSize="18" Margin="0,10,0,0"/>
<StackPanel Orientation="Horizontal">
<RadioButton Name="suggestionRadio" Content="Suggestion" IsChecked="True"/>
<RadioButton Name="promblemRadio" Content="Problem"/>
</StackPanel>
<TextBlock Text="Tell us about it" FontSize="18" Margin="0,10,0,0"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<TextBox Name="subject" Grid.Column="0" HorizontalAlignment="Stretch" GotFocus="subject_GotFocus" Header="Summarize your issue (max 400 characters)" MaxLength="400"/>
<TextBlock Name="subjectMissed" Grid.Column="1" FontFamily="Segoe MDL2 Assets" Text="&#xE814;" Foreground="Red" FontSize="30" Visibility="Collapsed" VerticalAlignment="Bottom" Margin="1"/>
</Grid>
<TextBox Name="details" HorizontalAlignment="Stretch" Height="200" AcceptsReturn="True" ScrollViewer.VerticalScrollBarVisibility="Auto" MaxLength="1000" Margin="0,5,30,0" Header="Give us more detail (optional) (max 1000 characters)"/>
<CheckBox Content="I'd like to get response from developers" Name="emailToggle" Click="emailToggle_Click"/>
<TextBox Header="E-mail adress for response:" PlaceholderText="someone@example.com" IsEnabled="False" Name="email" Margin="0,5,30,0"/>
<StackPanel Orientation="Horizontal" BorderBrush="Green" BorderThickness="5" Margin="0,10,30,0" Name="debugAttached" Visibility="Collapsed">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE16C;" FontSize="40" Foreground="Green" Margin="5"/>
<StackPanel>
<TextBlock Text="Logs attached!" Foreground="Green" FontWeight="Bold" FontSize="20"/>
<TextBlock Text="You don't have to attach error code or exception details to you feedback. We did it ourselves." Foreground="Green"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" BorderBrush="Green" BorderThickness="5" Margin="0,10,30,0" Visibility="Collapsed" Name="greenResult">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE76E;" FontSize="40" Foreground="Green" Margin="5"/>
<StackPanel>
<TextBlock Text="Your feedback has been sent!" Foreground="Green" FontWeight="Bold" FontSize="20"/>
<TextBlock Text="Thank you! It's very imortant for us. Thank you for helping us making the app better" Foreground="Green"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" BorderBrush="OrangeRed" BorderThickness="5" Margin="0,10,30,0" Visibility="Collapsed" Name="cooldown">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE7BA;" FontSize="40" Foreground="OrangeRed" Margin="5"/>
<StackPanel>
<TextBlock Text="You reached your daily feedback limit" Foreground="OrangeRed" FontWeight="Bold" FontSize="20"/>
<TextBlock Text="To prevent spaming our mailbox we allow our users to send 1 feedback per day. Come back later to leave additional feedback." Foreground="OrangeRed"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="Submit feedback" Name="submit" Margin="0,10,10,10" Click="submit_Click" Background="{ThemeResource SystemControlForegroundAccentBrush}" Foreground="White"/>
<ProgressRing VerticalAlignment="Center" Name="ring" Foreground="Red"/>
</StackPanel>
</StackPanel>
</Grid>
</Page>
@@ -1,152 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Windows.Storage;
using System.Net.Mail;
using System.Net;
using Windows.UI.Popups;
using Windows.UI;
using System.Threading.Tasks;
using System.Diagnostics;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube.Pages.SettingsPages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class Feedback : Page
{
string debugData = "";
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
public Feedback()
{
this.InitializeComponent();
if (settings.Values["feedbackRecord"] == null)
settings.Values.Add("feedbackRecord", DateTimeToString(DateTime.Now - new TimeSpan(2, 0, 0, 0)));
TimeSpan interval = new TimeSpan(1, 0, 0, 0);
if(DateTime.Now - StringDateTime(settings.Values["feedbackRecord"].ToString()) < interval)
{
subject.IsEnabled = false;
details.IsEnabled = false;
promblemRadio.IsEnabled = suggestionRadio.IsEnabled = false;
submit.IsEnabled = false;
cooldown.Visibility = Visibility.Visible;
}
}
string DateTimeToString(DateTime dateTime)
{
string value = string.Format("{0} {1} {2} {3} {4} {5}", dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second);
Debug.WriteLine("Debag " + value);
return value;
}
DateTime StringDateTime(string value)
{
string[] t = value.Split(' ');
List<int> i = new List<int>();
foreach (string s in t)
i.Add(Convert.ToInt32(s));
return new DateTime(i[0], i[1], i[2], i[3], i[4], i[5]);
}
private async void submit_Click(object sender, RoutedEventArgs e)
{
//subject.Text = "This is test feedback";
//details.Text = "This is test for FoxTube Feedback System (FTFS)\nAaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz 0123456789";
if (subject.Text == "")
{
subjectMissed.Visibility = Visibility.Visible;
subject.Background = new SolidColorBrush(Colors.Pink);
}
else
{
string Type()
{
if ((bool)suggestionRadio.IsChecked) return "Suggestion";
else return "Problem";
}
MailMessage msg = new MailMessage();
msg.To.Add("foxgameofficial+foxtube@gmail.com");
msg.From = new MailAddress("foxgameofficial+foxtube@gmail.com");
msg.Subject = "FoxTube feedback";
msg.Body = string.Format("Type: {0}\nTime: {1}\n\nTitle:\n{2}\n\nDetails:\n{3}\n\nResponse e-mail: {4}\n\nException details:\n{5}", Type(), DateTime.Now, subject.Text, details.Text, email.Text, debugData);
subject.IsEnabled = false;
details.IsEnabled = false;
promblemRadio.IsEnabled = suggestionRadio.IsEnabled = false;
submit.IsEnabled = false;
ring.IsActive = true;
await Task.Delay(1000);
Submit(msg);
}
}
async void Submit(MailMessage mes)
{
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.EnableSsl = true;
client.Credentials = SecretsVault.EmailCredential;
try
{
client.Send(mes);
greenResult.Visibility = Visibility.Visible;
settings.Values["feedbackRecord"] = DateTimeToString(DateTime.Now);
}
catch
{
MessageDialog message = new MessageDialog("We was unable to send your feedback due to connection problems or internal server error. Please, try again later.", "Failed to send your feedback");
await message.ShowAsync();
subject.IsEnabled = true;
details.IsEnabled = true;
promblemRadio.IsEnabled = suggestionRadio.IsEnabled = true;
submit.IsEnabled = true;
}
ring.IsActive = false;
}
private void subject_GotFocus(object sender, RoutedEventArgs e)
{
subjectMissed.Visibility = Visibility.Collapsed;
subject.Background = new SolidColorBrush();
}
private void emailToggle_Click(object sender, RoutedEventArgs e)
{
email.IsEnabled = (bool)emailToggle.IsChecked;
}
public void PreDefine(bool isProblem, string meta)
{
if (isProblem)
{
promblemRadio.IsChecked = true;
suggestionRadio.IsChecked = false;
}
else
{
promblemRadio.IsChecked = false;
suggestionRadio.IsChecked = true;
}
debugData = meta;
debugAttached.Visibility = Visibility.Visible;
}
}
}
@@ -114,6 +114,8 @@ namespace FoxTube.Pages.SettingsPages
else
Methods.MainPage.RequestedTheme = ElementTheme.Light;
}
Methods.MainPage.SetTitleBar();
}
}
}