Skip to content

Commit a7a4d29

Browse files
committed
Display git info dialog for existing installations
1 parent b5158e1 commit a7a4d29

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/sporemodder/GitHubManager.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ public class GitHubManager extends AbstractManager {
3535

3636
private static final String PROPERTY_gitUsername = "gitUsername";
3737
private static final String PROPERTY_gitEmail = "gitEmail";
38+
private static final String PROPERTY_hasShowGitDialog = "hasShowGitDialog";
3839

3940
private String clientId;
4041
private String username;
4142
private String emailAddress;
4243
private String userAccessToken;
4344
private String lastDeviceLoginCode;
44-
private boolean hasAskedForGitUser;
45+
private boolean hasShowGitDialog;
4546

4647
/**
4748
* Returns the current instance of the GitHubManager class.
@@ -67,6 +68,8 @@ public void initialize(Properties properties) {
6768
emailAddress = properties.getProperty(PROPERTY_gitEmail);
6869
if (username != null) username = username.trim();
6970
if (emailAddress != null) emailAddress = emailAddress.trim();
71+
72+
hasShowGitDialog = properties.getProperty(PROPERTY_hasShowGitDialog, "false").equals("true");
7073
}
7174

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

8185
public boolean hasUsernameAndEmail() {
@@ -557,6 +561,10 @@ public void setRepositoryTopics(String repositoryName, List<String> topics) thro
557561
* After the dialog is shown, it will not be shown again.
558562
*/
559563
public void showFirstTimeDialog() {
560-
SetGitUserUI.show();
564+
if (!hasShowGitDialog) {
565+
SetGitUserUI.show();
566+
hasShowGitDialog = true;
567+
MainApp.get().saveSettings();
568+
}
561569
}
562570
}

src/sporemodder/MainApp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,11 @@ public void start(Stage primaryStage) {
271271
}
272272

273273
uiManager.showInitializationError();
274+
275+
gitHubManager.showFirstTimeDialog();
274276

275277
if (uiManager.isFirstTime()) {
276278
gameManager.showFirstTimeDialog();
277-
278-
gitHubManager.showFirstTimeDialog();
279279

280280
projectManager.showFirstTimeDialog();
281281

0 commit comments

Comments
 (0)