Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #666

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private MobileRouter createMobileRouter() {
return MobileResponse.redirect(r, PagePath.REFRESH);
}
}))
.and(MobileRoute.get(PagePath.REFRESH, r -> MobileResponse.view(r, new MobileRefreshPage(size))))
.and(MobileRoute.get(PagePath.REFRESH, r -> MobileResponse.view(r, new MobileRefreshPage())))
.and(MobileRoute.redirect("/index", PagePath.HOME))
.and(MobileRoute.redirect("/home", PagePath.HOME))
.and(MobileRoute.get(PagePath.LINKS, r -> MobileResponse.view(r, new MobileLinksOfTheWeekPage(size))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,20 @@ public class MobileRefreshPage extends StackPane {
*/
private final InvalidationListener invalidationListener = it -> {
if (RepositoryManager.isRepositoryUpdated()) {
Platform.runLater(() -> MobileLinkUtil.getToPage(PagePath.HOME));
Platform.runLater(() -> {
if (isGoToHomePage()) {
MobileLinkUtil.getToPage(PagePath.HOME);
}
});
}
};

private boolean goToHomePage = false;
private final WeakInvalidationListener weakInvalidationListener = new WeakInvalidationListener(invalidationListener);
private final RepositoryUpdater repositoryUpdater = new RepositoryUpdater();
private final CustomImageView logo;

public MobileRefreshPage(ObjectProperty<Size> size) {
public MobileRefreshPage() {
getStyleClass().add(DEFAULT_STYLE_CLASS);

Platform.runLater(() -> {
Expand All @@ -63,10 +68,15 @@ public MobileRefreshPage(ObjectProperty<Size> size) {
if (firstTimeSetup) {
setupFirstTimeUI();
} else {
goToHomePage = true;
setupUpdateUI();
}
}

private boolean isGoToHomePage() {
return goToHomePage;
}

private void setupFirstTimeUI() {
// center part (intro pane)
IntroPane introPane = new IntroPane();
Expand Down Expand Up @@ -98,7 +108,6 @@ private void setupFirstTimeUI() {

FadeIn fadeIn = new FadeIn(loadLabel);
fadeIn.setSpeed(2);
fadeIn.setOnFinished(e -> repositoryUpdater.performUpdate(false));

fadeOut.setOnFinished(e -> {
startButton.setVisible(false);
Expand All @@ -107,6 +116,14 @@ private void setupFirstTimeUI() {
});

fadeOut.play();

goToHomePage = true;

if (RepositoryManager.isRepositoryUpdated()) {
Platform.runLater(() -> {
MobileLinkUtil.getToPage(PagePath.HOME);
});
}
});

StackPane bottomBox = new StackPane(startButton, loadLabel);
Expand All @@ -115,6 +132,8 @@ private void setupFirstTimeUI() {
VBox content = new VBox(logo, introPane, bottomBox);
content.getStyleClass().add("content-box");
getChildren().add(content);

repositoryUpdater.performUpdate(false);
}

private void setupUpdateUI() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1034,12 +1034,12 @@

.mobile-refresh-page > .content-box {
-fx-alignment: top-center;
-fx-padding: 80px 0 40px 0;
-fx-padding: 90px 0 40px 0;
-fx-spacing: 20px;
}

.mobile-refresh-page > .content-box > .custom-image-view {
-fx-fit-height: 40px;
-fx-fit-height: 50px;
}

.mobile-refresh-page .bottom-box {
Expand Down Expand Up @@ -1077,6 +1077,7 @@
}

.mobile-refresh-page .bottom-box .load-label {
-fx-font-family: monospace;
-fx-font-size: 1.2em;
-fx-text-fill: -grey-60;
-fx-text-alignment: center;
Expand Down
Loading