Skip to content

Commit

Permalink
Display git info dialog for existing installations
Browse files Browse the repository at this point in the history
  • Loading branch information
emd4600 committed Oct 15, 2024
1 parent b5158e1 commit a7a4d29
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/sporemodder/GitHubManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ public class GitHubManager extends AbstractManager {

private static final String PROPERTY_gitUsername = "gitUsername";
private static final String PROPERTY_gitEmail = "gitEmail";
private static final String PROPERTY_hasShowGitDialog = "hasShowGitDialog";

private String clientId;
private String username;
private String emailAddress;
private String userAccessToken;
private String lastDeviceLoginCode;
private boolean hasAskedForGitUser;
private boolean hasShowGitDialog;

/**
* Returns the current instance of the GitHubManager class.
Expand All @@ -67,6 +68,8 @@ public void initialize(Properties properties) {
emailAddress = properties.getProperty(PROPERTY_gitEmail);
if (username != null) username = username.trim();
if (emailAddress != null) emailAddress = emailAddress.trim();

hasShowGitDialog = properties.getProperty(PROPERTY_hasShowGitDialog, "false").equals("true");
}

@Override public void saveSettings(Properties properties) {
Expand All @@ -76,6 +79,7 @@ public void initialize(Properties properties) {
if (emailAddress != null && !emailAddress.isBlank()) {
properties.put(PROPERTY_gitEmail, emailAddress);
}
properties.put(PROPERTY_hasShowGitDialog, hasShowGitDialog ? "true" : "false");
}

public boolean hasUsernameAndEmail() {
Expand Down Expand Up @@ -557,6 +561,10 @@ public void setRepositoryTopics(String repositoryName, List<String> topics) thro
* After the dialog is shown, it will not be shown again.
*/
public void showFirstTimeDialog() {
SetGitUserUI.show();
if (!hasShowGitDialog) {
SetGitUserUI.show();
hasShowGitDialog = true;
MainApp.get().saveSettings();
}
}
}
4 changes: 2 additions & 2 deletions src/sporemodder/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ public void start(Stage primaryStage) {
}

uiManager.showInitializationError();

gitHubManager.showFirstTimeDialog();

if (uiManager.isFirstTime()) {
gameManager.showFirstTimeDialog();

gitHubManager.showFirstTimeDialog();

projectManager.showFirstTimeDialog();

Expand Down

0 comments on commit a7a4d29

Please sign in to comment.