Skip to content

Commit

Permalink
remove feedback feature in open source code
Browse files Browse the repository at this point in the history
  • Loading branch information
francescotescari committed Mar 25, 2021
1 parent 6d04055 commit 5925cd6
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 2,095 deletions.
28 changes: 0 additions & 28 deletions LiveFeedback.proto

This file was deleted.

13 changes: 2 additions & 11 deletions src/main/java/com/xiaomitool/v2/engine/ToolManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import com.xiaomitool.v2.gui.drawable.DrawableManager;
import com.xiaomitool.v2.language.Lang;
import com.xiaomitool.v2.logging.Log;
import com.xiaomitool.v2.logging.feedback.LiveFeedbackEasy;
import com.xiaomitool.v2.logging.feedback.LogSender;
import com.xiaomitool.v2.resources.ResourcesConst;
import com.xiaomitool.v2.resources.ResourcesManager;
import com.xiaomitool.v2.utility.RunnableMessage;
Expand All @@ -18,10 +16,8 @@
import com.xiaomitool.v2.utility.utils.StrUtils;
import com.xiaomitool.v2.utility.utils.UpdateUtils;
import com.xiaomitool.v2.xiaomi.XiaomiKeystore;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.stage.Stage;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
Expand All @@ -43,10 +39,6 @@ public class ToolManager {
@Override
public int run() throws InterruptedException {
ToolManager.setOnExitAskForFeedback(false);
if (LogSender.isLogCooldown()) {
return 0;
}
ActionsStatic.ASK_FOR_FEEDBACK().run();
return 0;
}
};
Expand Down Expand Up @@ -119,9 +111,8 @@ public synchronized static void exit(int code) {
return;
}
exiting = true;
LiveFeedbackEasy.sendClose();
saveOptions();
LiveFeedbackEasy.runOnFeedbackSent(() -> {
Platform.runLater(() -> {
for (Stage stage : activeStages) {
Platform.runLater(new Runnable() {
@Override
Expand All @@ -139,7 +130,7 @@ public void run() {
}
});
System.exit(code);
}, Platform.isFxApplicationThread());
});
}

