Commit a32ead24 authored by Evan W. Patton's avatar Evan W. Patton Committed by Jeffrey Schiller

Fix deleting gallery project from trash

Change-Id: Id4268b96f4603e5b74f34028fa40300ace9b3145
parent 9e6b6622
......@@ -14,6 +14,7 @@ import com.google.appinventor.client.settings.project.ProjectSettings;
import com.google.appinventor.client.tracking.Tracking;
import com.google.appinventor.shared.rpc.project.ProjectNode;
import com.google.appinventor.shared.rpc.project.ProjectRootNode;
import com.google.appinventor.shared.rpc.project.ProjectServiceAsync;
import com.google.appinventor.shared.rpc.project.UserProject;
import java.util.ArrayList;
......@@ -263,28 +264,26 @@ public final class Project {
public void deleteFromTrash() {
Tracking.trackEvent(Tracking.PROJECT_EVENT,
Tracking.PROJECT_ACTION_DELETE_PROJECT_YA, getProjectName());
final ProjectServiceAsync projectService = Ode.getInstance().getProjectService();
final OdeAsyncCallback<Void> deleteCallback = new OdeAsyncCallback<Void>() {
@Override
public void onSuccess(Void result) {
Ode.getInstance().getProjectManager().removeDeletedProject(getProjectId());
}
};
if (isPublished()) {
Ode.getInstance().getGalleryService().deleteApp(projectInfo.getGalleryId(),
new OdeAsyncCallback<Void>(
// failure message
MESSAGES.galleryDeleteError()) {
new OdeAsyncCallback<Void>(MESSAGES.galleryDeleteError()) {
@Override
public void onSuccess(Void result) {
// need to update gallery list
GalleryClient gallery = GalleryClient.getInstance();
gallery.appWasChanged();
GalleryClient.getInstance().appWasChanged();
// Delete the app
projectService.deleteProject(getProjectId(), deleteCallback);
}
});
} else {
Ode.getInstance().getProjectService().deleteProject(getProjectId(),
new OdeAsyncCallback<Void>(
// failure message
MESSAGES.deleteProjectError()) {
@Override
public void onSuccess(Void result) {
Ode.getInstance().getProjectManager().removeDeletedProject(getProjectId());
}
});
Ode.getInstance().getProjectService().deleteProject(getProjectId(), deleteCallback);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment