Refactor: Move AvoidStandbyModeService from BisqApp to BisqExecutable.setupAvoidStandbyMode

This commit is contained in:
chimp1984 2020-09-30 22:26:42 -05:00
parent 4f9a6ea436
commit bb99eef059
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
3 changed files with 10 additions and 4 deletions

View File

@ -131,6 +131,7 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
CommonSetup.setupUncaughtExceptionHandler(this);
setupGuice();
setupAvoidStandbyMode();
startApplication();
}
@ -170,6 +171,9 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
}
}
protected void setupAvoidStandbyMode() {
}
protected abstract void startApplication();
// Once the application is ready we get that callback and we start the setup

View File

@ -32,7 +32,6 @@ import bisq.desktop.main.overlays.windows.ShowWalletDataWindow;
import bisq.desktop.util.CssTheme;
import bisq.desktop.util.ImageUtil;
import bisq.core.app.AvoidStandbyModeService;
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.btc.wallet.WalletsManager;
import bisq.core.dao.governance.voteresult.MissingDataRequestService;
@ -90,7 +89,6 @@ import static bisq.desktop.util.Layout.MIN_WINDOW_WIDTH;
@Slf4j
public class BisqApp extends Application implements UncaughtExceptionHandler {
private static final long LOG_MEMORY_PERIOD_MIN = 10;
@Setter
private static Consumer<Application> appLaunchedHandler;
@Getter
@ -132,8 +130,6 @@ public class BisqApp extends Application implements UncaughtExceptionHandler {
mainView.setOnApplicationStartedHandler(onApplicationStartedHandler);
scene = createAndConfigScene(mainView, injector);
setupStage(scene);
injector.getInstance(AvoidStandbyModeService.class).init();
} catch (Throwable throwable) {
log.error("Error during app init", throwable);
handleUncaughtException(throwable, false);

View File

@ -21,6 +21,7 @@ import bisq.desktop.common.UITimer;
import bisq.desktop.common.view.guice.InjectorViewFactory;
import bisq.desktop.setup.DesktopPersistedDataHost;
import bisq.core.app.AvoidStandbyModeService;
import bisq.core.app.BisqExecutable;
import bisq.common.UserThread;
@ -121,6 +122,11 @@ public class BisqAppMain extends BisqExecutable {
PersistedDataHost.apply(DesktopPersistedDataHost.getPersistedDataHosts(injector));
}
@Override
protected void setupAvoidStandbyMode() {
injector.getInstance(AvoidStandbyModeService.class).init();
}
@Override
protected void startApplication() {
// We need to be in user thread! We mapped at launchApplication already. Once