From 1f056db43d6e57436d273731909f1a2cabfd736f Mon Sep 17 00:00:00 2001
From: Thomas <71355143+thomas694@users.noreply.github.com>
Date: Sun, 17 Oct 2021 20:52:00 +0200
Subject: [PATCH] Add Feedback button in About dialog
- The user shall have an easy way to provide feedback.
- A second icon (thumbs up) has been added to the about button to symbolize feedback possibility.
---
src/TumblThree/SharedAssemblyInfo.cs | 4 +-
.../Properties/Resources.Designer.cs | 9 +++
.../Properties/Resources.de.resx | 3 +
.../Properties/Resources.es.resx | 3 +
.../Properties/Resources.fr.resx | 3 +
.../Properties/Resources.resx | 3 +
.../Services/ApplicationUpdateService.cs | 31 ++++++++
.../Services/IApplicationUpdateService.cs | 2 +
.../TumblThree.Applications.csproj | 2 +
.../ViewModels/AboutViewModel.cs | 14 +++-
.../ViewModels/FeedbackViewModel.cs | 63 +++++++++++++++
.../Views/IFeedbackView.cs | 11 +++
.../DesignData/SampleAboutViewModel.cs | 2 +-
.../Properties/Resources.Designer.cs | 48 ++++++++++++
.../Properties/Resources.de.resx | 15 ++++
.../Properties/Resources.es.resx | 15 ++++
.../Properties/Resources.fr.resx | 15 ++++
.../Properties/Resources.resx | 18 +++++
.../TumblThree.Presentation.csproj | 7 ++
.../Views/AboutView.xaml | 13 ++--
.../Views/CrawlerView.xaml | 3 +-
.../Views/FeedbackView.xaml | 34 ++++++++
.../Views/FeedbackView.xaml.cs | 77 +++++++++++++++++++
23 files changed, 385 insertions(+), 10 deletions(-)
create mode 100644 src/TumblThree/TumblThree.Applications/ViewModels/FeedbackViewModel.cs
create mode 100644 src/TumblThree/TumblThree.Applications/Views/IFeedbackView.cs
create mode 100644 src/TumblThree/TumblThree.Presentation/Views/FeedbackView.xaml
create mode 100644 src/TumblThree/TumblThree.Presentation/Views/FeedbackView.xaml.cs
diff --git a/src/TumblThree/SharedAssemblyInfo.cs b/src/TumblThree/SharedAssemblyInfo.cs
index f7fdc56a..a40c10db 100644
--- a/src/TumblThree/SharedAssemblyInfo.cs
+++ b/src/TumblThree/SharedAssemblyInfo.cs
@@ -12,5 +12,5 @@
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.MainAssembly)]
-[assembly: AssemblyVersion("2.3.0.0")]
-[assembly: AssemblyFileVersion("2.3.0.0")]
+[assembly: AssemblyVersion("2.4.0.0")]
+[assembly: AssemblyFileVersion("2.4.0.0")]
diff --git a/src/TumblThree/TumblThree.Applications/Properties/Resources.Designer.cs b/src/TumblThree/TumblThree.Applications/Properties/Resources.Designer.cs
index 600171af..0c1744a2 100644
--- a/src/TumblThree/TumblThree.Applications/Properties/Resources.Designer.cs
+++ b/src/TumblThree/TumblThree.Applications/Properties/Resources.Designer.cs
@@ -837,6 +837,15 @@ public static string ReblogUrl {
}
}
+ ///
+ /// Looks up a localized string similar to An error occurred while sending the feedback. Please try it again later..
+ ///
+ public static string SendFeedbackError {
+ get {
+ return ResourceManager.GetString("SendFeedbackError", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Slug: {0}.
///
diff --git a/src/TumblThree/TumblThree.Applications/Properties/Resources.de.resx b/src/TumblThree/TumblThree.Applications/Properties/Resources.de.resx
index bf27f136..8d80bcef 100644
--- a/src/TumblThree/TumblThree.Applications/Properties/Resources.de.resx
+++ b/src/TumblThree/TumblThree.Applications/Properties/Resources.de.resx
@@ -373,4 +373,7 @@ Möchten Sie es jetzt herunterladen?
Der angegebene Name enthält ungültige Pfadnamenzeichen!
+
+ Beim Senden des Feedbacks ist ein Fehler aufgetreten. Bitte versuchen Sie es später erneut.
+
\ No newline at end of file
diff --git a/src/TumblThree/TumblThree.Applications/Properties/Resources.es.resx b/src/TumblThree/TumblThree.Applications/Properties/Resources.es.resx
index 19202528..61285c2f 100644
--- a/src/TumblThree/TumblThree.Applications/Properties/Resources.es.resx
+++ b/src/TumblThree/TumblThree.Applications/Properties/Resources.es.resx
@@ -373,4 +373,7 @@
¡El nombre especificado contiene caracteres de nombre de ruta no válidos!
+
+ Se produjo un error al enviar los comentarios. Inténtelo de nuevo más tarde.
+
\ No newline at end of file
diff --git a/src/TumblThree/TumblThree.Applications/Properties/Resources.fr.resx b/src/TumblThree/TumblThree.Applications/Properties/Resources.fr.resx
index 6ebc83fe..53d2cac8 100644
--- a/src/TumblThree/TumblThree.Applications/Properties/Resources.fr.resx
+++ b/src/TumblThree/TumblThree.Applications/Properties/Resources.fr.resx
@@ -373,4 +373,7 @@ Voulez-vous le télécharger maintenant?
Le nom spécifié contient des caractères de nom de chemin non valides!
+
+ Une erreur s'est produite lors de l'envoi du commentaire. Veuillez réessayer plus tard.
+
\ No newline at end of file
diff --git a/src/TumblThree/TumblThree.Applications/Properties/Resources.resx b/src/TumblThree/TumblThree.Applications/Properties/Resources.resx
index ec9d2416..156d2561 100644
--- a/src/TumblThree/TumblThree.Applications/Properties/Resources.resx
+++ b/src/TumblThree/TumblThree.Applications/Properties/Resources.resx
@@ -414,4 +414,7 @@ Do you want to download it now?
The specified name contains invalid path name characters!
+
+ An error occurred while sending the feedback. Please try it again later.
+
\ No newline at end of file
diff --git a/src/TumblThree/TumblThree.Applications/Services/ApplicationUpdateService.cs b/src/TumblThree/TumblThree.Applications/Services/ApplicationUpdateService.cs
index db983891..834e2f3d 100644
--- a/src/TumblThree/TumblThree.Applications/Services/ApplicationUpdateService.cs
+++ b/src/TumblThree/TumblThree.Applications/Services/ApplicationUpdateService.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Net;
@@ -6,6 +7,7 @@
using System.Text;
using System.Threading.Tasks;
using System.Waf.Applications;
+using System.Web;
using System.Xml;
using System.Xml.Linq;
using TumblThree.Domain;
@@ -94,5 +96,34 @@ public Uri GetDownloadUri()
return new Uri(downloadLink);
}
+
+ public async Task SendFeedback(string name, string email, string message)
+ {
+ try
+ {
+ HttpWebRequest request = webRequestFactory.CreatePostRequest("https://9332a1f6dcab0d2f3fdafd51eaed07ca.m.pipedream.net");
+ request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
+ var p = new Dictionary();
+ p.Add("name", name);
+ p.Add("email", email);
+ p.Add("title", "App Feedback");
+ p.Add("message", message);
+ p.Add("url", "");
+ var fields = string.Join("&", p.Select(kvp => string.Format("{0}={1}", kvp.Key, HttpUtility.UrlEncode(kvp.Value))));
+ p = new Dictionary() { { "form", fields }, { "other", "" } };
+ await webRequestFactory.PerformPostRequestAsync(request, p);
+ using (var response = await request.GetResponseAsync() as HttpWebResponse)
+ {
+ if (response.StatusCode != HttpStatusCode.OK)
+ throw new ApplicationException(string.Format("endpoint returned: {0} {1}", response.StatusCode, response.StatusDescription));
+ }
+ return true;
+ }
+ catch (Exception exception)
+ {
+ Logger.Error(exception.ToString());
+ throw;
+ }
+ }
}
}
diff --git a/src/TumblThree/TumblThree.Applications/Services/IApplicationUpdateService.cs b/src/TumblThree/TumblThree.Applications/Services/IApplicationUpdateService.cs
index 08528f35..220da246 100644
--- a/src/TumblThree/TumblThree.Applications/Services/IApplicationUpdateService.cs
+++ b/src/TumblThree/TumblThree.Applications/Services/IApplicationUpdateService.cs
@@ -12,5 +12,7 @@ public interface IApplicationUpdateService
string GetNewAvailableVersion();
Uri GetDownloadUri();
+
+ Task SendFeedback(string name, string email, string message);
}
}
diff --git a/src/TumblThree/TumblThree.Applications/TumblThree.Applications.csproj b/src/TumblThree/TumblThree.Applications/TumblThree.Applications.csproj
index d812f9e6..3f4da0a1 100644
--- a/src/TumblThree/TumblThree.Applications/TumblThree.Applications.csproj
+++ b/src/TumblThree/TumblThree.Applications/TumblThree.Applications.csproj
@@ -261,6 +261,7 @@
+
@@ -274,6 +275,7 @@
+
diff --git a/src/TumblThree/TumblThree.Applications/ViewModels/AboutViewModel.cs b/src/TumblThree/TumblThree.Applications/ViewModels/AboutViewModel.cs
index e1d89bfc..dca920fb 100644
--- a/src/TumblThree/TumblThree.Applications/ViewModels/AboutViewModel.cs
+++ b/src/TumblThree/TumblThree.Applications/ViewModels/AboutViewModel.cs
@@ -19,20 +19,24 @@ public class AboutViewModel : ViewModel
private readonly AsyncDelegateCommand _checkForUpdatesCommand;
private readonly DelegateCommand _downloadCommand;
private readonly DelegateCommand _showWebsiteCommand;
+ private readonly DelegateCommand _feedbackCommand;
+ private readonly ExportFactory _feedbackViewModelFactory;
private readonly IApplicationUpdateService _applicationUpdateService;
private bool _isCheckInProgress;
private bool _isLatestVersionAvailable;
private string _updateText;
[ImportingConstructor]
- public AboutViewModel(IAboutView view, IApplicationUpdateService applicationUpdateService)
+ public AboutViewModel(IAboutView view, IApplicationUpdateService applicationUpdateService, ExportFactory feedbackViewModelFactory)
: base(view)
{
_showWebsiteCommand = new DelegateCommand(ShowWebsite);
_checkForUpdatesCommand = new AsyncDelegateCommand(CheckForUpdates);
_downloadCommand = new DelegateCommand(DownloadNewVersion);
+ _feedbackCommand = new DelegateCommand(Feedback);
_applicationUpdateService = applicationUpdateService;
+ _feedbackViewModelFactory = feedbackViewModelFactory;
}
public ICommand ShowWebsiteCommand => _showWebsiteCommand;
@@ -41,6 +45,8 @@ public AboutViewModel(IAboutView view, IApplicationUpdateService applicationUpda
public ICommand DownloadCommand => _downloadCommand;
+ public ICommand FeedbackCommand => _feedbackCommand;
+
#pragma warning disable CA1822
public string ProductName => ApplicationInfo.ProductName;
@@ -101,6 +107,12 @@ private async Task CheckForUpdates()
await CheckForUpdatesComplete(_applicationUpdateService.GetLatestReleaseFromServer());
}
+ private void Feedback()
+ {
+ FeedbackViewModel feedbackViewModel = _feedbackViewModelFactory.CreateExport().Value;
+ feedbackViewModel.ShowDialog(this);
+ }
+
private async Task CheckForUpdatesComplete(Task task)
{
IsCheckInProgress = false;
diff --git a/src/TumblThree/TumblThree.Applications/ViewModels/FeedbackViewModel.cs b/src/TumblThree/TumblThree.Applications/ViewModels/FeedbackViewModel.cs
new file mode 100644
index 00000000..af3fe0c5
--- /dev/null
+++ b/src/TumblThree/TumblThree.Applications/ViewModels/FeedbackViewModel.cs
@@ -0,0 +1,63 @@
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Composition;
+using System.Threading.Tasks;
+using System.Waf.Applications;
+using System.Windows;
+using System.Windows.Input;
+using TumblThree.Applications.Properties;
+using TumblThree.Applications.Services;
+using TumblThree.Applications.Views;
+using TumblThree.Domain;
+
+namespace TumblThree.Applications.ViewModels
+{
+ [Export]
+ public class FeedbackViewModel : ViewModel
+ {
+ private readonly AsyncDelegateCommand _sendCommand;
+ private readonly IApplicationUpdateService _applicationUpdateService;
+
+ private string _message;
+
+ [ImportingConstructor]
+ public FeedbackViewModel(IFeedbackView view, IShellService shellService, IApplicationUpdateService applicationUpdateService)
+ : base(view)
+ {
+ ShellService = shellService;
+ _sendCommand = new AsyncDelegateCommand(Send);
+ _applicationUpdateService = applicationUpdateService;
+ }
+
+ public string Name { get; set; }
+
+ public string Email { get; set; }
+
+ public string Message { get; set; }
+
+ public ICommand SendCommand => _sendCommand;
+
+ public IShellService ShellService { get; }
+
+ public void ShowDialog(object owner) => ViewCore.ShowDialog(owner);
+
+ private async Task Send()
+ {
+ try
+ {
+ var result = await _applicationUpdateService.SendFeedback(Name, Email, Message);
+ if (result)
+ ViewCore.Close();
+ }
+ catch (Exception ex)
+ {
+ Logger.Error($"FeedbackViewModel:Send: {ex}");
+ MessageBox.Show(Resources.SendFeedbackError, Resources.Warning);
+ }
+ finally
+ {
+ await Task.CompletedTask;
+ }
+ }
+ }
+}
diff --git a/src/TumblThree/TumblThree.Applications/Views/IFeedbackView.cs b/src/TumblThree/TumblThree.Applications/Views/IFeedbackView.cs
new file mode 100644
index 00000000..e90f852a
--- /dev/null
+++ b/src/TumblThree/TumblThree.Applications/Views/IFeedbackView.cs
@@ -0,0 +1,11 @@
+using System.Waf.Applications;
+
+namespace TumblThree.Applications.Views
+{
+ public interface IFeedbackView : IView
+ {
+ void ShowDialog(object owner);
+
+ void Close();
+ }
+}
diff --git a/src/TumblThree/TumblThree.Presentation/DesignData/SampleAboutViewModel.cs b/src/TumblThree/TumblThree.Presentation/DesignData/SampleAboutViewModel.cs
index f75a2c77..42c75351 100644
--- a/src/TumblThree/TumblThree.Presentation/DesignData/SampleAboutViewModel.cs
+++ b/src/TumblThree/TumblThree.Presentation/DesignData/SampleAboutViewModel.cs
@@ -6,7 +6,7 @@ namespace TumblThree.Presentation.DesignData
public class SampleAboutViewModel : AboutViewModel
{
public SampleAboutViewModel()
- : base(new MockAboutView(), null)
+ : base(new MockAboutView(), null, null)
{
}
diff --git a/src/TumblThree/TumblThree.Presentation/Properties/Resources.Designer.cs b/src/TumblThree/TumblThree.Presentation/Properties/Resources.Designer.cs
index e082362e..82896ac0 100644
--- a/src/TumblThree/TumblThree.Presentation/Properties/Resources.Designer.cs
+++ b/src/TumblThree/TumblThree.Presentation/Properties/Resources.Designer.cs
@@ -798,6 +798,15 @@ public static string DumpCrawlerData {
}
}
+ ///
+ /// Looks up a localized string similar to Email (won't be published; for a possible answer).
+ ///
+ public static string Email {
+ get {
+ return ResourceManager.GetString("Email", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Start download at.
///
@@ -861,6 +870,27 @@ public static string ExternalSettings {
}
}
+ ///
+ /// Looks up a localized string similar to Feedback.
+ ///
+ public static string Feedback {
+ get {
+ return ResourceManager.GetString("Feedback", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to We highly appreciate your feedback!
+ ///Tell us what you like or don't like about TumblThree.
+ ///Please write your message in english.
+ ///Alternatively you can use the {Issues section} on our project site to get in touch with us..
+ ///
+ public static string FeedbackIntroduction {
+ get {
+ return ResourceManager.GetString("FeedbackIntroduction", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Download location.
///
@@ -1149,6 +1179,15 @@ public static string MaxConnections {
}
}
+ ///
+ /// Looks up a localized string similar to Message.
+ ///
+ public static string Message {
+ get {
+ return ResourceManager.GetString("Message", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Metadata format:.
///
@@ -1527,6 +1566,15 @@ public static string SelectABlog {
}
}
+ ///
+ /// Looks up a localized string similar to Send.
+ ///
+ public static string Send {
+ get {
+ return ResourceManager.GetString("Send", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Send error details to TumblThreeApp.
///
diff --git a/src/TumblThree/TumblThree.Presentation/Properties/Resources.de.resx b/src/TumblThree/TumblThree.Presentation/Properties/Resources.de.resx
index 167537b7..83ffb68c 100644
--- a/src/TumblThree/TumblThree.Presentation/Properties/Resources.de.resx
+++ b/src/TumblThree/TumblThree.Presentation/Properties/Resources.de.resx
@@ -867,4 +867,19 @@ Alle Indexdateien in diesem Unterordner können bei Aktivierung für die globale
Der Speicherort wird nur für neu erstellte Blogs unter dieser Sammlung verwendet. Wenn eine Sammlung gelöscht wird, werden die zugewiesenen Blogs unter der Standardsammlung angezeigt.
+
+ Feedback
+
+
+ Wir freuen uns sehr über Ihr Feedback!
+Sagen Sie uns, was Ihnen an TumblThree gefällt oder nicht gefällt.
+Bitte schreiben Sie Ihre Nachricht auf Englisch.
+Alternativ können Sie uns auch über den Bereich {Issues} auf unserer Projektseite kontaktieren.
+
+
+ Senden
+
+
+ E-Mail (wird nicht veröffentlicht; für eine mögliche Antwort)
+
\ No newline at end of file
diff --git a/src/TumblThree/TumblThree.Presentation/Properties/Resources.es.resx b/src/TumblThree/TumblThree.Presentation/Properties/Resources.es.resx
index 6199f22c..37fc5fe3 100644
--- a/src/TumblThree/TumblThree.Presentation/Properties/Resources.es.resx
+++ b/src/TumblThree/TumblThree.Presentation/Properties/Resources.es.resx
@@ -864,4 +864,19 @@ Todos los archivos de índice dentro de esta subcarpeta se pueden usar para la v
La ubicación de descarga solo se usa para blogs recién creados en esa colección. Si se elimina una colección, los blogs asignados se mostrarán en la colección predeterminada.
+
+ Feedback
+
+
+ ¡Apreciamos mucho sus comentarios!
+Díganos lo que le gusta y lo que no le gusta de TumblThree.
+Por favor escriba su mensaje en inglés.
+Alternativamente, puede utilizar la {sección Problemas} en el sitio de nuestro proyecto para ponerse en contacto con nosotros.
+
+
+ Enviar
+
+
+ Correo electrónico (no se publicará; para una posible respuesta)
+
\ No newline at end of file
diff --git a/src/TumblThree/TumblThree.Presentation/Properties/Resources.fr.resx b/src/TumblThree/TumblThree.Presentation/Properties/Resources.fr.resx
index 6d36ef95..1d50d50d 100644
--- a/src/TumblThree/TumblThree.Presentation/Properties/Resources.fr.resx
+++ b/src/TumblThree/TumblThree.Presentation/Properties/Resources.fr.resx
@@ -867,4 +867,19 @@ Tous les fichiers d'index de ce sous-dossier peuvent être utilisés pour la vé
L'emplacement de téléchargement n'est utilisé que pour les blogs nouvellement créés dans cette collection. Si une collection est supprimée, les blogs attribués seront affichés sous la collection par défaut.
+
+ Réaction
+
+
+ Nous apprécions grandement vos commentaires !
+Dites-nous ce que vous aimez ou n'aimez pas à propos de TumblThree.
+Veuillez écrire votre message en anglais.
+Vous pouvez également utiliser la {section Problèmes} sur notre site de projet pour nous contacter.
+
+
+ Envoyer
+
+
+ Adresse e-mail (ne sera pas publié; pour une éventuelle réponse)
+
\ No newline at end of file
diff --git a/src/TumblThree/TumblThree.Presentation/Properties/Resources.resx b/src/TumblThree/TumblThree.Presentation/Properties/Resources.resx
index f21f6ce5..c22d1982 100644
--- a/src/TumblThree/TumblThree.Presentation/Properties/Resources.resx
+++ b/src/TumblThree/TumblThree.Presentation/Properties/Resources.resx
@@ -1143,4 +1143,22 @@ Possible categories: large, medium, small
The download location is only used for newly created blogs under that collection. If a collection is deleted the assigned blogs will be shown under the default collection.
+
+ Feedback
+
+
+ We highly appreciate your feedback!
+Tell us what you like or don't like about TumblThree.
+Please write your message in english.
+Alternatively you can use the {Issues section} on our project site to get in touch with us.
+
+
+ Email (won't be published; for a possible answer)
+
+
+ Message
+
+
+ Send
+
\ No newline at end of file
diff --git a/src/TumblThree/TumblThree.Presentation/TumblThree.Presentation.csproj b/src/TumblThree/TumblThree.Presentation/TumblThree.Presentation.csproj
index 2a157ada..2e661667 100644
--- a/src/TumblThree/TumblThree.Presentation/TumblThree.Presentation.csproj
+++ b/src/TumblThree/TumblThree.Presentation/TumblThree.Presentation.csproj
@@ -197,6 +197,10 @@
DesignerMSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+ MSBuild:CompileDesigner
@@ -320,6 +324,9 @@
ExceptionWindow.xaml
+
+ FeedbackView.xaml
+ FullScreenMediaView.xaml
diff --git a/src/TumblThree/TumblThree.Presentation/Views/AboutView.xaml b/src/TumblThree/TumblThree.Presentation/Views/AboutView.xaml
index 9e537207..5a4f486c 100644
--- a/src/TumblThree/TumblThree.Presentation/Views/AboutView.xaml
+++ b/src/TumblThree/TumblThree.Presentation/Views/AboutView.xaml
@@ -7,13 +7,13 @@
xmlns:dd="clr-namespace:TumblThree.Presentation.DesignData"
mc:Ignorable="d" Title="{x:Static p:Resources.About}" Icon="{StaticResource TumblThreeIcon}" MinWidth="200"
MinHeight="120"
- SizeToContent="WidthAndHeight" ShowInTaskbar="False" ResizeMode="NoResize"
+ SizeToContent="WidthAndHeight" ShowInTaskbar="False" ResizeMode="NoResize" WindowStartupLocation="CenterOwner"
d:DataContext="{d:DesignInstance dd:SampleAboutViewModel, IsDesignTimeCreatable=True}">
+ MinWidth="75" Margin="11,10" Height="22" />
@@ -22,7 +22,7 @@
@@ -38,6 +38,7 @@
+
@@ -94,11 +95,13 @@
+ Grid.Row="7" Height="22" Margin="6" />
+ Grid.Column="1" Grid.Row="7" Height="22" Margin="6" HorizontalAlignment="Left" Padding="10,0" />
+
diff --git a/src/TumblThree/TumblThree.Presentation/Views/CrawlerView.xaml b/src/TumblThree/TumblThree.Presentation/Views/CrawlerView.xaml
index 89f1ccf3..4fc0b4db 100644
--- a/src/TumblThree/TumblThree.Presentation/Views/CrawlerView.xaml
+++ b/src/TumblThree/TumblThree.Presentation/Views/CrawlerView.xaml
@@ -225,7 +225,8 @@