Search in sources :

Example 1 with Release

use of jadx.gui.update.data.Release in project jadx by skylot.

the class MainWindow method checkForUpdate.

private void checkForUpdate() {
    if (!settings.isCheckForUpdates()) {
        return;
    }
    JadxUpdate.check(new IUpdateCallback() {

        @Override
        public void onUpdate(final Release r) {
            SwingUtilities.invokeLater(new Runnable() {

                @Override
                public void run() {
                    updateLink.setText(String.format(NLS.str("menu.update_label"), r.getName()));
                    updateLink.setVisible(true);
                }
            });
        }
    });
}
Also used : IUpdateCallback(jadx.gui.update.JadxUpdate.IUpdateCallback) Release(jadx.gui.update.data.Release)

Example 2 with Release

use of jadx.gui.update.data.Release in project jadx by skylot.

the class JadxUpdate method check.

public static void check(final IUpdateCallback callback) {
    Runnable run = new Runnable() {

        @Override
        public void run() {
            try {
                Release release = checkForNewRelease();
                if (release != null) {
                    callback.onUpdate(release);
                }
            } catch (Exception e) {
                LOG.debug("Jadx update error", e);
            }
        }
    };
    Thread thread = new Thread(run);
    thread.setName("Jadx update thread");
    thread.setPriority(Thread.MIN_PRIORITY);
    thread.start();
}
Also used : Release(jadx.gui.update.data.Release) IOException(java.io.IOException)

Example 3 with Release

use of jadx.gui.update.data.Release in project jadx by skylot.

the class JadxUpdate method checkForNewRelease.

private static Release checkForNewRelease() throws IOException {
    String version = JadxDecompiler.getVersion();
    if (version.contains("dev")) {
        LOG.debug("Ignore check for update: development version");
        return null;
    }
    Release latest = get(GITHUB_LATEST_RELEASE_URL, RELEASE_TYPE);
    if (latest == null) {
        return null;
    }
    String latestName = latest.getName();
    if (latestName.equalsIgnoreCase(version)) {
        return null;
    }
    if (VersionComparator.checkAndCompare(version, latestName) >= 0) {
        return null;
    }
    LOG.info("Found new jadx version: {}", latest);
    return latest;
}
Also used : Release(jadx.gui.update.data.Release)

Aggregations

Release (jadx.gui.update.data.Release)3 IUpdateCallback (jadx.gui.update.JadxUpdate.IUpdateCallback)1 IOException (java.io.IOException)1