From fb6ee806dfd18bec847f53d23a24c9f70c0e6a7b Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Tue, 29 Dec 2020 10:33:43 +0100 Subject: [PATCH 01/27] move version number to AppConstats.java and use it in FeedbackController.java to send easy-installer version with feedback --- src/main/java/ecorp/easy/installer/AppConstants.java | 3 ++- src/main/java/ecorp/easy/installer/EasyInstaller.java | 3 ++- .../controllers/subcontrollers/FeedbackController.java | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/ecorp/easy/installer/AppConstants.java b/src/main/java/ecorp/easy/installer/AppConstants.java index 207c177d..8c3d7f10 100644 --- a/src/main/java/ecorp/easy/installer/AppConstants.java +++ b/src/main/java/ecorp/easy/installer/AppConstants.java @@ -20,12 +20,13 @@ import java.io.File; import java.nio.file.Paths; /** - * + * @TODO make all final static field with uppercase or lowcase but not a mix of both * @author Vincent Bourgmayer * @author Omer Akram */ public abstract class AppConstants { + public final static String APP_VERSION = "v0.11.1-beta"; public final static String Separator = FileSystems.getDefault().getSeparator(); public final static String OsName = System.getProperty("os.name"); public final static String JavaHome = System.getProperty("java.home"); diff --git a/src/main/java/ecorp/easy/installer/EasyInstaller.java b/src/main/java/ecorp/easy/installer/EasyInstaller.java index ee5bab32..fc941e36 100644 --- a/src/main/java/ecorp/easy/installer/EasyInstaller.java +++ b/src/main/java/ecorp/easy/installer/EasyInstaller.java @@ -44,6 +44,7 @@ public class EasyInstaller extends Application { private ResourceBundle i18n; //i18n mean "internationalization" private MainWindowController controller; + @Override public void start(Stage stage) throws Exception { @@ -62,7 +63,7 @@ public class EasyInstaller extends Application { //Defines some properties Scene scene = new Scene(root); - stage.setTitle(i18n.getString("appTitle")+"v0.11.1-beta"); + stage.setTitle(i18n.getString("appTitle")+AppConstants.APP_VERSION); stage.setScene(scene); stage.setResizable(true); diff --git a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FeedbackController.java b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FeedbackController.java index 94bd0bda..c1d46496 100644 --- a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FeedbackController.java +++ b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FeedbackController.java @@ -134,11 +134,11 @@ public class FeedbackController extends AbstractSubController { out.write("Timestamp: "+System.currentTimeMillis()); out.write("\nDevice model: "+this.deviceModel); out.write("\nOS name: "+AppConstants.OsName); + out.write("\neasy-installer version:"+AppConstants.APP_VERSION); if(selectedFeelings != null){ out.write("\nFeelings: "+selectedFeelings.getId()); } out.write("\nComment: \n"+this.commentArea.getText()); - } catch (IOException e) { logger.error("createAnswerFile()\n answerFilePath = {}\n error: {}", answerFilePath, e.toString()); return null; -- GitLab From fca335fcb8a99c08bf4d8d0840daac820b578419 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 18 Jan 2021 11:48:31 +0100 Subject: [PATCH 02/27] print all feedback content into commentArea --- .../subcontrollers/FeedbackController.java | 51 ++++++++++++++++--- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FeedbackController.java b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FeedbackController.java index c1d46496..8b69d608 100644 --- a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FeedbackController.java +++ b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FeedbackController.java @@ -25,6 +25,7 @@ import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.UUID; +import java.util.regex.Pattern; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.Label; @@ -41,6 +42,9 @@ import org.slf4j.LoggerFactory; */ public class FeedbackController extends AbstractSubController { private final static Logger logger = LoggerFactory.getLogger(FeedbackController.class); + private final static Pattern feelingsPattern = Pattern.compile("\nFeelings: .*\n"); + + private @FXML Button sendAnswerBtn; private @FXML TextArea commentArea; private @FXML Label thanksLabel; @@ -62,6 +66,7 @@ public class FeedbackController extends AbstractSubController { logger.warn("setParentController(), parentController.getDevice() == null"); } commentArea.setWrapText(true); + prefillCommentArea(); } @@ -86,6 +91,7 @@ public class FeedbackController extends AbstractSubController { selectedFeelings = clickedButton; logger.debug("onFeelingsSelected(), select: {}", selectedFeelings.getId()); } + updateFeelingInText(); } /** @@ -123,6 +129,42 @@ public class FeedbackController extends AbstractSubController { } + /** + * Prefill CommentArea with data + */ + private void prefillCommentArea(){ + StringBuffer sb = new StringBuffer(); + sb.append("Timestamp:"+System.currentTimeMillis()) + .append("\nDevice model: "+this.deviceModel) + .append("\nOS name: "+AppConstants.OsName) + .append("\neasy-installer version:"+AppConstants.APP_VERSION) + .append("\nFeelings: "); + if(selectedFeelings != null){ + sb.append(selectedFeelings.getId()); + }else{ + sb.append("not selected"); + } + sb.append("\nComment: \n"); + commentArea.setText(sb.toString()); + } + + /** + * Replace the feelings value in the commentArea + */ + private void updateFeelingInText(){ + logger.debug("update Feeling in text"); + final String content = commentArea.getText(); + + String feelings; + if(selectedFeelings != null) feelings = selectedFeelings.getId(); + else feelings = "not selected"; + logger.debug("contain: "+feelingsPattern.matcher(content).find()); + + final String newContent= feelingsPattern.matcher(content).replaceFirst("\nFeelings: "+feelings+"\n"); + commentArea.setText(newContent); + } + + /** * Create the file with feedback inside * @return @@ -131,14 +173,7 @@ public class FeedbackController extends AbstractSubController { String answerFilePath = AppConstants.getWritableFolder()+"feedback-"+UUID.randomUUID()+".txt"; try(PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(answerFilePath, true)))) { - out.write("Timestamp: "+System.currentTimeMillis()); - out.write("\nDevice model: "+this.deviceModel); - out.write("\nOS name: "+AppConstants.OsName); - out.write("\neasy-installer version:"+AppConstants.APP_VERSION); - if(selectedFeelings != null){ - out.write("\nFeelings: "+selectedFeelings.getId()); - } - out.write("\nComment: \n"+this.commentArea.getText()); + out.write(this.commentArea.getText()); } catch (IOException e) { logger.error("createAnswerFile()\n answerFilePath = {}\n error: {}", answerFilePath, e.toString()); return null; -- GitLab From b52b7666eefe736f36b3d67409af719a02d16617 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 18 Jan 2021 11:49:22 +0100 Subject: [PATCH 03/27] update send button text of feedback view and add another text for a label in feedback view --- src/main/resources/lang/translation.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/resources/lang/translation.properties b/src/main/resources/lang/translation.properties index a2d4cee0..3468ecd5 100644 --- a/src/main/resources/lang/translation.properties +++ b/src/main/resources/lang/translation.properties @@ -216,8 +216,9 @@ feedback_mTitle=Help us to improve the tool feedback_lbl_yourFeel=How satisfied are you with this software ease's of use ? feedback_lbl_comment=Do you have any thoughts on how to improve this software ? feedback_lbl_thanks=Thanks +feedback_lbl_sendPrecision=No identifiable information will be sent feedback_btn_leave=Leave -feedback_btn_send=Send to /e/ Team +feedback_btn_send=Share anonymously with /e/ developers feedback_btn_sendTryAgain=Failure. Try again to send feedback #credits -- GitLab From b51d087ddb518ef79a4f0507313378c7e4ed9146 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Mon, 18 Jan 2021 11:50:28 +0100 Subject: [PATCH 04/27] update fxml file of feedback view to add new label under 'send' button --- src/main/resources/fxml/9-feedback.fxml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/fxml/9-feedback.fxml b/src/main/resources/fxml/9-feedback.fxml index 42a02d11..46d027f6 100644 --- a/src/main/resources/fxml/9-feedback.fxml +++ b/src/main/resources/fxml/9-feedback.fxml @@ -86,6 +86,7 @@