Skip to content

Commit

Permalink
Solved Auto-loading project from Trash mit-cml#3208
Browse files Browse the repository at this point in the history
  • Loading branch information
d1vyanshu-kumar committed Jan 14, 2025
1 parent d3c9457 commit 3544839
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 11 additions & 2 deletions appinventor/appengine/src/com/google/appinventor/client/Ode.java
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,17 @@ private void openPreviousProject() {
return;
}
final String value = userSettings.getSettings(SettingsConstants.USER_GENERAL_SETTINGS)
.getPropertyValue(SettingsConstants.GENERAL_SETTINGS_CURRENT_PROJECT_ID);
openProject(value);
.getPropertyValue(SettingsConstants.GENERAL_SETTINGS_CURRENT_PROJECT_ID);
if (value.isEmpty()) {
switchToProjectsView();
return;
}
long projectId = Long.parseLong(value);
if (projectManager.isProjectInTrash(projectId)) {
switchToProjectsView();
} else {
openProject(value);
}
}

private void openProject(String projectIdString) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,9 @@ private void fireProjectDeleted(Project project) {
listener.onProjectDeleted(project);
}
}

public boolean isProjectInTrash(long projectId) {
Project project = projectsMap.get(projectId);
return project != null && project.isInTrash();
}
}

0 comments on commit 3544839

Please sign in to comment.