private static void saveOptions() {
Expand Down
15 changes: 0 additions & 15 deletions src/main/java/com/xiaomitool/v2/engine/actions/ActionsDynamic.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.xiaomitool.v2.gui.visual.*;
import com.xiaomitool.v2.language.LRes;
import com.xiaomitool.v2.logging.Log;
import com.xiaomitool.v2.logging.feedback.LiveFeedbackEasy;
import com.xiaomitool.v2.procedure.ProcedureRunner;
import com.xiaomitool.v2.procedure.RInstall;
import com.xiaomitool.v2.procedure.RMessage;
Expand Down Expand Up @@ -581,20 +580,6 @@ public static RunnableMessage START_PROCEDURE(Device device, RInstall startFromH
return new RunnableMessage() {
@Override
public int run() throws InterruptedException {
if (startFromHere == null && device != null) {
try {
DeviceProperties properties = device.getDeviceProperties();
HashMap<String, String> logginProps = new HashMap<>();
logginProps.put("d", String.valueOf(properties.getCodename(false)));
logginProps.put("c", String.valueOf(properties.get(DeviceProperties.CODEBASE)));
logginProps.put("v", String.valueOf(properties.get(DeviceProperties.FULL_VERSION)));
logginProps.put("bs", String.valueOf(device.getAnswers().getUnlockStatus()));
logginProps.put("sn", String.valueOf(device.getAnswers().getSerialNumber()));
logginProps.put("rg", String.valueOf(SettingsUtils.getRegion()));
LiveFeedbackEasy.sendLog("DATA", new JSONObject(logginProps).toString());
} catch (Exception ignored) {
}
}
Log.info("Starting installation part main procedure");
InstallPane installPane;
ProcedureRunner thisRunner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.xiaomitool.v2.language.LRes;
import com.xiaomitool.v2.language.Lang;
import com.xiaomitool.v2.logging.Log;
import com.xiaomitool.v2.logging.feedback.LiveFeedbackEasy;
import com.xiaomitool.v2.procedure.install.GenericInstall;
import com.xiaomitool.v2.resources.ResourcesConst;
import com.xiaomitool.v2.resources.ResourcesManager;
Expand Down Expand Up @@ -66,7 +65,6 @@ public static RunnableMessage MAIN() {
System.exit(0);
return 0;
}
LiveFeedbackEasy.sendOpen(ResourcesConst.getLogString(), null);
Log.info("Disclaimer accepted");
CHECK_FOR_UPDATES_V2().run();
REQUIRE_REGION().run();
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/xiaomitool/v2/gui/WindowManager.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package com.xiaomitool.v2.gui;

import com.xiaomitool.v2.engine.ToolManager;
import com.xiaomitool.v2.engine.actions.ActionsStatic;
import com.xiaomitool.v2.gui.controller.*;
import com.xiaomitool.v2.gui.drawable.DrawableManager;
import com.xiaomitool.v2.gui.fxml.FxmlManager;
import com.xiaomitool.v2.gui.visual.OverlayPane;
import com.xiaomitool.v2.gui.visual.ToastPane;
import com.xiaomitool.v2.gui.visual.VisiblePane;
import com.xiaomitool.v2.logging.Log;
import com.xiaomitool.v2.logging.feedback.LogSender;
import com.xiaomitool.v2.utility.Pointer;
import com.xiaomitool.v2.utility.RunnableMessage;
import com.xiaomitool.v2.utility.SilentCompleteFuture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,26 @@
import com.xiaomitool.v2.language.LRes;
import com.xiaomitool.v2.language.Lang;
import com.xiaomitool.v2.logging.Log;
import com.xiaomitool.v2.logging.feedback.LogSender;
import com.xiaomitool.v2.utility.Pair;
import com.xiaomitool.v2.utility.RunnableMessage;
import com.xiaomitool.v2.utility.utils.SettingsUtils;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableListBase;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.geometry.Pos;
import javafx.scene.Cursor;
import javafx.scene.control.*;
import javafx.scene.image.ImageView;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
import javafx.stage.DirectoryChooser;
import javafx.util.Callback;

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class SettingsController extends DefaultController {
private static final OverlayPane settingsOverlayPane = new OverlayPane();
Expand All @@ -63,6 +51,7 @@ public class SettingsController extends DefaultController {
@FXML
private ComboBox<String> REGION_COMBO, LANG_COMBO;


public static PopupWindow getFeedbackPopupWindow() {
if (feedbackPopup == null) {
feedbackPopup = new PopupWindow(500, 400);
Expand All @@ -71,11 +60,12 @@ public static PopupWindow getFeedbackPopupWindow() {
TextArea textArea = new TextArea();
textArea.setPrefHeight(180);
textArea.setFont(Font.font(14));
textArea.setPromptText("Please explain your problem here.\r\nWrite in English or leave blank if you just want to send the log.\r\n" + LRes.FEEDBACK_ONLY_ONE.toEnglish());
textArea.setPromptText("Sending feedback is not available in this build");
textArea.setTextFormatter(new TextFormatter<String>(change ->
change.getControlNewText().length() <= 500 ? change : null));
CustomButton button = new CustomButton(LRes.SEND_FEEDBACK);
button.setFont(Font.font(15));
button.setDisable(true);
textArea.setFocusTraversable(false);
CheckBox checkBox = new CheckBox(LRes.INCLUDE_LOG_FILES.toString());
checkBox.setSelected(true);
Expand Down Expand Up @@ -109,9 +99,9 @@ public void run() {
ToastPane feedbackToast = feedbackPopup.getToastPane();
ToastPane settingsToast = settingsToastPane;
try {
if (!LogSender.uploadFeedback(text, sendLogFile)) {
/* if (!LogSender.uploadFeedback(text, sendLogFile)) {
throw new Exception("Failed to uplaod the feedback, check the log file");
}
}*/
ToolManager.setOnExitAskForFeedback(false);
feedbackPopup.getController().closeWindow();
Platform.runLater(() -> settingsToast.toast(LRes.FEEDBACK_SENT.toString()));
Expand All @@ -122,7 +112,7 @@ public void run() {
Platform.runLater(() -> feedbackToast.toast(LRes.FEEDBACK_ERROR.toString()));
}
}
LogSender.cooldownCounter(button);
//LogSender.cooldownCounter(button);
}
}).start();
}
Expand Down
Loading

0 comments on commit 5925cd6

Please sign in to comment.