forked from I2P_Developers/i2p.i2p
* Plugins: Add completion message after all-update check
This commit is contained in:
@ -127,6 +127,7 @@ public class PluginStarter implements Runnable {
|
||||
}
|
||||
|
||||
Log log = ctx.logManager().getLog(PluginStarter.class);
|
||||
int updated = 0;
|
||||
for (Map.Entry<String, String> entry : toUpdate.entrySet()) {
|
||||
String appName = entry.getKey();
|
||||
if (log.shouldLog(Log.WARN))
|
||||
@ -152,7 +153,13 @@ public class PluginStarter implements Runnable {
|
||||
Thread.sleep(5*1000);
|
||||
} catch (InterruptedException ie) {}
|
||||
} while (puh.isRunning());
|
||||
if (puh.wasUpdateSuccessful())
|
||||
updated++;
|
||||
}
|
||||
if (updated > 0)
|
||||
puc.setDoneStatus(ngettext("1 plugin updated", "{0} plugins updated", updated, ctx));
|
||||
else
|
||||
puc.setDoneStatus(Messages.getString("Plugin update check complete", ctx));
|
||||
}
|
||||
|
||||
/** this shouldn't throw anything */
|
||||
@ -764,4 +771,9 @@ public class PluginStarter implements Runnable {
|
||||
method.setAccessible(true);
|
||||
method.invoke(urlClassLoader, new Object[]{u});
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
private static String ngettext(String s, String p, int n, I2PAppContext ctx) {
|
||||
return Messages.getString(n, s, p, ctx);
|
||||
}
|
||||
}
|
||||
|
@ -104,6 +104,12 @@ public class PluginUpdateChecker extends UpdateHandler {
|
||||
public void setAppStatus(String status) {
|
||||
updateStatus(status);
|
||||
}
|
||||
|
||||
/** @since 0.8.13 */
|
||||
public void setDoneStatus(String status) {
|
||||
updateStatus(status);
|
||||
scheduleStatusClean(status);
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return _pluginUpdateCheckerRunner != null && _pluginUpdateCheckerRunner.isRunning();
|
||||
|
@ -42,6 +42,8 @@ public class PluginUpdateHandler extends UpdateHandler {
|
||||
private static PluginUpdateRunner _pluginUpdateRunner;
|
||||
private String _xpi2pURL;
|
||||
private String _appStatus;
|
||||
private volatile boolean _updated;
|
||||
|
||||
private static final String XPI2P = "app.xpi2p";
|
||||
private static final String ZIP = XPI2P + ".zip";
|
||||
public static final String PLUGIN_DIR = "plugins";
|
||||
@ -92,6 +94,11 @@ public class PluginUpdateHandler extends UpdateHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @since 0.8.13 */
|
||||
public boolean wasUpdateSuccessful() {
|
||||
return _updated;
|
||||
}
|
||||
|
||||
private void scheduleStatusClean(String msg) {
|
||||
SimpleScheduler.getInstance().addEvent(new Cleaner(msg), 20*60*1000);
|
||||
}
|
||||
@ -108,6 +115,7 @@ public class PluginUpdateHandler extends UpdateHandler {
|
||||
}
|
||||
|
||||
public class PluginUpdateRunner extends UpdateRunner implements Runnable, EepGet.StatusListener {
|
||||
private boolean _updated;
|
||||
|
||||
public PluginUpdateRunner(String url) {
|
||||
super();
|
||||
@ -115,6 +123,7 @@ public class PluginUpdateHandler extends UpdateHandler {
|
||||
|
||||
@Override
|
||||
protected void update() {
|
||||
_updated = false;
|
||||
updateStatus("<b>" + _("Downloading plugin from {0}", _xpi2pURL) + "</b>");
|
||||
// use the same settings as for updater
|
||||
boolean shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue();
|
||||
@ -383,6 +392,7 @@ public class PluginUpdateHandler extends UpdateHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
_updated = true;
|
||||
to.delete();
|
||||
if (Boolean.valueOf(props.getProperty("dont-start-at-install")).booleanValue()) {
|
||||
if (Boolean.valueOf(props.getProperty("router-restart-required")).booleanValue())
|
||||
|
Reference in New Issue
Block a user