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; ...@@ -14,6 +14,7 @@ import com.google.appinventor.client.settings.project.ProjectSettings;
import com.google.appinventor.client.tracking.Tracking; import com.google.appinventor.client.tracking.Tracking;
import com.google.appinventor.shared.rpc.project.ProjectNode; import com.google.appinventor.shared.rpc.project.ProjectNode;
import com.google.appinventor.shared.rpc.project.ProjectRootNode; 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 com.google.appinventor.shared.rpc.project.UserProject;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -262,29 +263,27 @@ public final class Project { ...@@ -262,29 +263,27 @@ public final class Project {
public void deleteFromTrash() { public void deleteFromTrash() {
Tracking.trackEvent(Tracking.PROJECT_EVENT, Tracking.trackEvent(Tracking.PROJECT_EVENT,
Tracking.PROJECT_ACTION_DELETE_PROJECT_YA, getProjectName()); 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()) { if (isPublished()) {
Ode.getInstance().getGalleryService().deleteApp(projectInfo.getGalleryId(), Ode.getInstance().getGalleryService().deleteApp(projectInfo.getGalleryId(),
new OdeAsyncCallback<Void>( new OdeAsyncCallback<Void>(MESSAGES.galleryDeleteError()) {
// failure message @Override
MESSAGES.galleryDeleteError()) { public void onSuccess(Void result) {
@Override // need to update gallery list
public void onSuccess(Void result) { GalleryClient.getInstance().appWasChanged();
// need to update gallery list // Delete the app
GalleryClient gallery = GalleryClient.getInstance(); projectService.deleteProject(getProjectId(), deleteCallback);
gallery.appWasChanged(); }
} });
});
} else { } else {
Ode.getInstance().getProjectService().deleteProject(getProjectId(), Ode.getInstance().getProjectService().deleteProject(getProjectId(), deleteCallback);
new OdeAsyncCallback<Void>(
// failure message
MESSAGES.deleteProjectError()) {
@Override
public void onSuccess(Void result) {
Ode.getInstance().getProjectManager().removeDeletedProject(getProjectId());
}
});
} }
} }
......
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