fix(gui): force jadx new version check by default
This commit is contained in:
@@ -244,6 +244,10 @@ public class Jadx {
|
||||
return version;
|
||||
}
|
||||
|
||||
public static boolean isDevVersion() {
|
||||
return getVersion().equals(VERSION_DEV);
|
||||
}
|
||||
|
||||
private static String searchJadxVersion() {
|
||||
try {
|
||||
ClassLoader classLoader = Jadx.class.getClassLoader();
|
||||
|
||||
@@ -45,7 +45,7 @@ public class JadxSettings extends JadxCLIArgs {
|
||||
|
||||
private static final Path USER_HOME = Paths.get(System.getProperty("user.home"));
|
||||
private static final int RECENT_PROJECTS_COUNT = 15;
|
||||
private static final int CURRENT_SETTINGS_VERSION = 17;
|
||||
private static final int CURRENT_SETTINGS_VERSION = 18;
|
||||
|
||||
private static final Font DEFAULT_FONT = new RSyntaxTextArea().getFont();
|
||||
|
||||
@@ -59,7 +59,7 @@ public class JadxSettings extends JadxCLIArgs {
|
||||
private Path lastOpenFilePath = USER_HOME;
|
||||
private Path lastSaveFilePath = USER_HOME;
|
||||
private boolean flattenPackage = false;
|
||||
private boolean checkForUpdates = false;
|
||||
private boolean checkForUpdates = true;
|
||||
private List<Path> recentProjects = new ArrayList<>();
|
||||
private String fontStr = "";
|
||||
private String smaliFontStr = "";
|
||||
@@ -715,6 +715,10 @@ public class JadxSettings extends JadxCLIArgs {
|
||||
}
|
||||
fromVersion++;
|
||||
}
|
||||
if (fromVersion == 17) {
|
||||
checkForUpdates = true;
|
||||
fromVersion++;
|
||||
}
|
||||
if (fromVersion != CURRENT_SETTINGS_VERSION) {
|
||||
LOG.warn("Incorrect settings upgrade. Expected version: {}, got: {}", CURRENT_SETTINGS_VERSION, fromVersion);
|
||||
}
|
||||
|
||||
@@ -814,7 +814,6 @@ public class MainWindow extends JFrame {
|
||||
}
|
||||
|
||||
private void initMenuAndToolbar() {
|
||||
final boolean devVersion = (Jadx.VERSION_DEV.equals(Jadx.getVersion()));
|
||||
Action openAction = new AbstractAction(NLS.str("file.open_action"), ICON_OPEN) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -1124,7 +1123,7 @@ public class MainWindow extends JFrame {
|
||||
JMenu help = new JMenu(NLS.str("menu.help"));
|
||||
help.setMnemonic(KeyEvent.VK_H);
|
||||
help.add(logAction);
|
||||
if (devVersion) {
|
||||
if (Jadx.isDevVersion()) {
|
||||
help.add(new AbstractAction("Show sample error report") {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import jadx.api.JadxDecompiler;
|
||||
import jadx.core.Jadx;
|
||||
import jadx.gui.update.data.Release;
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
@@ -56,8 +57,7 @@ public class JadxUpdate {
|
||||
}
|
||||
|
||||
private static Release checkForNewRelease() throws IOException {
|
||||
String version = JadxDecompiler.getVersion();
|
||||
if (version.contains("dev")) {
|
||||
if (Jadx.isDevVersion()) {
|
||||
LOG.debug("Ignore check for update: development version");
|
||||
return null;
|
||||
}
|
||||
@@ -65,11 +65,12 @@ public class JadxUpdate {
|
||||
if (latest == null) {
|
||||
return null;
|
||||
}
|
||||
String currentVersion = JadxDecompiler.getVersion();
|
||||
String latestName = latest.getName();
|
||||
if (latestName.equalsIgnoreCase(version)) {
|
||||
if (latestName.equalsIgnoreCase(currentVersion)) {
|
||||
return null;
|
||||
}
|
||||
if (VersionComparator.checkAndCompare(version, latestName) >= 0) {
|
||||
if (VersionComparator.checkAndCompare(currentVersion, latestName) >= 0) {
|
||||
return null;
|
||||
}
|
||||
LOG.info("Found new jadx version: {}", latest);
|
||||
|
||||
Reference in New Issue
Block a user